summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-841.slang
blob: 5f7e0c81fee454846bb3ed10c714cde3ba634791 (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
30
31
32
// gh-841.slang

//TEST:CROSS_COMPILE(filecheck=SPV): -profile ps_5_0 -entry main -target spirv-assembly
//TEST:CROSS_COMPILE(filecheck=GLSL): -profile ps_5_0 -entry main -target glsl

// GitHub issue #841: failing to emit `flat` modifier in output GLSL when required

struct RasterVertex
{
  // location 0
	float4 c : COLOR;

  // Make sure that the input value in location 1 is decorated as Flat
  // SPV-DAG: OpDecorate [[VAL:%[_A-Za-z0-9]+]] Location 1
  // SPV-DAG: [[VAL]] = OpVariable {{.*}} Input
  // SPV-DAG: OpDecorate [[VAL]] Flat
  //
  // Likewise for GLSL
  // GLSL:      flat layout(location = 1)
  // GLSL-NEXT: in uint {{[[:alnum:]_]+}};
  //
  // location 1
	uint u : FLAGS;
};

float4 main(RasterVertex v) : SV_Target
{
	float4 result = v.c;
	if((v.u & 1) != 0)
	    result += 1.0;
   return result;
}