summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/capability/capability8.slang
blob: 2907166e0a8edfd7e72e6c28e3f4eddda5d6917a (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
//TEST:SIMPLE(filecheck=CHECK-PASS): -target glsl -entry computeMain -stage compute -profile sm_5_0
//TEST:SIMPLE(filecheck=CHECK): -target metal -entry computeMain -stage compute -profile sm_5_0

// Test that we diagnose an error when calling a method that requires a capability that is not
// available in the target.

RWStructuredBuffer<int> outputBuffer;

[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, byteaddressbuffer)]
struct Test
{
    [require(cpp_cuda_glsl_hlsl_spirv_wgsl, structuredbuffer)]
    int data()
    {
        return 0;
    }
}

// CHECK-PASS-NOT: error 36107
// CHECK: ([[# @LINE+1]]): error 36107{{.*}}metal
void computeMain()
{
    Test t;
    // CHECK: ([[# @LINE+1]]): note: see using of 'data'
    outputBuffer[0] = t.data();
}