As per the Vulkan spec requirement:
Any variable decorated with Position must be declared as a
four-component vector of 32-bit floating-point values.
But for HS/DS/GS, we actually have an extra arrayness. If we
generate a stand-alone Postion builtin variable, it will be
an array of float4, which does not comply with the spec.
Similary for the type requirements on ClipDistance and
CullDistance.
The spec could have an problem on this issue, but the GLSL way
is to emit a gl_PerVertex that contains Position, ClipDistance,
and CullDistance. That satisfies the current Vulkan spec.
This commit converts VS output, HS/DS input and output, GS
input to emit the gl_PerVertex struct. It also splits arrays
of structs into arrays of the fields for HS/DS/GS input/output.
ClipDistance/CullDistance is also supported in this commit,
which requires quite some non-trivial handling.
A new attribute [[vk::counter_binding(X)]] can be used to specify
the binding number for associated counters for RW/append/consume
structured buffers.
Also added support for .IncrementCounter() and .DecrementCounter()
for RWStructuredBuffer.
Also fixed the type error of OpAtomicI{Add|Sub}.
Added the following four command line options to shift register
number for Vulkan:
* -fvk-b-shift
* -fvk-t-shift
* -fvk-s-shift
* -fvk-u-shift
These options are used to avoid assigning the same binding
number to more than one resources.
* [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)
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.
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.
Previously for an entry function, we decompose its parameters and
return value and create stage input/output/builtin variables from
them directly. This is fine for simple shaders, but it will have
problems for shaders using structs to group stage variables.
Accessing paramters and return values (using operator. and return)
needs special handling for entry functions, which is nasty.
With the wrapper function, we can handle entry functions just like
normal functions. Stage variable handling are all done in the
wrapper funtion.
Also added the translation for `loop` and `unroll` attributes.
Similar to for loops, the current implementation does not support
early exits, or early returns.
* [spirv] Translate vector truncation and splatting
* Also added tests for vector<|type|, |count|> format.
* [spirv] Remove duplicated vector splatting tests
Although they appear as binary operator tests, they are essentially
testing vector splatting, which we already have dedicated tests.
The translation supports dot product of vectors of floats using
SPIR-V's OpDot.
The translation also supports dot product of vectros of integers
using multiplication and addition.
* [spirv] Translate vector types and handle variable initializers
* Translated vector types and operations on vector types
* +, -, *, /, % on vector <op> vector and vector <op> scalar
* Prefix increment on vectors
* < on vector <op> vector and vector <op> scalar
* Covered both constant initializer and variable initializer
* Applied constant modifier to variables
* [spirv] Translate all comparision operators
* Covers <, <=, >, >=, ==, !=
* For both scalars and vectors
* Also update docs about arithmetic and comparison operators