diff options
| author | Yong He <yonghe@outlook.com> | 2024-12-09 04:48:03 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-09 20:48:03 +0800 |
| commit | 09a9d673322ebf4ca2fcb7d48f13a44e015ea33f (patch) | |
| tree | 8bae8fa5718669dcbff98b8bcb29784483905f34 /tests/spirv/ptr-unsized-array-4.slang | |
| parent | 051ae8acec0a641bcaf86e7eeff35eff29e8922d (diff) | |
Allow pointers to existential values. (#5793)
* Fix pointer offset logic and add executable tests.
* Fix.
* Fix test.
* Add existential ptr test.
* Allow pointers to existential values.
* Fix.
* Fix.
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tests/spirv/ptr-unsized-array-4.slang')
| -rw-r--r-- | tests/spirv/ptr-unsized-array-4.slang | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/spirv/ptr-unsized-array-4.slang b/tests/spirv/ptr-unsized-array-4.slang new file mode 100644 index 000000000..561dfab22 --- /dev/null +++ b/tests/spirv/ptr-unsized-array-4.slang @@ -0,0 +1,25 @@ +//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -emit-spirv-directly +//DISABLED_TEST: COMPARE_COMPUTE(filecheck-buffer=CHECK): -wgpu +//DISABLED_TEST: COMPARE_COMPUTE(filecheck-buffer=CHECK): -d3d11 +//DISABLED_TEST: COMPARE_COMPUTE(filecheck-buffer=CHECK): -d3d12 +//DISABLED_TEST: COMPARE_COMPUTE(filecheck-buffer=CHECK): -metal + +// Test a pointer to a struct that has only one field and is an unsized array. +struct MeshStorage { + uint64_t QuadData[]; +}; + +//TEST_INPUT: set pStorage = ubuffer(data=[1 2 3 4 5 6 7 8],stride=4); +uniform MeshStorage* pStorage; + +//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0],stride=4); +uniform RWStructuredBuffer<uint> outputBuffer; + +[numthreads(1,1,1)] +void computeMain() +{ + // CHECK: 3 + // CHECK: 4 + outputBuffer[0] = (int)(pStorage.QuadData[1]&0xFFFFFFFF); + outputBuffer[1] = (int)(pStorage.QuadData[1]>>32); +}
\ No newline at end of file |
