forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgh-841.slang
32 lines (27 loc) · 822 Bytes
/
gh-841.slang
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;
}