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.
* [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)
* [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
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.
[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.
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.
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.
* 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.
* [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.
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.
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.
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.
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.
* [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.
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.