diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2024-07-30 23:03:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-30 20:03:24 -0700 |
| commit | fef0a87ddee9c0f252a6625395b684b1cb5d85e0 (patch) | |
| tree | 48c3f52e1b4395123d080971e10bc6009f41e8fb /tests/language-feature/resource-specialization-nested-specialization.slang | |
| parent | ff6519f0bc11ccb71fe5863d3de92660eeedfb5d (diff) | |
Fix invalid code generation for when using nested resource specialization (#4751)
Diffstat (limited to 'tests/language-feature/resource-specialization-nested-specialization.slang')
| -rw-r--r-- | tests/language-feature/resource-specialization-nested-specialization.slang | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/language-feature/resource-specialization-nested-specialization.slang b/tests/language-feature/resource-specialization-nested-specialization.slang new file mode 100644 index 000000000..2b88e7611 --- /dev/null +++ b/tests/language-feature/resource-specialization-nested-specialization.slang @@ -0,0 +1,58 @@ +//TEST:SIMPLE(filecheck=CHECK_DXIL): -target dxil -profile sm_6_0 -entry computeMain -stage compute -DMEMBER_FUNCTION_CALL +//TEST:SIMPLE(filecheck=CHECK_DXIL): -target dxil -profile sm_6_0 -entry computeMain -stage compute + +//CHECK_DXIL: computeMain + +struct Grid +{ + uint bufSize; + StructuredBuffer<uint> buf; +}; + +struct GridGeo +{ + Grid grids[2]; + + void getGrid(uint index, out Grid grid) + { + grid = grids[index]; + } +}; + +struct Scene +{ + GridGeo gridGeo; + + void getGrid_BAD(uint index, out Grid grid) + { + gridGeo.getGrid(index, grid); + } + + void getGrid_GOOD(uint index, out Grid grid) + { + grid = gridGeo.grids[index]; + } +}; + +ParameterBlock<Scene> gScene; +RWStructuredBuffer<uint> gridBuffers[2]; +RWStructuredBuffer<uint> outputBuffer; + +void direct_getGrid_BAD(uint index, out Grid grid) +{ + gScene.gridGeo.getGrid(index, grid); +} + +[numthreads(1, 1, 1)] +void computeMain(uint3 threadId: SV_DispatchThreadID) +{ + + Grid grid; + +#ifdef MEMBER_FUNCTION_CALL + direct_getGrid_BAD(1, grid); +#else + gScene.getGrid_BAD(1, grid); +#endif + gridBuffers[0][1] = grid.buf[1]; +} |
