It is invalid if the same decoration is applied to the same id multiple
times. This adds a check before adding a decoration that the decoration
is not already in the list. If it is, then the duplicate is not added.
Fixes#3627
This adds or changes binding/location decorations in 100s of shaders.
It also allows more output (spv.register.autoassign.rangetest.frag)
due to allowing ioMap() to fail.
Also, remove assumption that if something is opaque that it
must be in the UniformConstant storage class.
This allows function declarations to know all parameters will
be in the Function storage class.
Makes some white-space differences in most output, plus a few cases
where more could have been put out but was cut short by the previous
fix-sized buffer.
This needs some render testing, but is destined to be part of master.
This also leads to a variety of other simplifications.
- IO are global symbols, so only need one list of linkage nodes (deferred)
- no longer need parse-context-wide 'inEntryPoint' state, entry-point is localized
- several parts of splitting/flattening are now localized
Rationalizes the entire tracking of the linker object nodes, effecting
GLSL, HLSL, and SPIR-V, to allow tracked objects to be fully edited before
their type snapshot for linker objects.
Should only effect things when the rest of the AST contained no reference to
the symbol, because normal AST nodes were not stale. Also will only effect such
objects when their types were edited.
Fix for two defects as follows:
- The IO mapping traverser was not setting inVisit, and would skip some AST nodes.
Depending on the order of nodes, this could have prevented the binding from
showing up in the generated SPIR-V.
- If a uniform array was flattened, each of the flattened scalars from the array
is still a (now-scalar) uniform. It was being converted to a temporary.
This checkin adds a --flatten-uniform-arrays option which can break
uniform arrays of samplers, textures, or UBOs up into individual
scalars named (e.g) myarray[0], myarray[1], etc. These appear as
individual linkage objects.
Code notes:
- shouldFlatten internally calls shouldFlattenIO, and shouldFlattenUniform,
but is the only flattening query directly called.
- flattenVariable will handle structs or arrays (but not yet arrayed structs;
this is tested an an error is generated).
- There's some error checking around unhandled situations. E.g, flattening
uniform arrays with initializer lists is not implemented.
- This piggybacks on as much of the existing mechanism for struct flattening
as it can. E.g, it uses the same flattenMap, and the same
flattenAccess() method.
- handleAssign() has been generalized to cope with either structs or arrays.
- Extended test infrastructure to test flattening ability.