For GLSL function imageAtomicStore, it will be translated to
OpImageTexelPointer + OpAtomicStore. The result type of
OpImageTexelPointer must be the same as the sampled type of OpTypeImage.
On translation, the result type is mistakenly fetched from operand list
operands[2] while operands[2] corresponds to sampleNum whose type is
always uint. This leads to an error if the image type is iimageXXX that is
int image.
Root cause:
GlslangToSpv use symbol structure's ptr as a map key, but multiple shader object can build a new AST.
In the AST the the same symbol has different ptr point to their structure, so indext map faild.
solution:
Add a new map glslangTypeToIdMap to map ptr to symbol id, and use symbol id to index memberRemapper.
v2: Move addCapability and addExtension extension calls from
TGlslangToSpvTraverser::createBinaryOperation to
TGlslangToSpvTraverser::visitAggregate. Suggested by JohnK.
There is a flag to disable the SPVRemapper during the GLSLang build.
That flag is check in some, but not all spots so if you try to build
with SPVRemapper disabled you get CMake errors and compile errors.
This CL fixs up the build so building with -DENABLE_SPVREMAPPER=0 will
complete correclty.
The SPIR-V post-processing to discover capabilities and
extensions does not apply to WebGPU compilation. So don't include
that code.
This reclaims some of the code space added by #1943
More aggressively prune unreachable code as follows.
When no control flow edges reach a merge block or continue target:
- delete their contents so that:
- a merge block becomes OpLabel, then OpUnreachable
- a continue target becomes OpLabel, then an OpBranch back to the
loop header
- any basic block which is dominated by such a merge block or continue
target is removed as well.
- decorations targeting the removed instructions are removed.
Enables the SPIR-V builder post-processing step the GLSLANG_WEB case.
If the semantics that require the KHR form over the EXT form are seen
(OpBitcast between a vector and a pointer) promote the requested extension
from the EXT to the KHR.
Currently the SPIRV/ folder will get installed into the include
directory. This folder is part of GLSLang, so it makes more sense under
glslang/SPIRV.
Currently, GLSLang will install a SPIRV/ folder while spirv-headers will
install a spirv/ folder. This is confusing and will cause issues on a
case sensitive filesystem if both are installed at the same time.
Saved about 21K, size down to 380K of MSVC x86 code.
Fixed one bug that needs to be looked at on the master branch:
The test for needing a Vulkan binding has a bug in it, "!layoutAttachment"
which does not mean "no layoutAttachment", because that is non-zero.
This is why some test and test results changed.