diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2024-08-14 13:05:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-14 10:05:57 -0700 |
| commit | 45b76418f9da2248b069f2058c6a1d52b05a8c74 (patch) | |
| tree | 1757276c7a2fe295d2b130cd74a42c9b8db8783b /tests/language-feature/zero-initialize/shared-memory.slang | |
| parent | d8f63e70719c96044b8f497f7dddb264a7edd560 (diff) | |
Do not zero-initialize groupshared and rayquery variables (#4838)
* Do not zero-initialize groupshared and rayquery variables
Fixes: #4824
`-zero-initialize` option will explicitly not:
1. Set any groupshared values to defaults
2. Set any rayQuery object to a default state (currently invalid code generation)
* grammer
* disallow groupshared initializers
disallow groupshared initializers & adjust tests accordingly
* remove disallowed groupshared-init expression
* do not default init if non-copyable
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/language-feature/zero-initialize/shared-memory.slang')
| -rw-r--r-- | tests/language-feature/zero-initialize/shared-memory.slang | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/language-feature/zero-initialize/shared-memory.slang b/tests/language-feature/zero-initialize/shared-memory.slang new file mode 100644 index 000000000..39243f796 --- /dev/null +++ b/tests/language-feature/zero-initialize/shared-memory.slang @@ -0,0 +1,18 @@ +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -stage compute -entry computeMain -zero-initialize +//TEST:SIMPLE(filecheck=GLSL): -target glsl -stage compute -entry computeMain -zero-initialize + +RWStructuredBuffer<uint> outputBuffer; + +// GLSL-NOT: error 30623 +// HLSL-NOT: error 30623 + +// GLSL-NOT: globalMem{{.*}} = +// HLSL-NOT: globalMem{{.*}} = + +groupshared uint globalMem; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + outputBuffer[0] = globalMem; +} |
