yum-mirror/slang

Making it easier to work with shaders

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

ArielG-NVEnforce rule that `export`/`extern` (non cpp) must be `const` (#7113)0651ffb64

master
1.1 KiB32 linesraw
1//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute -DUSE_EXTERN
2//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute
3//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute -DUSE_EXTERN -DUSE_CONST -DUSE_STATIC
4//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute -DUSE_CONST -DUSE_STATIC
5//CHECK_PASS-NOT: error 31223
6
7//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DUSE_EXTERN -DUSE_CONST
8//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DUSE_CONST
9//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DUSE_EXTERN -DUSE_STATIC
10//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DUSE_STATIC
11//CHECK_FAIL: error 31223
12
13
14#ifdef USE_CONST
15const
16#endif
17#ifdef USE_STATIC
18static
19#endif
20#ifdef USE_EXTERN
21extern int num;
22#else
23export int num = 10;
24#endif
25
26RWStructuredBuffer<float> outputBuffer;
27
28[numthreads(1,1,1)]
29void computeMain()
30{
31    outputBuffer[0] = num;
32}