yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
b16d4e955
master
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage hull -entry hullMain -warnings-disable 39001 2 3// Test for issue #7000: scalar tessellation factors should convert to arrays properly 4 5struct VSOutput 6{ 7 float4 Pos : SV_POSITION; 8 float3 Normal; 9 float2 UV; 10}; 11 12struct HSOutput 13{ 14 float4 Pos : SV_POSITION; 15 float3 Normal; 16 float2 UV; 17}; 18 19struct ConstantsHSOutput 20{ 21 float TessLevelOuter[3] : SV_TessFactor; 22 float TessLevelInner : SV_InsideTessFactor; // Scalar (should convert to float[2] for GLSL) 23}; 24 25ConstantsHSOutput ConstantsHS() 26{ 27 ConstantsHSOutput output; 28 output.TessLevelInner = 4.0; 29 output.TessLevelOuter[0] = 4.0; 30 output.TessLevelOuter[1] = 4.0; 31 output.TessLevelOuter[2] = 4.0; 32 return output; 33} 34 35[shader("hull")] 36[domain("tri")] 37[partitioning("integer")] 38[outputtopology("triangle_cw")] 39[outputcontrolpoints(3)] 40[patchconstantfunc("ConstantsHS")] 41HSOutput hullMain(InputPatch<VSOutput, 3> patch, uint InvocationID: SV_OutputControlPointID) 42{ 43 HSOutput output; 44 output.Pos = patch[InvocationID].Pos; 45 output.Normal = patch[InvocationID].Normal; 46 output.UV = patch[InvocationID].UV; 47 return output; 48} 49 50// CHECK: OpExecutionMode 51// CHECK-DAG: OpDecorate {{.*}} BuiltIn TessLevelInner 52// CHECK-DAG: OpDecorate {{.*}} BuiltIn TessLevelOuter