Fix GLSL global const diagnostic regression#7808
Merged
Conversation
|
|
…GLSL module Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix regression of global
Fix GLSL global const diagnostic regression
Jul 17, 2025
const diagnostic regression in GLSL mode.
jkwak-work
approved these changes
Jul 17, 2025
Collaborator
jkwak-work
left a comment
There was a problem hiding this comment.
Wow. This looks good to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a regression introduced by PR #7711 where the diagnostic for global
constvariables with initializers was incorrectly triggering in GLSL mode.Problem
In GLSL mode, global non-
staticconstvariables represent real constants, not uniform parameters. However, the diagnostic added in PR #7711 was treating them the same as HLSL, causing false positive errors when compiling valid GLSL code:Solution
Added a condition to exclude GLSL modules from the diagnostic check in
slang-check-decl.cpp:Testing
Added comprehensive test coverage:
tests/diagnostics/glsl-global-const-with-init.slang- Verifies GLSL mode allows global const with initializerstests/diagnostics/hlsl-global-const-with-init-still-errors.slang- Ensures HLSL mode still produces the diagnosticAll existing diagnostic tests continue to pass (223/223), confirming no regressions.
Fixes #7807.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.