summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-6756.slang
blob: ab1e5aa98a356d3f153fc29e78cd5c101a8af755 (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
//TEST:SIMPLE(filecheck=CHECK):-target spirv -emit-spirv-via-glsl

// This test is to test that PartlyDiffable.Differential is synthesized
// with correct scope. If not, the constructor for it will be wrong, and
// slang will generate wrong code, the downstream compiler will fail to
// compile.

// CHECK: OpEntryPoint Fragment

struct PartlyDiffable : IDifferentiable
{
    int i;
    float q;
}


func breaker(x:PartlyDiffable.Differential) {
    return;
}


[shader("fragment")]
float4 fragment(float4 in: SV_Position)
    : SV_Target
{
    if (PartlyDiffable.Differential(0).q == 0) {
        return float4(0);
    } else {
        return float4(1);
    }
}