yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f0b991415
master
1//TEST:SIMPLE(filecheck=METAL): -target metal -stage fragment -entry fragmentMain 2//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage fragment -entry fragmentMain 3//TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage fragment -entry fragmentMain 4//TEST:SIMPLE(filecheck=WGSLSPIRV): -target wgsl-spirv-asm -stage fragment -entry fragmentMain 5 6//METAL-DAG: color(0) 7//METAL-DAG: color(1) 8//METAL-DAG: color(2) 9//METAL-DAG: color(3) 10//METAL-DAG: color(4) 11//METAL-DAG: color(5) 12//METAL-DAG: color(6) 13//METAL-NOT: color(7) 14 15//WGSL-DAG:@location(0) [[VAR0:[A-Za-z_0-9]+]] 16//WGSL-DAG:@location(1) [[VAR1:[A-Za-z_0-9]+]] 17//WGSL-DAG:@location(2) [[VAR2:[A-Za-z_0-9]+]] 18//WGSL-DAG:@location(3) [[VAR3:[A-Za-z_0-9]+]] 19//WGSL-DAG:@location(4) [[VAR4:[A-Za-z_0-9]+]] 20//WGSL-DAG:@location(5) [[VAR5:[A-Za-z_0-9]+]] 21//WGSL-DAG:@location(6) [[VAR6:[A-Za-z_0-9]+]] 22//WGSL-NOT:@location(7) 23 24//METALLIB: @fragmentMain 25//WGSLSPIRV: %fragmentMain = OpFunction %void None 26 27RWStructuredBuffer<float> outputBuffer; 28 29struct BottomFragment1 30{ 31 float p1; 32}; 33struct BottomFragment2 34{ 35 float p1; 36}; 37 38struct MiddleFragment1 39{ 40 float p1; 41 BottomFragment1 p2; 42 BottomFragment2 p3; 43}; 44struct TopFragment 45{ 46 float p1; 47 MiddleFragment1 p2; 48 MiddleFragment1 p3; 49}; 50 51struct FragmentStageInput 52{ 53 float4 coarseVertex : CoarseVertex; 54}; 55 56struct FragmentStageOutput 57{ 58 TopFragment fragment : SV_Target; 59}; 60 61//WGSL: fn fragmentMain{{.*}}-> [[ReturnType:FragmentStageOutput[_0-9]+]] 62FragmentStageOutput fragmentMain(FragmentStageInput input) 63{ 64 FragmentStageOutput output; 65 output.fragment.p1 = 1; 66 67 output.fragment.p2.p1 = 3; 68 output.fragment.p2.p2.p1 = 4; 69 output.fragment.p2.p3.p1 = 5; 70 71 output.fragment.p3.p1 = 8; 72 output.fragment.p3.p2.p1 = 9; 73 output.fragment.p3.p3.p1 = 10; 74 75 // METAL-DAG: ={{.*}}.p1 76 77 // METAL-DAG: ={{.*}}.p2{{.*}}.p1 78 // METAL-DAG: ={{.*}}.p2{{.*}}.p2{{.*}}.p1 79 // METAL-DAG: ={{.*}}.p2{{.*}}.p3{{.*}}.p1 80 81 // METAL-DAG: ={{.*}}.p3{{.*}}.p1 82 // METAL-DAG: ={{.*}}.p3{{.*}}.p2{{.*}}.p1 83 // METAL-DAG: ={{.*}}.p3{{.*}}.p3{{.*}}.p1 84 85 // WGSL: var [[ReturnVar:[A-Za-z_0-9]+]] : [[ReturnType]] 86 // WGSL-DAG: [[ReturnVar]].[[VAR0]]{{.*}} = {{.*}}; 87 // WGSL-DAG: [[ReturnVar]].[[VAR1]]{{.*}} = {{.*}}; 88 // WGSL-DAG: [[ReturnVar]].[[VAR2]]{{.*}} = {{.*}}; 89 // WGSL-DAG: [[ReturnVar]].[[VAR3]]{{.*}} = {{.*}}; 90 // WGSL-DAG: [[ReturnVar]].[[VAR4]]{{.*}} = {{.*}}; 91 // WGSL-DAG: [[ReturnVar]].[[VAR5]]{{.*}} = {{.*}}; 92 // WGSL-DAG: [[ReturnVar]].[[VAR6]]{{.*}} = {{.*}}; 93 94 outputBuffer[0] = 1; 95 return output; 96}