Nonsemantic instructions aren't allowed before an OpPhi, so don't emit
line and debug scope instructions when the instruction being emitted is
an OpPhi.
When location aliasing, the aliases sharing the location must have the same underlying numerical type and bit width (floating-point or integer, 32-bit versus 64-bit, etc.) and the same auxiliary storage and interpolation qualification.
This adds checks for the "patch" and "sample" qualifiers, and also relaxes the checks when the signedness of integer types differs.
This fixes a couple of integer overflows in parsing as well as removes
the construction of a null reference that never got dereferenced.
This also initializes the bool members in TCall
Finally, this adds a UBSAN run alongside ASAN and TSAN in CI.
In C++, enums can only represent "in range" values. If the backing
type is not specified, then the result of using bitwise negation on
an enum is not gaurenteed to be in range, resulting in UB.
This was caught by UBSAN, stack trace is as follows:
0. 0x000000000426e391 in spv::operator& (a=spv::MemoryAccessMaskNone,
b=(spv::MemoryAccessVolatileMask | spv::MemoryAccessAlignedMask | spv::MemoryAccessNontemporalMask | spv::MemoryAccessMakePointerVisibleMask | spv::MemoryAccessNonPrivatePointerMask | spv::MemoryAccessAliasScopeINTELMaskMask | spv::MemoryAccessNoAliasINTELMaskMask | unknown: 0xfffcffc0)) at SPIRV/spirv.hpp:2804
1. 0x00000000041e81e0 in (anonymous namespace)::TGlslangToSpvTraverser::accessChainLoad (this=0x7fffffffcbb8, type=...) at SPIRV/GlslangToSpv.cpp:5127
2. 0x00000000041bc059 in (anonymous namespace)::TGlslangToSpvTraverser::visitBinary (this=0x7fffffffcbb8, node=0x5f6a6c8) at SPIRV/GlslangToSpv.cpp:2192
3. 0x0000000003db8660 in glslang::TIntermBinary::traverse (this=0x5f6a6c8, it=0x7fffffffcbb8) at glslang/glslang/MachineIndependent/IntermTraverse.cpp:92
4. 0x0000000003db952e in glslang::TIntermAggregate::traverse (this=0x5f6a7d8, it=0x7fffffffcbb8) at glslang/glslang/MachineIndependent/IntermTraverse.cpp:175
5. 0x00000000042082db in (anonymous namespace)::TGlslangToSpvTraverser::makeGlobalInitializers (this=0x7fffffffcbb8, initializers=...) at SPIRV/GlslangToSpv.cpp:5618
6. 0x00000000041c511f in (anonymous namespace)::TGlslangToSpvTraverser::visitAggregate (this=0x7fffffffcbb8, visit=glslang::EvPreVisit, node=0x5f6a9b8) at SPIRV/GlslangToSpv.cpp:2907
7. 0x0000000003db8fb9 in glslang::TIntermAggregate::traverse (this=0x5f6a9b8, it=0x7fffffffcbb8) at glslang/glslang/MachineIndependent/IntermTraverse.cpp:159
8. 0x00000000041acc04 in glslang::GlslangToSpv (intermediate=..., spirv=..., logger=0x7fffffffdc38, options=0x7fffffffdc2f) at SPIRV/GlslangToSpv.cpp:10398
9. 0x0000000003bfd6f1 in CompileAndLinkShaderUnits (compUnits=...) at StandAlone/StandAlone.cpp:1547
10. 0x0000000003bfe2f8 in CompileAndLinkShaderFiles (Worklist=...) at StandAlone/StandAlone.cpp:1640
11. 0x0000000003bfec2c in singleMain () at StandAlone/StandAlone.cpp:1713
12. 0x0000000003bff4dd in main (argc=5, argv=0x7fffffffe3d8) at StandAlone/StandAlone.cpp:1767
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
A type can't have a negative number of constituents, components, rows,
or columns. Therefore, the utility functions to query said information
on types and values should return unsigned int rather than int.
These redundant type conversions were generating illegal SPIR-V when
only the 8-bit/16-bit storage extensions and not the corresponding
arithmetic extensions were enabled.
[BugFix] Do not generate any conversion for 8-bit and 16-bit types if it is an identity conversion.
Earlier (before this fix), it generated incorrect SPIR-V convert instructions, as SPIR-V
requires that the types being converted differ.
This makes things consistent between when glslang is installed and imported versus when it's included as nested CMake project.
You can now use `glslang::glslang` in both cases instead of needing the non-namespaced version sometimes and the namespaced one other times.
Resolves one of the problems discussed in https://github.com/KhronosGroup/glslang/issues/3509