Commit 726e097
authored
Fix descriptor heap acceleration structure loads (#11209)
Fixes #10671
## Summary
Fixes #10671 — `DescriptorHandle<RaytracingAccelerationStructure>` with
`spvDescriptorHeapEXT` produced invalid SPIR-V (missing
`OpConvertUToAccelerationStructureKHR`), causing `VK_ERROR_DEVICE_LOST`
at runtime.
- **SPIR-V emitter**: add `emitAccelerationStructureFromDescriptorHeap`
that emits `OpUntypedAccessChainKHR` + `OpLoad` +
`OpConvertUToAccelerationStructureKHR` when loading a
`RaytracingAccelerationStructure` from a descriptor heap. Route
`kIROp_SPIRVLoadDescriptorFromHeap` instructions to this path when the
(unwrapped) data type is `kIROp_RaytracingAccelerationStructureType`.
- **Capability/extension**: use
`requireSPIRVAnyCapability({RayTracingKHR, RayQueryKHR})` and
`ensureAnyExtensionDeclaration({"SPV_KHR_ray_tracing",
"SPV_KHR_ray_query"})` to match how the AS type itself is declared,
supporting both ray-tracing and ray-query targets.
- **render-test**: guard `assignAccelerationStructure` — when the cursor
expects a descriptor handle type, return `SLANG_E_NOT_AVAILABLE` if the
acceleration structure is null (device doesn't support ray tracing), and
propagate `getDescriptorHandle` failure rather than silently falling
back to `setBinding`.
- **Regression test**:
`tests/spirv/descriptor-heap-acceleration-structure.slang` verifies the
correct SPIR-V sequence is emitted.
## Test plan
- [ ] `slang-test
tests/spirv/descriptor-heap-acceleration-structure.slang` passes
- [ ] CI passes on SPIR-V targets
## Labels
pr: non-breaking1 parent a49a125 commit 726e097
5 files changed
Lines changed: 185 additions & 10 deletions
File tree
- docs/user-guide
- source/slang
- tests/spirv
- tools/render-test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
668 | 670 | | |
669 | 671 | | |
670 | 672 | | |
| |||
682 | 684 | | |
683 | 685 | | |
684 | 686 | | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
| 687 | + | |
690 | 688 | | |
691 | | - | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
692 | 713 | | |
693 | 714 | | |
694 | 715 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4917 | 4917 | | |
4918 | 4918 | | |
4919 | 4919 | | |
| 4920 | + | |
| 4921 | + | |
| 4922 | + | |
| 4923 | + | |
| 4924 | + | |
| 4925 | + | |
| 4926 | + | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
4920 | 4930 | | |
4921 | 4931 | | |
4922 | 4932 | | |
| |||
7114 | 7124 | | |
7115 | 7125 | | |
7116 | 7126 | | |
| 7127 | + | |
| 7128 | + | |
| 7129 | + | |
| 7130 | + | |
| 7131 | + | |
| 7132 | + | |
| 7133 | + | |
| 7134 | + | |
| 7135 | + | |
| 7136 | + | |
| 7137 | + | |
| 7138 | + | |
| 7139 | + | |
| 7140 | + | |
| 7141 | + | |
| 7142 | + | |
| 7143 | + | |
| 7144 | + | |
| 7145 | + | |
| 7146 | + | |
| 7147 | + | |
| 7148 | + | |
| 7149 | + | |
| 7150 | + | |
| 7151 | + | |
| 7152 | + | |
| 7153 | + | |
| 7154 | + | |
| 7155 | + | |
| 7156 | + | |
| 7157 | + | |
| 7158 | + | |
7117 | 7159 | | |
7118 | 7160 | | |
7119 | 7161 | | |
| |||
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
862 | 862 | | |
863 | 863 | | |
864 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
865 | 876 | | |
866 | 877 | | |
867 | 878 | | |
| |||
0 commit comments