From 45b76418f9da2248b069f2058c6a1d52b05a8c74 Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:05:57 -0400 Subject: 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 --- .../language-feature/shared-memory-initializer-error.slang | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/language-feature/shared-memory-initializer-error.slang (limited to 'tests/language-feature/shared-memory-initializer-error.slang') diff --git a/tests/language-feature/shared-memory-initializer-error.slang b/tests/language-feature/shared-memory-initializer-error.slang new file mode 100644 index 000000000..ceb361176 --- /dev/null +++ b/tests/language-feature/shared-memory-initializer-error.slang @@ -0,0 +1,14 @@ +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -stage compute -entry computeMain +//TEST:SIMPLE(filecheck=GLSL): -target glsl -stage compute -entry computeMain + +RWStructuredBuffer outputBuffer; + +// GLSL: error 30623 +// HLSL: error 30623 +groupshared uint globalMem = 1; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + outputBuffer[0] = globalMem ; +} -- cgit v1.2.3