summaryrefslogtreecommitdiff
path: root/tests/language-feature/capability/capability3.slang
blob: f7ba1d7937a560eda0da363b7f3648b55ea02366 (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
43
44
45
46
47
//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -entry main -stage compute

// Test that capabilities can be declared on module.

[require(glsl)]
[require(spirv)]
module test;

void f()
{
    __require_capability glsl;
}

// CHECK: ([[# @LINE+1]]): error 36108
public void g()
{
    __require_capability spvAtomicFloat16AddEXT;
}

void l()
{
    __target_switch
    {
    case glsl:
        f();
        return;
    case spirv:
        __require_capability spvAtomicFloat16AddEXT;
        return;
    }
}

// CHECK: ([[# @LINE+1]]): error 36104: {{.*}}
public void use()
{
    l(); // Error
}

// CHECK-NOT: ([[# @LINE+1]]): error
[require(spirv, spvAtomicFloat16AddEXT)]
public void use1()
{
    l(); // Error
}

void main()
{}