You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add diagnostic for const/uniform global variables with initializers
Global const and uniform variables without the static modifier are
treated as uniform parameters in HLSL, which cannot have default values.
This change adds error 31224 to catch this case early and provide clear
guidance to users.
Fixesshader-slang#7701
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Yong He <[email protected]>
* Add test case for global const/uniform variable diagnostic
Add test for diagnostic 31224 which catches global const and uniform
variables with initializers that aren't declared static. The test
verifies both error cases and valid cases to ensure the diagnostic
works correctly.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Yong He <[email protected]>
* Fix failing tests due to new global const diagnostic
Add 'static' keyword to global const variables with initializers
to resolve diagnostic 31224: "global const variable with initializer
must be declared static"
Co-authored-by: Jay Kwak <[email protected]>
* Allow specialization constants with initializers without static
- Modified diagnostic logic in slang-check-decl.cpp to allow specialization
constants (SpecializationConstantAttribute and VkConstantIdAttribute) to
have initializers without requiring the static keyword
- Updated 8 SPIRV test files to remove unnecessary static keywords from
specialization constant declarations
- Enhanced diagnostic test case to include specialization constant examples
- All tests passing with the new behavior
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Yong He <[email protected]>
* format code (shader-slang#7765)
Co-authored-by: slangbot <[email protected]>
* Remove static keyword from specialization constants and add comprehensive test cases
- Remove static from specialization constants in test files as they are semantically meaningless
- Update tests to use existing diagnostic 31219 for static specialization constant errors
- Add comprehensive test cases that verify the error occurs when static is used with specialization constants
- Fixes suggested in PR review to make static specialization constants an error
Co-authored-by: ArielG-NV <[email protected]>
* Add error for static specialization constants
Static specialization constants are semantically meaningless and should
produce an error. This change adds logic to trigger diagnostic 31219
when both 'static' and specialization constant attributes are present.
The existing diagnostic 31219 'push or specialization constants cannot
be static' is now correctly triggered for:
- [SpecializationConstant] static const variables
- [vk::constant_id] static const variables
Co-authored-by: ArielG-NV <[email protected]>
* Update source/slang/slang-check-decl.cpp
* Update tests/glsl/compute-shader-layout-id.slang
* Update tests/glsl/compute-shader-layout-id.slang
* Fix test case Claude broke
* Update global-uniform.slang
* Update global-uniform.slang.expected
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yong He <[email protected]>
Co-authored-by: ArielG-NV <[email protected]>
Co-authored-by: Jay Kwak <[email protected]>
Co-authored-by: slangbot <[email protected]>
Co-authored-by: slangbot <[email protected]>
Co-authored-by: ArielG-NV <[email protected]>
0 commit comments