summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-3087.slang
blob: 278bfea3c38e418930208b6e2bbb9ddc41951f68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//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: OpDecorate %{{[1-9][0-9]*}} Flat
// SPIRV-NOT: OpDecorate %{{[1-9][0-9]*}} 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;
}