yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

CopilotFix GLSL global const diagnostic regression (#7808)447d73f8c

master
722 B18 linesraw
1//TEST:SIMPLE(filecheck=CHK): -target hlsl -entry main
2
3// Test to ensure HLSL mode still produces the diagnostic for global const with initializers
4// This verifies our fix doesn't break existing HLSL behavior
5
6// This should trigger error 31224 in HLSL mode
7//CHK: ([[# @LINE + 1]]): error 31224: global const variable with initializer must be declared static: 'globalConstWithInit'
8const float globalConstWithInit = 1.0f;
9
10// This should also trigger error 31224 in HLSL mode  
11//CHK: ([[# @LINE + 1]]): error 31224: global const variable with initializer must be declared static: 'uniformWithInit'
12uniform float uniformWithInit = 2.0f;
13
14[shader("vertex")]
15float4 main() : SV_Position
16{
17    return float4(1, 0, 0, 1);
18}