summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/capability/cpp-target-has-cpp-impl-from-default.slang
blob: 46ffaf2a703e667ea6d809f72924f2614725da92 (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
//TEST:SIMPLE(filecheck=CHECK): -target cpp -entry computeMain -stage compute -allow-glsl

// CHECK: computeMain(

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(cpp_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();
}