summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/capability/cpp-target-missing-cpp-impl.slang
blob: a01993e8f424405b3a5146e3532b524079987a4e (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
//TEST:SIMPLE(filecheck=CHECK): -target cpp -entry computeMain -stage compute -allow-glsl
//TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target cpp -entry computeMain -stage compute -allow-glsl -ignore-capabilities
// CHECK_IGNORE_CAPS-NOT: error 36107
// CHECK: error 36107

layout(binding = 0) buffer MyBlockName
{
    int v[1];
} outputBuffer;

// `default` only should try to define `glsl`, but glsl target is 
// present in a `case` statment. Therefore this code should error
// since cpp is missing a target for a function called
[require(glsl)]
void someInternalFunc()
{
    __target_switch
    {
    case glsl:
        outputBuffer.v[0] = 0;
    default:
        outputBuffer.v[0] = 0;
    }
}
void someMin()
{
    someInternalFunc();
}

[numthreads(1,1,1)]
void computeMain()
{
    someMin();
}