diff options
| author | Anders Leino <aleino@nvidia.com> | 2025-01-17 07:23:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-16 21:23:31 -0800 |
| commit | dfb369e87dd7638e84efe8feb9e7069e5238b44c (patch) | |
| tree | ec1d8ffb4b295cd5c0d1a042255e77ecd9ae8ce7 /tests/wgsl | |
| parent | 1b7c242bc9ebf649708836f5ed03363f5f0e3969 (diff) | |
Move global variable initialization into entry points for WGSL (#6106)
* Add test that reproduces the issue in #5986
* Call moveGlobalVarInitializationToEntryPoints for WGSL as well
This closes #5986.
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/wgsl')
| -rw-r--r-- | tests/wgsl/global-call.slang | 20 | ||||
| -rw-r--r-- | tests/wgsl/global-call.slang.expected.txt | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/wgsl/global-call.slang b/tests/wgsl/global-call.slang new file mode 100644 index 000000000..7b67f2139 --- /dev/null +++ b/tests/wgsl/global-call.slang @@ -0,0 +1,20 @@ +//TEST(compute):COMPARE_COMPUTE:-shaderobj + +//TEST_INPUT:ubuffer(data=[3 7 8 10], stride=4):name=inputBuffer +RWStructuredBuffer<uint> inputBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +uint f(uint a) +{ + return a*inputBuffer[0]; +} + +static uint b = f(2); + +[numthreads(1,1,1)] +void computeMain() +{ + outputBuffer[0] = b; +}
\ No newline at end of file diff --git a/tests/wgsl/global-call.slang.expected.txt b/tests/wgsl/global-call.slang.expected.txt new file mode 100644 index 000000000..e20d75ba3 --- /dev/null +++ b/tests/wgsl/global-call.slang.expected.txt @@ -0,0 +1,4 @@ +6 +0 +0 +0 |
