diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/language-feature/constants/link-time-vardecl-must-be-static-const-or-neither.slang | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/language-feature/constants/link-time-vardecl-must-be-static-const-or-neither.slang b/tests/language-feature/constants/link-time-vardecl-must-be-static-const-or-neither.slang new file mode 100644 index 000000000..a1ae810e1 --- /dev/null +++ b/tests/language-feature/constants/link-time-vardecl-must-be-static-const-or-neither.slang @@ -0,0 +1,32 @@ +//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute -DUSE_EXTERN +//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute -DUSE_EXTERN -DUSE_CONST -DUSE_STATIC +//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute -DUSE_CONST -DUSE_STATIC +//CHECK_PASS-NOT: error 31223 + +//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DUSE_EXTERN -DUSE_CONST +//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DUSE_CONST +//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DUSE_EXTERN -DUSE_STATIC +//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DUSE_STATIC +//CHECK_FAIL: error 31223 + + +#ifdef USE_CONST +const +#endif +#ifdef USE_STATIC +static +#endif +#ifdef USE_EXTERN +extern int num; +#else +export int num = 10; +#endif + +RWStructuredBuffer<float> outputBuffer; + +[numthreads(1,1,1)] +void computeMain() +{ + outputBuffer[0] = num; +} |
