summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/hlsl-global-const-with-init-still-errors.slang
blob: 71471a6b342cd2578787c42ad84ff351cf6b5928 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//TEST:SIMPLE(filecheck=CHK): -target hlsl -entry main

// Test to ensure HLSL mode still produces the diagnostic for global const with initializers
// This verifies our fix doesn't break existing HLSL behavior

// This should trigger error 31224 in HLSL mode
//CHK: ([[# @LINE + 1]]): error 31224: global const variable with initializer must be declared static: 'globalConstWithInit'
const float globalConstWithInit = 1.0f;

// This should also trigger error 31224 in HLSL mode  
//CHK: ([[# @LINE + 1]]): error 31224: global const variable with initializer must be declared static: 'uniformWithInit'
uniform float uniformWithInit = 2.0f;

[shader("vertex")]
float4 main() : SV_Position
{
    return float4(1, 0, 0, 1);
}