This is the support for non-floating-point matrices,
which are emulated using arrays of vectors because
SPIR-V does not allow non-floating-point matrices.
* Initial support for non-fp matrix
* Add support for non-fp matrix in all()
* Conversion of float matrix to int matrix
* support for modf returning an int matrix
* Add tests for non-fp matrix access
* Mixed arithmetic for non-fp matrices
* Support non-fp matrix in flat conversion
* Non-fp matrix in asint/asuint/asfloat
* Mul of non-fp Matrix with Vector/Scalar
* Add tests for non-fp matrix cast
TODO: Layout decoration of non-fp matrices
TODO: Majorness of non-fp matrices
According to HLSL doc, "variables that are placed in the global scope
are added implicitly to the $Global cbuffer, using the same packing
method that is used for cbuffers."
But we emit all global variables as stand-alone SPIR-V variables.
This causes issues for matrix variables since we cannot annotate
them with majorness decoration anymore.
Wrap global matrix variables in a struct to solve the problem.
This commit add support for generating OpSpecConstant* instructions
with SpecId decorations. Spec constants are only allowed to be of
scalar boolean/integer/float types. Using spec constant as the array
size does not work at the moment.
This only supports .GetSamplePosition() for standard sample
positions, i.e., sample count is 1, 2, 4, 8, or 16. For other
cases, the method will just return float2(0, 0).
Added a new command line option -fvk-ignore-unused-resources
to avoid emitting SPIR-V code for resources defined but not statically
referenced by the call tree of the entry point in question.
[[vk::builtin("...")]] is introduced to support Vulkan-specific
builtins.
There are two supported in this commit:
* gl_PointSize
* gl_HelperInvocation
Validating the usages of these two builtins is left for anther
commit.
[[vk::push_constant]] can be attached to a global variable of
struct type to put that variable in the PushConstant storage
class.
PushConstant should be of OpTypeStruct type with std430 layout.
* Translation of GroupMemoryBarrier(WithGroupSync)
* Translation of DeviceMemoryBarrier(WithGroupSync)
* Translation of AllMemoryBarrier(WithGroupSync)
This commit supports .Append() and .RestartStrip() method calls
on stream-output objects, which will be translated into SPIR-V
OpEmitVertex and OpEndPrimitive, respectively.
For each .Append() call, all affected stage output variables
will be flushed.
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.