diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/gh-3087-multi-entry-point.slang | 38 | ||||
| -rw-r--r-- | tests/bugs/gh-3087.slang | 28 |
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/bugs/gh-3087-multi-entry-point.slang b/tests/bugs/gh-3087-multi-entry-point.slang new file mode 100644 index 000000000..1bbbb9995 --- /dev/null +++ b/tests/bugs/gh-3087-multi-entry-point.slang @@ -0,0 +1,38 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -fvk-use-entrypoint-name -emit-spirv-directly + +// CHECK-DAG: OpEntryPoint Vertex +// CHECK-DAG: OpEntryPoint Fragment + +// we should only have 1 'BuiltIn InstanceIndex' since the `Output` and `Input` semantic +// for `InstanceIndex` should be converted to a non-builtin +// CHECK-DAG: BuiltIn InstanceIndex +// CHECK-NOT: BuiltIn InstanceIndex + +// We require 1 `Flat` for the fragment input `uint` +// SPIRV: Flat +// SPIRV-NOT: Flat + +struct VIn +{ + uint instanceID : SV_InstanceID; +} + +struct VSOutput +{ + uint instanceID : SV_InstanceID; + float4 color : COLOR; +}; + +[shader("vertex")] +VSOutput vmain(VIn vin) { + VSOutput t; + t.instanceID = vin.instanceID; + t.color = float4(0, 0, 0, 0); + return t; +} + +[shader("pixel")] +float4 pmain(VSOutput input) : SV_TARGET +{ + return float4(float(input.instanceID), input.color.xyz); +} diff --git a/tests/bugs/gh-3087.slang b/tests/bugs/gh-3087.slang new file mode 100644 index 000000000..1f6fa98ce --- /dev/null +++ b/tests/bugs/gh-3087.slang @@ -0,0 +1,28 @@ +//TEST:SIMPLE(filecheck=HLSL): -entry main -target hlsl +//TEST:SIMPLE(filecheck=GLSL): -entry main -target glsl +//TEST:SIMPLE(filecheck=SPIRV): -entry main -target spirv + +// HLSL-DAG: main +// HLSL-DAG: SV_InstanceID + +// GLSL-DAG: main +// GLSL-DAG: gl_InstanceIndex + +// SPIRV: OpEntryPoint +// SPIRV-NOT: BuiltIn InstanceIndex +// We require 1 `Flat` for the fragment input `uint` +// SPIRV: Flat +// SPIRV-NOT: Flat + + +struct PSInput +{ + uint vInstance : SV_InstanceID; + float4 color : COLOR; +}; + +[shader("pixel")] +float4 main(PSInput input) : SV_TARGET +{ + return input.color + float(input.vInstance).xxxx; +}
\ No newline at end of file |
