HLSL allows several variables to be declared. There are packing rules involved:
e.g, a float3 and a float1 can be packed into a single array[4], while for a
float3 and another float3, the second one will skip the third array entry to
avoid straddling
This is implements that ability. Because there can be multiple variables involved,
and the final output array will often be a different type altogether (to fuse
the values into a single destination), a new variable is synthesized, unlike the prior
clip/cull support which used the declared variable. The new variable name is
taken from one of the declared ones, so the old tests are unchanged.
Several new tests are added to test various packing scenarios.
Only two semantic IDs are supported: 0, and 1, per HLSL rules. This is
encapsulated in
static const int maxClipCullRegs = 2;
and the algorithm (probably :) ) generalizes to larger values, although there
are a few issues around how HLSL would pack (e.g, would 4 scalars be packed into
a single HLSL float4 out reg? Probably, and this algorithm assumes so).
Glslang Tests based on the Google Test Framework
This directory contains Google Test based test fixture and test cases for glslang.
Apart from typical unit tests, necessary utility methods are added into
the GlslangTests fixture to provide the ability to do
file-based integration tests. Various *.FromFile.cpp files lists names
of files containing input shader code in the Test/ directory. Utility
methods will load the input shader source, compile them, and compare with
the corresponding expected output in the Test/baseResults/ directory.
How to run the tests
Please make sure you have a copy of Google Test checked out under
the External directory before building. After building, just run the
ctest command or the gtests/glslangtests binary in your build directory.
The gtests/glslangtests binary also provides an --update-mode command
line option, which, if supplied, will overwrite the golden files under
the Test/baseResults/ directory with real output from that invocation.
This serves as an easy way to update golden files.