yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
6f2ce72b0
master
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -fvk-use-entrypoint-name -emit-spirv-directly 2 3// CHECK-DAG: OpEntryPoint Vertex 4// CHECK-DAG: OpEntryPoint Fragment 5 6// We require 1 `Flat` for the fragment input `uint` 7// CHECK-DAG: OpDecorate %{{[1-9][0-9]*}} Flat 8 9// CHECK-DAG: OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex 10 11// The vertex shader should be using the builtin InstanceIndex var. 12// CHECK: %vmain = OpFunction 13// CHECK: InstanceIndex 14// CHECK: OpFunctionEnd 15 16// The fragment shader should not be using the builtin InstanceIndex var. 17// CHECK: %pmain = OpFunction 18// CHECK-NOT: InstanceIndex 19// CHECK: OpFunctionEnd 20 21struct VIn 22{ 23 uint instanceID : SV_InstanceID; 24} 25 26struct VSOutput 27{ 28 uint instanceID : SV_InstanceID; 29 float4 color : COLOR; 30}; 31 32[shader("vertex")] 33VSOutput vmain(VIn vin) { 34 VSOutput t; 35 t.instanceID = vin.instanceID; 36 t.color = float4(0, 0, 0, 0); 37 return t; 38} 39 40[shader("pixel")] 41float4 pmain(VSOutput input) : SV_TARGET 42{ 43 return float4(float(input.instanceID), input.color.xyz); 44}