diff options
Diffstat (limited to 'tests/diagnostics')
| -rw-r--r-- | tests/diagnostics/invalid-constant-pointer-taking.slang | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/diagnostics/invalid-constant-pointer-taking.slang b/tests/diagnostics/invalid-constant-pointer-taking.slang index 349f8cc25..658a84b1b 100644 --- a/tests/diagnostics/invalid-constant-pointer-taking.slang +++ b/tests/diagnostics/invalid-constant-pointer-taking.slang @@ -1,4 +1,4 @@ -//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target spirv +//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target spirv RWStructuredBuffer<float> mutable_float_buffer; RWStructuredBuffer<uint> mutable_uint_buffer; @@ -6,18 +6,24 @@ RWStructuredBuffer<uint> mutable_uint_buffer; StructuredBuffer<float> constant_float_buffer; StructuredBuffer<uint> constant_uint_buffer; +// We do not allow taking a pointer from a StructuredBuffer/RWStructuredBuffer. [shader("compute")] [numthreads(1,1,1)] void computeMain(uint3 threadId : SV_DispatchThreadID) { - float* mutablePtr = &mutable_float_buffer[threadId.x]; + float* mutablePtr1 = &mutable_float_buffer[threadId.x]; + + // CHECK: ([[# @LINE+1]]): error 31160 + float* mutablePtr2 = __getAddress(mutable_float_buffer[threadId.x]); InterlockedAdd(mutable_uint_buffer[threadId.x], 1); // Constant pointers arent a thing in slang - // CHECK: error 30078: - float* ptr = &constant_float_buffer[threadId.x]; + // CHECK: ([[# @LINE+1]]): error 30079: + float* ptr1 = &constant_float_buffer[threadId.x]; + // CHECK: ([[# @LINE+1]]): error 31160 + float* ptr2 = __getAddress(constant_float_buffer[threadId.x]); InterlockedAdd(constant_uint_buffer[0], 1); -}
\ No newline at end of file +} |
