The cmake build recently got ENABLE_SPIRV which is enabled by default.
This was missing from the GN build, accidentally removing SPIR-V support
in this build.
This change adds GLSLANG_EXPORT in a couple more places, as well as
adding a new symbol visibility annotation GLSLANG_EXPORT_FOR_TESTS which
is defined the same as GLSLANG_EXPORT but documents the intention that
the symbols marked with it are only meant to be used by glslang's test
suite and do not form part of the public API and are thus not subject to
ABI stability guarantees.
After commit d7d5ab8, projects based on
gn builds failed when running command:
gn gen out/<BUILDDIR> --check
```
ERROR at //third_party/glslang/src/glslang/Public/ResourceLimits.h:41:11: Include not allowed.
^----------------------
It is not in any dependency of
//third_party/glslang/src:glslang_default_resource_limits_sources
```
Add the visibility.h to the build target
glslang_default_resource_limits_sources
to fix the error.
This updates the test to use the new public GetGlslIoMapper() and
TProgram::getGlslIoResolver() entry points, instead of depending on
internal points that are not available in shared library builds.
The TProgram::mapIO method takes a TIoMapResolver and a TIoMapper,
however the only way to obtain instances of these was from methods in
iomapper.h. Rather than try to expose that header as part of the API,
new methods are added to the public ShaderLang.h header to create a
TDefaultGlslIoResolver and a TGlslIoMapper and return them as pointers
to their respective base classes, which are defined in the public
header.
Windows requires symbols to be explicitly exported from DLLs, this
change simply marks the entire spirvbin_t class as exported.
The macros from visibility.h are included inline to get around include
path issues.
This patch tries to attach debug location of a branch/return instruction to its predecessor or the closing brace. If none could be found, no debug info should be emitted.
Symbols in the SPIRV/ directory that are meant to be part of the public
API of glslangnow have GLSLANG_EXPORT annotations that make sure they
will be accessible when building glslang as a shared library if
-fvisibility=hidden is enabled.
Don't report the following error when scanning inactive code (e.g. code inside #if 0):
"error: '#' : (#) can be preceded in its line only by spaces or horizontal tab"
Adds a variable to PpContext to say whether we're currently skipping over an inactive #if/#ifdef/#elif/#else, and don't report the error inside scanToken if true.
fixes 3704
Some downstream projects may only link to e.g. the glslang::SPIRV
library and rely on transitive dependencies to pull in everything else.
To keep this working, the SPIRV and MachineIndependent library stubs are
now linked against the glslang library.
Apply memory decorations from GLSL source to the top-level OpVariable.
Previously, these decorations would only be applied to individual
members. While this is correct behavior, it is more convenient for some
front ends to see the decorations (specifically ReadOnly and WriteOnly)
applied to the whole variable rather than individual members.
The GLSLANG_EXPORT macro is already used (and defined) in two separate
places and will be used in a few more in the near future. To reduce
duplication it is now in its own header.
The inVarMaps, outVarMaps, uniformVarMap, and intermediates arrays were
being memset with a size 1 bigger than their actual size. They are now
initialized correctly, which also allows making inVarMaps, outVarMaps,
and uniformVarMap into private members.
Remove the dependency on LiveTraverser.h, which transitively includes
localintermediate.h. As a result, some things have been moved from
iomapper.h to iomapper.cpp, specifically the TVarEntry type and the
constructor and destructor of TGlslIoMapper.
Without the change `glslang` build fails on upcoming `gcc-15` as:
In file included from /build/source/SPIRV/GlslangToSpv.cpp:45:
SPIRV/SpvBuilder.h:248:30: error: 'uint32_t' has not been declared
248 | Id makeDebugLexicalBlock(uint32_t line);
| ^~~~~~~~
Add a Test/baseResults/validation_fails.txt file to track test results
with known validation fails. This will hopefully make it easier to spot
when new test results are added that have invalid SPIR-V.
Earlier the comment looked misleading that composites of 8/16-bit types can't be constructed at all.
As per the GL_EXT_shader_16bit_storage extension, they can't be constructed directly, however, can be constructed indirectly.
This option increases the max_id_bound in the optimizer to 0x3FFFFFFF, and then runs a
compact-id pass if the final result has a max_id greater than the standard limit of 0x3FFFFF.