Commit graph

2471 commits

Author SHA1 Message Date
Kai Angulo
4007f85d8d fix: add semantic comparison when comparing symbols 2024-10-28 22:17:31 -07:00
Kai Angulo
ee04ba0786 feat: add option to map unused uniforms 2024-10-28 00:05:51 -07:00
Kai Angulo
5aa896ae05 feat: add missing c++ API functions to C API
add glslang_shader_add_source_text()
add glslang_shader_set_source_file()
add GLSLANG_SHADER_HLSL_IO_MAPPING
add GLSLANG_SHADER_HLSL_FLATTEN_UNIFORM_ARRAYS
2024-10-27 23:57:59 -07:00
Kai Angulo
8838252618 refactor: move invert Y from glslang_input_t to shader_set_options 2024-10-27 23:41:51 -07:00
Kai Angulo
da82563c92 feat: add hlsl_functionality_1 to c interface options 2024-10-25 02:18:04 -07:00
Kai Angulo
e9f840ca11 fix bad invert Y option 2024-10-24 21:36:41 -07:00
Kai Angulo
aa0a58d186 Revert revert 2024-10-24 01:51:59 -07:00
Kai Angulo
0db4d1e2aa fix: remove duplicate function defines in glslang_c_interface 2024-10-24 01:51:30 -07:00
Kai Angulo
5044ec9c2f Revert "Convert keyword maps to static initializers"
This reverts commit dc1012140e
2024-10-23 23:56:39 -07:00
Kai Angulo
413a51ee6d build: update glslang to latest version 2024-10-23 23:26:46 -07:00
Kai Angulo
0ecaf43ec6 fix: switch bool to int in glslang C interface 2024-10-22 23:39:48 -07:00
Sven van Haastregt
e61d7bb300 Fix Wformat warnings for printf %p
The `%p` specifier expects a void pointer argument, so explicitly cast
to `void *`.

No functional changes.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-10-11 08:35:25 -04:00
Daniel Story
05559a2963 Implement optional link-time cross stage optimization 2024-10-08 15:02:14 -04:00
Arcady Goldmints-Orlov
48f63fe4b3 Propagate errors from symbol table init
Fixes #580
2024-10-04 14:01:46 -04:00
Sven van Haastregt
4e91335863 Remove extra semicolons
Fix various "extra ';'" compiler warnings.

No functional changes.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-10-04 11:57:17 -04:00
Malcolm Bechard
4a9f088915 a few more tweaks for #3681
expose TIoMapper::setAutoPushConstantBlock()
add overload for MapToSpirvToolsEnv() that takes TIntermediate instead of SpvVersion.
2024-09-25 11:17:35 -04:00
Arcady Goldmints-Orlov
ec7e23f458 Final round of symbol visibility fixes
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.
2024-09-19 17:26:52 -04:00
Andrei Alexeyev
9213cbd310 Expose setResourceSetBinding() method to the C API 2024-09-17 10:56:10 -06:00
Arcady Goldmints-Orlov
d081b4d8c6 Add an interface to get the GLSL IO mapper and resolver
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.
2024-09-13 18:32:24 -06:00
Arcady Goldmints-Orlov
8bd9083bec Revert "Add MachineIndependent/iomapper.h to the list of installed headers."
This reverts commit b618604e77.
2024-09-13 18:32:24 -06:00
Arcady Goldmints-Orlov
d7d5ab8f8a Add symbol visibility annotations to glslang-resource-limits library
Among other things, this allows using it as a DLL on Windows.
2024-09-12 14:34:55 -07:00
Jeff Bolz
708d560c23 Allow compute derivative modes when the workgroup dimensions are spec constants 2024-09-12 11:14:23 -07:00
Arcady Goldmints-Orlov
dc1012140e Convert keyword maps to static initializers
Rather than having a function that needs to be called from ShInitialize
to initialize some global costants, convert them to use static
initializers.
2024-09-11 14:29:10 -07:00
Qingyuan Zheng
a496a34b43 Sanitize debug source location tracking for implicit branch and return
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.
2024-09-02 14:20:19 -04:00
U-NVIDIA.COM\rjennings
9cd7ca26a2 PP: Don't report certain error about '#' when #if'd out
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
2024-09-02 13:35:09 -04:00
Arcady Goldmints-Orlov
b45d21b287 cmake: Fix dependencies of newly-stubbed libraries
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.
2024-08-29 11:27:44 -04:00
Arcady Goldmints-Orlov
ffd454c57b Add visibility.h to build scripts 2024-08-22 17:43:41 -04:00
Arcady Goldmints-Orlov
9e8dff7d42 Move definition of GLSLANG_EXPORT to visibility.h
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.
2024-08-22 17:43:41 -04:00
Arcady Goldmints-Orlov
592de6cf78 Clean up unused includes. 2024-08-20 09:09:44 -04:00
Daniel Story
4f01996c9d Merge ancillary libraries into main glslang library and stub originals 2024-08-15 17:32:47 -04:00
Arcady Goldmints-Orlov
3ba8cad6ed Add setSourceFile and addSourceText to TShader
These are now accessible through the C++ ShaderLang.h public API as well
as the C API.
2024-08-12 08:48:23 -06:00
dTry
7c4d91e781
Add type checks for hitObjectNV (#3689)
`VK_NV_ray_tracing_invocation_reorder` extension introduces `hitObjectNV`, a special opaque type
that can only be declared without storage qualifiers in either global or function scope.
Added checks/tests to enforce this constraint.

References:
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_NV_ray_tracing_invocation_reorder.html
3e0d9a3b3f/extensions/nv/GLSL_NV_shader_invocation_reorder.txt (L180)

Co-authored-by: Tianyun <tianyuny@nvidia.com>
2024-08-08 08:21:00 -06:00
Arcady Goldmints-Orlov
5398d55e33 Remove execute permissions from source files. 2024-08-06 14:42:01 -06:00
Arcady Goldmints-Orlov
015cb4ce5c Fix initialization of arrays in TGlslIoMapper
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.
2024-08-06 13:36:21 -06:00
Arcady Goldmints-Orlov
b618604e77 Add MachineIndependent/iomapper.h to the list of installed headers. 2024-08-06 13:36:21 -06:00
Arcady Goldmints-Orlov
31584ef79d Clean up iomapper.h to make it suitable as a public API
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.
2024-08-06 13:36:21 -06:00
ravi688
48154f1766 Update comment to more succint that 8/16-bit composites can't be directly constructed
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.
2024-08-02 14:33:45 -06:00
Malcolm Bechard
8590f62c14 add optimizerAllowExpandedIDBound to SpvOptions
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.
2024-07-30 21:49:42 -04:00
Malcolm Bechard
69249e46b6 add cross-stage check for missing outputs
If an 'in' is present in a shader stage, make sure a matching 'out'
is present in the previous stage. Only enabled when doing Vulkan.

This commit also fixes a bug where previous stage's linkerObjects
got polluted with 'in' variables from the next stage when merging
linker objects.
2024-07-29 19:37:59 -04:00
Steve Urquhart
3c7b12c643 Add C interface types and functions for IO mapping 2024-07-24 18:46:04 -04:00
Steve Urquhart
10a923f740 Add C interface function to set preprocessed shader code 2024-07-24 18:46:04 -04:00
Steve Urquhart
42260d1f6d Add C interface glslang::Version counterpart and version getter function 2024-07-24 18:46:04 -04:00
Yamamoto Kazunari
ebbd65501d Fix missing calls to SetThreadPoolAllocator() in TProgram public interface functions 2024-07-24 18:30:51 -04:00
Andrei Alexeyev
bedbe7481e Expose setGlobalUniform* methods to the C API 2024-07-23 18:26:25 -04:00
Arcady Goldmints-Orlov
74d448cc15 Add some comments and rename a helper function
This adds some documentation of the checkTypes() function to make
clearer what exactly it is checking.
2024-07-22 17:42:46 -04:00
Antoine
dc9f6f61ad
Add column to location logs
This option can be enabled using the new --error-column option to the command line utility.
It can also be enabled programatically.
2024-07-19 18:37:58 -04:00
jimihem
52f68dc6b2
Add more location aliasing checks
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.
2024-07-17 18:23:38 -04:00
arcady-lunarg
48eaea60b8
Fix undefined behaviors caught by ubsan
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.
2024-07-15 19:10:42 -04:00
jimihem
702026e3f5
Support constant expression calculated by matrixCompMult. 2024-07-15 14:24:16 -04:00
Malcolm Bechard
ba5c010c59 fix crash when atomicCounter() with no args is used. 2024-07-12 11:30:49 -04:00