yum-mirror/slang

Making it easier to work with shaders

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

ArielG-NVInitial pass to add capability declarations to stdlib intrinsics. (#3912)f9bcad355

master
802 B34 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target cpp -entry computeMain -stage compute -allow-glsl
2//TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target cpp -entry computeMain -stage compute -allow-glsl -ignore-capabilities
3// CHECK_IGNORE_CAPS-NOT: error 36107
4// CHECK: error 36107
5
6layout(binding = 0) buffer MyBlockName
7{
8    int v[1];
9} outputBuffer;
10
11// `default` only should try to define `glsl`, but glsl target is 
12// present in a `case` statment. Therefore this code should error
13// since cpp is missing a target for a function called
14[require(glsl)]
15void someInternalFunc()
16{
17    __target_switch
18    {
19    case glsl:
20        outputBuffer.v[0] = 0;
21    default:
22        outputBuffer.v[0] = 0;
23    }
24}
25void someMin()
26{
27    someInternalFunc();
28}
29
30[numthreads(1,1,1)]
31void computeMain()
32{
33    someMin();
34}