summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/capability/capability3.slang
blob: 4091b9c936c7242c7726b88658f8d40c0da07dcd (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
33
34
35
36
37
38
39
40
41
42
//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -entry main -stage compute
//TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target spirv -emit-spirv-directly -entry main -stage compute -ignore-capabilities -skip-spirv-validation
// CHECK_IGNORE_CAPS-NOT: error 36108

// Test that capabilities can be declared on module.
[require(glsl)]
[require(spirv)]
module test;

RWStructuredBuffer<int> sideEffect;

// CHECK: error {{(36107|36108)}}
[require(glsl, _sm_4_0)]
public void use1()
{
    __target_switch
    {
    case glsl:
        return;
    }
}

void use2Sub()
{
    __target_switch
    {
    case glsl:
        sideEffect[1] = 1;
    }
}
// CHECK: error {{(36107|36108)}}
[require(spirv, spirv_1_0)]
public void use2()
{
    use2Sub();
}

void main()
{
    use1();
    use2();
}