yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
447d73f8c
master
1//TEST:SIMPLE(filecheck=CHK): -target glsl -stage fragment -entry main -allow-glsl 2 3// Test for GLSL mode: global const variables with initializers should be allowed 4// In GLSL mode, global const variables are real constants, not uniform parameters 5// This should NOT produce the error 31224 that would trigger in HLSL mode 6 7#version 450 8 9// These should NOT trigger error 31224 in GLSL mode (they would in HLSL) 10const float globalConstWithInit = 1.0; // OK in GLSL - real constant 11const vec3 globalVecConst = vec3(1.0, 2.0, 3.0); // OK in GLSL - real constant 12const int globalIntConst = 42; // OK in GLSL - real constant 13 14// Regular uniforms without const should still be allowed 15uniform float uniformFloat; // OK - uniform without const 16uniform vec4 uniformVec; // OK - uniform without const 17 18// CHK-NOT: error 31224 19// CHK: void main() 20 21out vec4 fragColor; 22 23void main() 24{ 25 fragColor = vec4(globalConstWithInit, globalVecConst.x, globalIntConst, 1.0); 26}