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

Manually merged
github merged 1 commit from github-bot/gh-352 into gh-pr/352/base 2026-12-02 16:19:44 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-02 15:16 UTC · original
Androtim:feat/hw-rt-phase3-dxil-rayquery → main · +708 −28 · 4 files · 1 commits · merged 2026-12-02 16:14 UTC

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 \
**@⁠Androtim** on GitHub · 2026-12-02 15:16 UTC · [original](https://github.com/Androtim/MiniVI/pull/352) `Androtim:feat/hw-rt-phase3-dxil-rayquery` → `main` · +708 −28 · 4 files · 1 commits · merged 2026-12-02 16:14 UTC 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 \
Implements PR #6 (Phase 3 DXIL RayQuery intrinsics and RTAS bindings):
- Add crates/victory-shader/src/emit/rayquery.rs with DXIL 1.6 opcodes
  for AllocateRayQuery, TraceRayInline, Proceed, Abort,
  CommitNonOpaqueTriangleHit, and all scalar/vector/3x4-matrix candidate
  and committed state accessors, plus structured opaque and non-opaque
  candidate loop helpers.
- Reserve root TLAS SRV slots SLOT_TLAS_BASE..=SLOT_TLAS_MAX (230..=249)
  in emit/shader.rs with RTAccelerationStructure annotation (kind 16),
  ElementType extended metadata tag, and flags::RAYTRACING_TIER_1_1
  (1 << 25 -> SFI0 0x10_0000).
- Add unit and Windows SDK dxil.dll validation tests verifying root and
  descriptor-heap TLAS handles, candidate callbacks, Abort, and object-
  space matrix/vector accessors.

Adapted cleanly from GPL-3.0 upstream implementations:
- TrustNo1-Coder/Darner (crates/darner-shader/src/emit/rayquery.rs)
- readmet3xt-lab/foxhound (crates/victory-shader/src/emit/rayquery*.rs)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 15:17:57 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-02 16:06 UTC · original

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).

**@⁠Androtim** on GitHub · 2026-12-02 16:06 UTC · [original](https://github.com/Androtim/MiniVI/pull/352#issuecomment-7351436527) <!-- 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`)._
github-bot changed target branch from main to gh-pr/352/base 2026-12-02 16:17:18 +00:00
github manually merged commit 1cf49ae054 into gh-pr/352/base 2026-12-02 16:19:44 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!352
No description provided.