diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-26 23:56:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-27 14:56:06 +0800 |
| commit | ebe8ddefc48478307d5f206cd3e40c41d28a36e3 (patch) | |
| tree | 8e13977979909a26394eea532d8b95cd5ad0f6d1 /tests/spirv/array-uniform-param.slang | |
| parent | c5c8cfbb360d9a763f549df48636effde839eacd (diff) | |
Various SPIRV fixes. (#3231)
* Various SPIRV fixes.
- Geometry shader support (WIP).
- Fix texture get dimension and load.
- Fold global GetElement(MakeArray/MakeVector) insts.
- Call spvopt to inline all functions.
- Translate OpImageSubscript.
- Emit struct member names and global variable names.
- Fix lowering of OpBitNot -> OpNot, instead of OpBitReverse.
* Fix test.
* Fix geometry shader.
* Fix geometry shader emit.
* Add atomic Image access test.
* Fix tests.
* don't fail if spirv-opt fails.
* Update comments.
* Fix test.
* Cleanups.
* indentation
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tests/spirv/array-uniform-param.slang')
| -rw-r--r-- | tests/spirv/array-uniform-param.slang | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/spirv/array-uniform-param.slang b/tests/spirv/array-uniform-param.slang new file mode 100644 index 000000000..235e85bbd --- /dev/null +++ b/tests/spirv/array-uniform-param.slang @@ -0,0 +1,40 @@ +// array-uniform-param.slang + +//TESTD:SIMPLE:-target spirv -entry computeMain -stage compute -emit-spirv-directly -force-glsl-scalar-layout +//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-vk -compute -output-using-type + +// Test direct SPIR-V emit on arrays in uniforms. + +//TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4) +RWStructuredBuffer<uint> resultBuffer; + +struct Data +{ + uint arr[4]; +} + +struct Data2 +{ + uint arr[4u]; +} + +//TEST_INPUT: set Uniforms.d = new Data{{1,2,3,4}}; +//TEST_INPUT: set Uniforms.d2 = new Data2{{1,2,3,4}}; + +cbuffer Uniforms +{ + Data d; + Data2 d2; +} + +// BUFFER: 3 + +[numthreads(4,1,1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint threadId = dispatchThreadID.x; + uint result = d.arr[1]; + var u2 = reinterpret<Data>(d2); + result += u2.arr[0]; + resultBuffer[threadId] = result; +} |
