This makes struct returns from functions work, but breaks
structs containing arrays, due to limitations in subsequent
transforms in spirv-opt. This is expected to be fixed soon.
This continues to prevent writing output buffers (out from a function),
but fixes the problem where the copy-in/out was not getting done.
Making everything work will require knowing both in/out-ness and bufferness,
but these are currently mutually exclusive, because both are storage
qualifiers.
Issue #791 was partially fixed by PR #1161 (the mat mul implicit
truncations were its main point), but it still wouldn't compile due to
the use of ConstantBuffer as an identifier. Apparently those fall into
the same class as "float float", where float is both a type and an
identifier.
This allows struct definitions with such keyword-identifiers,
and adds ConstantBuffer to the set. 'cbuffer int' is legal in HLSL,
and 'struct int' appears to only be rejected due to the redefinition
of the 'int' type.
Fixes#791
HLSL truncates the vector, or one of the two matrix dimensions if there is a
dimensional mismatch in m*v, v*m, or m*m.
This PR adds that ability. Conversion constructors are added as required.
If a shader includes a mixture of several stages, such as HS and GS,
the non-stage output geometry should be ignored, lest it conflict
with the stage output.
Per feedback on PR #1111, this reverses the order of the parameters for the setShiftBinding API.
It is now:
void TShader::setShiftBindingForSet(TResourceType res, unsigned int base, unsigned int set);
This script will crank a supplied set of glslang test shaders through the
spirv-val tool, reporting on the results.
There are some important things to note:
* Like 'runtests', this must be invoked from the 'Test' subdirectory.
* This is mostly useful on the hlsl.* tests, although it is not strictly
limited to those. The reason is that most of the glsl tests either contain
validation error cases, and so fail to compile, or are not using a #version
compatible with producing SPIR-V modules.
* Some tests, such as negative tests, or most of the glsl tests, have
intentional compilation errors. This script treats that as OK. Failures
are successfully compiling shaders which proceed to fail spirv-val.
* spirv-val is looked for in either the External directory, or if not
found there, in a sibling directory of glslang, and if not found there
either, in /usr/local/bin.
* There are a bunch of command line options. ./validate-shaders.sh --help
will describe them.
Some examples to try:
./validate-shaders.sh hlsl.* # exercise all hlsl.* tests.
./validate-shaders.sh --terse hlsl.* # same, but tersely.
# dump validator results for problems in something.frag:
./validate-shaders.sh --quiet --dump-val something.frag
Both debug and release clang builds have segfaulted on recent
changes, non deterministically, while doing the single/multi-thread
test all test files. Removing recent test files, to see if it gives
a clue.
This PR adds the ability to provide per-descriptor-set IO mapping shift
values. If a particular binding does not land into a per-set value,
then it falls back to the prior behavior (global shifts per resource class).
Because there were already 6 copies of many different methods and internal
variables and functions, and this PR would have added 6 more, a new API is
introduced to cut down on replication and present a cleaner interface.
For the global (non-set-specific) API, the old entry points still exist
for backward compatibility, but are phrased internally in terms of the
following.
// Resource type for IO resolver
enum TResourceType {
EResSampler,
EResTexture,
EResImage,
EResUbo,
EResSsbo,
EResUav,
EResCount
};
Methods on TShader:
void setShiftBinding(TResourceType res, unsigned int base);
void setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int base);
The first method replaces the 6 prior entry points of various spellings, which
exist now in depreciated form. The second provides per-resource-set functionality.
Both accept an enum from the list above.
From the command line, the existing options can accept either a single shift value as
before, or a series of 1 or more [set offset] pairs. Both can be provided, as in:
... --stb 20 --stb 2 25 3 30 ...
which will use the offset 20 for anything except descriptor set 2 (which uses 25) and
3 (which uses 30).