shader: add SM 6.6 DXIL RayQuery emitter and RTAS SRV support (#339) #352

Merged
Androtim merged 1 commit from upstream-pr/352 into main 2026-12-02 16:14:20 +00:00
Androtim commented 2026-12-02 15:16:53 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T15:16:53Z.


Implements PR #6 (first half of Phase 3 Native SM 6.6 DXR 1.1 \RayQuery\ shader lifting for #339; unused at runtime unless enabled by the traversal lifter in PR #7):

  • *\ ictory-shader::emit::rayquery* (rayquery.rs):
    • All DXIL 1.6 \RayQuery\ intrinsics: \AllocateRayQuery\ (178), \TraceRayInline\ (179), \Proceed\ (180), \Abort\ (181), \CommitNonOpaqueTriangleHit\ (182), and scalar / vector / 3x4-matrix candidate & committed state getters (\CommittedStatus, \CommittedRayT, barycentrics, front face, instance/geometry/primitive IDs, object-space ray origin/direction, transforms).
    • Structured \emit_opaque\ and \emit_candidates\ loop helpers.
  • *\ ictory-shader::emit::shader* (shader.rs):
    • Adds \SLOT_TLAS_BASE..=SLOT_TLAS_MAX\ (230..=249), \Shader::root_tlas_handle\ emitting \RTAccelerationStructure\ (kind 16) with {i32 0, i32 4}\ ElementType metadata, and \ lags::RAYTRACING_TIER_1_1\ (\1 << 25) mapping to \SFI0\ bit \
<!-- greyfinch-sync:Androtim/MiniVI:issue:5609348075 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/352). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T15:16:53Z. --- Implements PR #6 (first half of Phase 3 Native SM 6.6 DXR 1.1 \RayQuery\ shader lifting for #339; unused at runtime unless enabled by the traversal lifter in PR #7): - **\ ictory-shader::emit::rayquery\** ([rayquery.rs](crates/victory-shader/src/emit/rayquery.rs)): - All DXIL 1.6 \RayQuery\ intrinsics: \AllocateRayQuery\ (178), \TraceRayInline\ (179), \Proceed\ (180), \Abort\ (181), \CommitNonOpaqueTriangleHit\ (182), and scalar / vector / 3x4-matrix candidate & committed state getters (\CommittedStatus\, \CommittedRayT\, barycentrics, front face, instance/geometry/primitive IDs, object-space ray origin/direction, transforms). - Structured \emit_opaque\ and \emit_candidates\ loop helpers. - **\ ictory-shader::emit::shader\** ([shader.rs](crates/victory-shader/src/emit/shader.rs)): - Adds \SLOT_TLAS_BASE..=SLOT_TLAS_MAX\ (230..=249), \Shader::root_tlas_handle\ emitting \RTAccelerationStructure\ (kind 16) with \{i32 0, i32 4}\ ElementType metadata, and \ lags::RAYTRACING_TIER_1_1\ (\1 << 25\) mapping to \SFI0\ bit \
Androtim commented 2026-12-02 16:06:05 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T16:06:05Z.


Automated triage for the maintainers (not an approval).

Verdict: merge-candidate · CI (check): passing

Summary

PR #352 adds the SM 6.6 / DXR 1.1 inline RayQuery DXIL emitter (crates/victory-shader/src/emit/rayquery.rs) and RTAccelerationStructure root SRV support (crates/victory-shader/src/emit/shader.rs), with CI passing.

Review Notes

  • DXIL intrinsics & metadata (rayquery.rs, shader.rs):
    • rq_op opcodes (178..=212), ray_flag constants, function signatures (allocateRayQuery, rayQuery_TraceRayInline, rayQuery_Proceed.i1, rayQuery_Abort, rayQuery_CommitNonOpaqueTriangleHit, rayQuery_StateScalar.*, rayQuery_StateVector.f32, rayQuery_StateMatrix.f32 with i32 row and i8 col), and attributes (NoUnwind for mutating ops, ReadOnly for state queries) match the DXIL 1.6 specification.
    • Shader::root_tlas_handle emits ResourceKind::RTAccelerationStructure (16) with {i32 0, i32 4} element-type metadata in Shader::finish, SLOT_TLAS_BASE..=SLOT_TLAS_MAX (230..=249) do not overlap existing reserved slots (250..=255), and flags::RAYTRACING_TIER_1_1 (1 << 25) maps to SFI0 bit 0x10_0000.
    • Existing shaders have root_tlas_srvs.is_empty() and RAYTRACING_TIER_1_1 == 0, so existing emitted DXIL and PSV0/SFI0 output remain unchanged.
  • Minor non-blocking nits:
    • rayquery::tests is gated with #[cfg(test)] rather than #[cfg(all(test, windows))] while importing super::super::validator::Validator (which is #[cfg(windows)] in emit/mod.rs); fine on Windows CI, though non-Windows cargo test would fail to resolve validator.
    • In abort_and_object_space_accessors_validate_with_dxil, the callback calls ray_query_commit_non_opaque + ray_query_abort and then also returns true for hit, causing emit_candidates to emit a second CommitNonOpaqueTriangleHit after Abort; harmless for DXIL encoding validation, but returning false on the abort branch would better mirror real usage.

Verdict

merge-candidate — clean, well-tested foundational DXIL emitter with passing CI and no runtime impact on existing shaders until wired up by the traversal lifter (PR #354). (Automated triage review; not a formal maintainer approval.)


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7351436527 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/352#issuecomment-7351436527). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-02T16:06:05Z. --- <!-- minivi-triage v1 head=1cf49ae054c892d04df3e7dff89c8b711d223320 verdict=merge-candidate ci=passing at=2026-12-02T16:06:37Z --> Automated triage for the maintainers (not an approval). **Verdict:** `merge-candidate` · **CI (`check`):** `passing` ### Summary PR #352 adds the SM 6.6 / DXR 1.1 inline `RayQuery` DXIL emitter (`crates/victory-shader/src/emit/rayquery.rs`) and `RTAccelerationStructure` root SRV support (`crates/victory-shader/src/emit/shader.rs`), with CI passing. ### Review Notes - **DXIL intrinsics & metadata (`rayquery.rs`, `shader.rs`)**: - `rq_op` opcodes (`178..=212`), `ray_flag` constants, function signatures (`allocateRayQuery`, `rayQuery_TraceRayInline`, `rayQuery_Proceed.i1`, `rayQuery_Abort`, `rayQuery_CommitNonOpaqueTriangleHit`, `rayQuery_StateScalar.*`, `rayQuery_StateVector.f32`, `rayQuery_StateMatrix.f32` with `i32` row and `i8` col), and attributes (`NoUnwind` for mutating ops, `ReadOnly` for state queries) match the DXIL 1.6 specification. - `Shader::root_tlas_handle` emits `ResourceKind::RTAccelerationStructure` (`16`) with `{i32 0, i32 4}` element-type metadata in `Shader::finish`, `SLOT_TLAS_BASE..=SLOT_TLAS_MAX` (`230..=249`) do not overlap existing reserved slots (`250..=255`), and `flags::RAYTRACING_TIER_1_1` (`1 << 25`) maps to `SFI0` bit `0x10_0000`. - Existing shaders have `root_tlas_srvs.is_empty()` and `RAYTRACING_TIER_1_1 == 0`, so existing emitted DXIL and `PSV0`/`SFI0` output remain unchanged. - **Minor non-blocking nits**: - `rayquery::tests` is gated with `#[cfg(test)]` rather than `#[cfg(all(test, windows))]` while importing `super::super::validator::Validator` (which is `#[cfg(windows)]` in `emit/mod.rs`); fine on Windows CI, though non-Windows `cargo test` would fail to resolve `validator`. - In `abort_and_object_space_accessors_validate_with_dxil`, the callback calls `ray_query_commit_non_opaque` + `ray_query_abort` and then also returns `true` for `hit`, causing `emit_candidates` to emit a second `CommitNonOpaqueTriangleHit` after `Abort`; harmless for DXIL encoding validation, but returning `false` on the abort branch would better mirror real usage. ### Verdict `merge-candidate` — clean, well-tested foundational DXIL emitter with passing CI and no runtime impact on existing shaders until wired up by the traversal lifter (PR #354). *(Automated triage review; not a formal maintainer approval.)* --- _Generated with Antigravity CLI (`agy`)._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Androtim/MiniVI!352
No description provided.