yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

ArielG-NV[Capability System] Fix bug where capabilities do not correctly propegate if AST-parent has target+set the AST-child does not (#8175)dd06524f5

master
755 B26 linesraw
1//TEST:SIMPLE(filecheck=CHECK-PASS): -target glsl -entry computeMain -stage compute -profile sm_5_0
2//TEST:SIMPLE(filecheck=CHECK): -target metal -entry computeMain -stage compute -profile sm_5_0
3
4// Test that we diagnose an error when calling a method that requires a capability that is not
5// available in the target.
6
7RWStructuredBuffer<int> outputBuffer;
8
9[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, byteaddressbuffer)]
10struct Test
11{
12    [require(cpp_cuda_glsl_hlsl_spirv_wgsl, structuredbuffer)]
13    int data()
14    {
15        return 0;
16    }
17}
18
19// CHECK-PASS-NOT: error 36107
20// CHECK: ([[# @LINE+1]]): error 36107{{.*}}metal
21void computeMain()
22{
23    Test t;
24    // CHECK: ([[# @LINE+1]]): note: see using of 'data'
25    outputBuffer[0] = t.data();
26}