diff options
| author | Gangzheng Tong <tonggangzheng@gmail.com> | 2025-08-18 21:19:01 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-18 21:19:01 -0700 |
| commit | ae1a93b579ed276d2455e1b97ca65ad4727d56d0 (patch) | |
| tree | 5892061b616363a9ca45f8b24e58f7fccccb74ca /tests | |
| parent | e9a309678f55a59bb012a931af2c1b734968a13d (diff) | |
Emit descriptor handle correctly for ParameterBlock<DescriptorHandle> (#8206)
In Metal, if `ParameterBlock` contains `DescriptorHandle` directly, it
would be emitted as DescriptorHandle literal, which is not valid Metal
code,
This fix adds a case for `kIROp_DescriptorHandleType` and directs it to
the Parent's `emitType` function to handle it.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/metal/test_descriptor_handle.slang | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/metal/test_descriptor_handle.slang b/tests/metal/test_descriptor_handle.slang new file mode 100644 index 000000000..8579fee4a --- /dev/null +++ b/tests/metal/test_descriptor_handle.slang @@ -0,0 +1,17 @@ +//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target metal + +struct MyStruct +{ + uint value; +} +// CHECK-NOT: DescriptorHandle +ParameterBlock<DescriptorHandle<Buffer<uint>>> param; +RWStructuredBuffer<uint> outputBuffer; +[numthreads(4, 1, 1)] +void computeMain(uint3 dtid : SV_DispatchThreadID) +{ + uint idx = dtid.x; + // Load values from the buffer to verify correct access + // CHECK: {{.*}}outputBuffer{{.*}}= + outputBuffer[idx] = param[0]; +} |
