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