Граф коммитов

594 Коммитов

Автор SHA1 Сообщение Дата
Young Kim 223a885613 Group Signature Elements by Element Width (#610)
This change is to enforce the new constraint on signature packing: pack signature elements by data width. Before we introduce fp16 type, every element was assumed to reserve 32 bits. Since we are introducing a new 16 bit data type, we need a new way to enforce signature rules.

After discussions we decided that it would be nice to pack elements based on data width. However, we are still enforcing the rule that each row contains up to 4 elements, regardless of the size. This way, depending on the hardware support drivers can optimize packing signatures, while on DXIL level we maintain the assumption that there are 4 elements per row. We are also still constraining on the total number of rows to be 32 for now. This can be changed in the future if people find this limit to be an issue.
2017-09-06 11:04:33 -07:00
Young Kim 1590f7e953 Execution Test: Wave Intrinsics Caps check (#613) 2017-09-05 16:16:29 -07:00
theswiftfox e97dd2a0cd Fix typo in SPIR-V.rst (#612)
HLSL semantic and Vulkan ``Loation`` -> HLSL semantic and Vulkan ``Location``
2017-09-01 13:37:36 -07:00
Xiang Li 20268a4725 Code cleanup. 2017-09-01 10:47:29 -07:00
Xiang Li ddc78174f4 Split big alloca first. 2017-09-01 10:47:29 -07:00
Ehsan 7a0ae9e90b RWTexture Load() and Texture2DMS(Array) (#609)
* [spirv] OpImageRead can read a vector of any size.

* [spirv] Add support for Load() of RWTexture types.

* [spirv] Texture2DMS and Texture2DMSArray types.

* [spirv] Capability for 1D images without a sampler

* [spirv] Update documentation of Texture2DMS(Array)
2017-08-31 16:10:13 -07:00
Lei Zhang 5eaf13b879 [spirv] Support {Append|Consume}StructuredBuffer (#608)
* [spirv] Support {Append|Consume}StructuredBuffer

* Supported the {Append|Consume}StructureBuffer type
* Supported .Append() and .Consume()

{Append|Consume}StructureBuffer<S> is implemented as OpTypeStruct
with an OpTypeRuntimeArray of S. And each such array will have
an associated counter, whose type is OpTypeStruct of 32-bit integer.
The index for .Append()/.Conume() is fetched by doing atomic
operations on the associated counter.

* Use subtraction of one instead of addition of negative one
2017-08-31 16:09:45 -07:00
Xiang Li ceb0c7aee7 Allocate correct size for idxList in TranslateStructBufMatSubscript. 2017-08-30 12:00:28 -07:00
Lei Zhang 13adee8411 [spirv] Support output disassembly in dxc (#603)
* [spirv] Support output disassembly in dxc

* Use normal pointers in DisassembleSpirv() and add tests

* keep script_dir under setlocal
2017-08-30 08:53:29 -07:00
Lei Zhang f4e379db85 [spirv] Support assigning to objects of composite types (#598)
For these objects, if the lhs and rhs are of different storage
class, we may need to do the assignment recursively at the
non-composite level since OpStore requires that the pointer's
type operand must be the same as the type of object.
2017-08-30 08:52:54 -07:00
Ehsan d5592ce089 [spirv] Add translation of RWTexture... types. (#602)
* [spirv] Add translation of RWTexture... types.
* Update documentation for RWTexture types.
* Fix table formatting in doc.
2017-08-29 14:57:54 -07:00
Marcelo Lopez Ruiz 6322c8ca3f Fix #604 by handling scalar functional inits in ICE and evaluation (#605) 2017-08-29 14:56:40 -07:00
Young Kim c110357e99 fix sign unsign comparison for wave intrinsics test (#601) 2017-08-29 10:32:57 -07:00
Ehsan f3d5010b2e [spirv] Refactor Buffer and Texture load functions (#600)
[spirv] Refactor Buffer and Texture load functions

Also fixes 2 bugs:

1- RWBuffer must use OpImageRead rather than OpImageFetch.
2- OpImageFetch/Read take a parameter whose type is an image. We were
incorectly passing the *variable* (which is of type pointer-to-image).

This change also allows TextureXX<type> to be used with types other than
float4. Tests were added for such cases.
2017-08-28 14:35:40 -07:00
Tex Riddell e1fd230b92 Fix out of bounds memory write in GetResourceBindingDescByName (#555)
If reflection version is not D3D12, ZeroMemoryToOut will overwrite
memory outside of the user's pDesc struct, leading to stack or
heap corruption.  I removed ZeroMemoryToOut, since the right amount
of data should be written in each case.
2017-08-28 13:49:31 -07:00
Lei Zhang 10a4a84f68 [spirv] Avoid generating duplicated debug names for images (#597) 2017-08-25 15:28:38 -07:00
Lei Zhang bc1301af13 [spirv] Update SPIR-V.rst doc (#596)
Moved logistics and designs to the wiki page. Now the doc is only
for HLSL to SPIR-V mappings.

Also link to the doc and wiki page in the main README.md.
2017-08-25 08:56:42 -07:00
Ehsan 59d36fefc0 [spirv] Support writing to RWBuffers. (#594) 2017-08-24 20:36:27 -07:00
Lei Zhang 92a73a28c5 [spirv] Add support for (RW)StructuredBuffer (#593)
* Supported (RW)StructuredBuffer types
* Supported accessing elements in (RW)StructuredBuffer
* Supported the Load() method
* Supported std430 layout

Also optimized OpAccessChain CodeGen. This is necessary right
now because otherwise we will have pointers to intermediate
composite objects like structs and arrays. Structs/arrays are
different types with and without layout decorations. To have the
correct struct/array pointer type for OpAccessChain, we need to
always pass in the correct layout rules when translating the
types, which is not easy. Optimizing intermediate OpAccessChain
away solves the problem because scalar/vector/matrix types are
unique given the same parameter.
2017-08-24 20:36:07 -07:00
Young Kim bdd7c63873 Skip validator <1.2 for half tests (#595) 2017-08-24 14:11:45 -07:00
Lei Zhang 516f3270c8 [spirv] Add support for ConstantBuffer (#590)
Also optimized codgen for consecutive array/struct indexing
expressions to avoid generating multiple OpAccesChains.
2017-08-23 21:52:27 -07:00
Ehsan 2b5f9ffe1d [spirv] Buffer/RWbuffer Load() and operator[] (#589)
* [spirv] Support Load function for Buffer/RWBuffer.

* [spirv] Operator[] for Buffer/RWBuffer.

Also some improvement for handling of vec2 and vec3 cases:
use OpVectorShuffle instead of OpCompositeExtract&OpCompositeConstruct.

* Address code review comments.
2017-08-23 21:51:53 -07:00
Ehsan 6b09a407bb [spirv] Support translation of Buffer & RWBuffer (#588) 2017-08-23 09:15:11 -07:00
Ehsan a4efd3babc [spirv] Add test for passthrough compute shader. (#587)
Using raw buffers (ByteAddressBuffer and RWByteAddressBuffer).
2017-08-22 22:24:19 -07:00
Lei Zhang 8bb01b2dac [spirv] Support cbuffer and layout decorations (#585)
* Added support for the cbuffer type
* Added support for accessing elements in cbuffer
* Added support for std140 layout rules
2017-08-22 22:23:36 -07:00
Young Kim c551a1acac Fix wave intrinsic prefix test to not assume that lane id is in same order as thread id (#586) 2017-08-22 15:24:46 -07:00
Young Kim b89c21d25b Fp16 constant buffer and shader flag (#575)
This change is to support fp16 on constant buffer.
We are still keeping a row pitch of 4 dwords. So we can fit up to 8 halfs in one row.
Dword data types will be aligned to dword address space for efficiency. We are also introducing new flags "use native low precision" if we have low precision type present and /no-min-precision option is enabled.
2017-08-21 15:06:45 -07:00
Ehsan f17bbb3c39 [spirv] Translation of SV_DispatchThreadID. (#582) 2017-08-21 08:43:56 -07:00
Ehsan 4cbc45cf27 [spirv] Support (RW)ByteAddrressBuffer and load/store methods (#581) 2017-08-21 08:43:37 -07:00
Ehsan 1e6a9afd47 [spirv] Translate numthreads attribute for CS. (#580) 2017-08-21 08:43:06 -07:00
Lei Zhang 9e67da0c2f [spirv] Support non-constant offset in texture methods (#579)
Non-constant offset should be translated into the Offset image
operands instead of ConstOffset.
2017-08-21 08:42:34 -07:00
Xiang Li 06d3407ed4 Dump HLSLBufferDecl info in ASTDumper::dumpDecl. 2017-08-18 15:12:49 -07:00
Xiang Li 99af88f63b Update oprand name for BFI. 2017-08-18 15:12:49 -07:00
Lei Zhang 0e0e014232 [spirv] Add CL option for stage I/O location assignment order (#578)
A new CL option -fvk-stage-io-order={alpha|decl} is added to
control the order for assigning stage I/O location numbers.
The default is also changed to declaration order (decl) instead
of alphabetical order (alpha).

Also extended testing fixtures to support additional CL options.
2017-08-17 20:59:45 -07:00
Lei Zhang 65d17b4f7c [spirv] Support setting resource binding numbers (#577)
This commit add support for resource binding number assignment via
both the explicit and the implicit way.

The explicit way:

[[vk::binding(X[, Y])]] is introduced, with X denoting the binding
number and the optional Y denoting the set number. If Y is missing,
the set number will be set to 0. This attribute can only be attached
to variables.

The implicit way:

register(xX, spaceY) will be used to deduce the correct set and
binding number for a given resource. X will be used as the binding
number and Y will be used as the set number. Right now we do not
consider the resource type x, which means binding numbers can
overlap given the same X and Y but not x. That is to be addressed
later.
2017-08-17 20:56:48 -07:00
Lei Zhang 2b3be347a9 [spirv] Support six texture methods (#576)
This commit add support for the following methods on textures:
* .Sample()
* .SampleLevel()
* .SampleGrad()
* .SampleBias()
* .Load()
* .Gather()
2017-08-17 20:55:46 -07:00
Lei Zhang f96f92d711 [spirv] Update SPIR-V dependencies and disable debug iterators (#574) 2017-08-16 21:11:48 -07:00
Lei Zhang f284c982c9 [spirv] Support texture and sampler types (#572)
This commit add support for the following types:
* Texture1D, Texture2D, Texture3D, TextureCube
* Texture1DArray, Texture2DArray, TextureCubeArray
* SamplerState, SamplerComparisonState, sampler

Buffer, Texture2DMS, and Texture2DMSArray is not supported yet,
also setting sampler states.

Texture types will be translated OpTypeImage, and sampler types
will be translated into OpTypeSampler.
2017-08-16 21:09:20 -07:00
Xiang Li eab2c2ff0f Support findInjectedSource (#573)
* Support findInjectedSource and set correct count for DxcDiaTableInjectedSource.
2017-08-16 18:16:37 -07:00
Lei Zhang 299bb535b8 [spirv] Support interpolation modes on PS input variables (#571) 2017-08-15 20:58:27 -07:00
Lei Zhang 9fbe9bb349 [spirv] Turn on C++11 attributes and support [[vk::location(X)]] (#568)
* [spirv] Turn on C++11 attributes and support [[vk::location(X)]]

This commit turns on C++11 attributes for HLSL globally. C++11
attributes will be parsed where they are allowed in C++11.
However, they will just result in an warning of ignored attribute,
without any semantic impact for the general DXIL CodeGen.

For SPIR-V CodeGen, C++11 attributes within the vk namespace will
be interpreted and converted to semantic AST nodes.

* [spirv] Respect [[vk::location(X)]] in SPIR-V CodeGen

SPIR-V CodeGen is modified to respect [[vk::location(X)]]
annotations, which takes precedence over implicit semantic
string ordering.

Added several tests for the annotation.
2017-08-15 16:54:23 -07:00
Tex Riddell bbe8831fe1 fix dot-cfg so it doesn't act like dot-cfg-only (#556) 2017-08-15 12:13:24 -07:00
Lei Zhang d4f8ffaab6 [spirv] Optimize IfStmt codegen for const-eval'able conditions (#567) 2017-08-15 00:37:31 -07:00
Lei Zhang c99605827c [spirv] Add support for constant array type (#565)
* Supported constant array types
* Supported operator[] on arrays
* Supported initializer list containing arrays
2017-08-15 00:36:44 -07:00
Lei Zhang 634b459283 [spirv] Assign locations to stage I/O variables alphabetically (#564)
SV_Target[N] is treated differently; they will always be assigned
the location N. For other semantics that does not map to builtin
variables, assign locations to them alphabetically.

Also extended FileTest fixture to support checking the contents
of error messages.
2017-08-15 00:36:02 -07:00
Lei Zhang a727fc8838 [spirv] Support PS SV_Depth{Greater|Less}Equal and SV_IsFrontFace (#563) 2017-08-14 13:43:05 -07:00
Ehsan 8b2d5a0d0f [spirv] Process the clamp intrinsic function (#562)
Uses SPIR-V Extended Instructions for GLSL.
2017-08-14 11:04:51 -07:00
Ehsan c40a24cbd9 [spirv] Better handling of unreachable statements. (#561) 2017-08-14 11:04:27 -07:00
Ehsan 4aae84deef [spirv] Translation of more intrinsic HLSL functions (#560)
* cross
* min
* max
* pow
* reflect
* step
2017-08-14 11:03:30 -07:00
Lei Zhang 5423d05daf [spirv] Support input modifiers on function parameters (#559)
We need to write out the values for parameters having out/inout
modifiers.
2017-08-14 09:33:13 -07:00