yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
db44c1b73
master
1// Regressed with SPIRV update. Tracking on github issue #8522 2//DISABLE_TEST:SIMPLE(filecheck=CHECK):-target spirv-asm -entry main -stage fragment -g2 -O0 -emit-spirv-directly 3 4Texture2D testTex : register(t0); 5SamplerState testSampler : register(s0); 6 7struct PSIn 8{ 9 float4 pos : SV_Position; 10 float4 color : COLOR; 11}; 12 13float4 main(PSIn input) : SV_TARGET 14{ 15 uint4 testPos = (uint4)input.pos; 16 float bias = -1.0; 17 float2 tc = testPos.xy / 32.0; 18 float4 colVal = testTex.SampleBias(testSampler, tc, bias) + input.color; 19 return float4(colVal.xyz, 1.0); 20} 21 22// Make sure "pos" and "color" is reported as member variables 23// CHECK-DAG: %[[StrPos:[0-9]+]] = OpString "pos" 24// CHECK-DAG: %[[StrColor:[0-9]+]] = OpString "color" 25// CHECK-DAG: DebugTypeMember %[[StrPos]] 26// CHECK-DAG: DebugTypeMember %[[StrColor]] 27 28// Global variables should be reported as DebugGlobalVariable 29// CHECK-DAG: %[[COMPILATION_UNIT_ID:[0-9]+]] = OpExtInst %void {{.*}} DebugCompilationUnit 30// CHECK-DAG: DebugGlobalVariable %{{.+}} %[[COMPILATION_UNIT_ID]] %{{[0-9]+}} %testTex 31// CHECK-DAG: DebugGlobalVariable %{{.+}} %[[COMPILATION_UNIT_ID]] %{{[0-9]+}} %testSampler 32 33// Entry point parameter is reported as DebugLocalVariable 34// CHECK-DAG: %[[StrInput:[0-9]+]] = OpString "input" 35// CHECK-DAG: %[[input:[A-Za-z_0-9]+]] = {{.*}} DebugLocalVariable %[[StrInput]] 36 37// Funciton local variable should be reported as DebugLocalVariable 38// CHECK-DAG: %[[StrTestPos:[0-9]+]] = OpString "testPos" 39// CHECK-DAG: DebugLocalVariable %[[StrTestPos]] 40 41// CHECK: %main = OpFunction %void None 42 43// "input.pos" is reported with DebugValue as a first member 44// And its value comes from `gl_FragCoord` 45// CHECK-DAG: DebugValue %[[input]] %[[input_pos:[0-9]+]] %{{[0-9]+}} %int_0 46// CHECK-DAG: OpStore %[[input_pos]] %[[gl_FragCoord_input_pos:[0-9]+]] 47// CHECK-DAG: %[[gl_FragCoord_input_pos]] = OpLoad %v4float %gl_FragCoord 48 49// "input.color" is reported with DebugValue as a second member 50// And its value comes from a global varying input 51// CHECK-DAG: DebugValue %[[input]] %[[input_color:[0-9]+]] %{{[0-9]+}} %int_1 52// CHECK-DAG: OpStore %[[input_color]] %[[varying_color:[0-9]+]] 53// CHECK-DAG: %[[varying_color]] = OpLoad %v4float %input_color