yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
1487a1f98
master
1//TEST:SIMPLE(filecheck=SPV): -allow-glsl -target spirv-asm -entry vertexMain -stage vertex 2 3// This test is to make sure the constant-folding works for the switch-case label. 4// The shader code is from VK-CTS but modified, 5// dEQP-VK.glsl.switch.const_expr_in_label_dynamic_fragment 6 7layout(location = 0) in highp vec4 a_position; 8layout(location = 1) in highp vec4 a_coords; 9 10layout(location = 0) out mediump vec4 v_color; 11layout (std140, set=0, binding=0) uniform buffer0 { highp int ui_two; }; 12 13void vertexMain(void) 14{ 15 gl_Position = a_position; 16 highp vec4 coords = a_coords; 17 mediump vec3 res = vec3(0.0); 18 19 const int t = 2; 20 switch (ui_two) 21 { 22 //SPV-NOT:([[# @LINE+1]]): error 23 case int(0.0): 24 res = coords.xyz; 25 break; 26 27 //SPV-NOT:([[# @LINE+1]]): error 28 case 2-1: 29 res = coords.wzy; 30 break; 31 32 //SPV-NOT:([[# @LINE+1]]): error 33 case 3&(1<<1): 34 res = coords.yzw; 35 break; 36 37 //SPV-NOT:([[# @LINE+1]]): error 38 case t+1: 39 res = coords.zyx; 40 break; 41 } 42 43 v_color = vec4(res, 1.0); 44} 45