Skip to content

Shaders: emulate image_bvh intersect instructions as miss to enable lighting compute shaders - #2191

Closed
Xvania7 wants to merge 1 commit into
Marvisak:mainfrom
Xvania7:feat/bvh-raytracing-fallback
Closed

Xvania7 wants to merge 1 commit into
Marvisak:mainfrom
Xvania7:feat/bvh-raytracing-fallback

Conversation

@Xvania7

@Xvania7 Xvania7 commented Nov 25, 2026

Copy link
Copy Markdown

Closes #1533 (related to #876, #71, #274).

Summary

Emulates RDNA2 MIMG BVH traversal instructions image_bvh_intersect_ray (x0e6) and image_bvh64_intersect_ray (x0e7) as a clean miss so lighting/RTGI/shadow compute shaders (CS_RaytracingResolve,
tdirectionalshadows) translate and execute instead of failing with ShaderError::Unsupported:

  • crates/victory-shader/src/gfx10/fields.rs: Ensure image_bvh* allocate 4 destination dwords (�data).
  • crates/victory-shader/src/emit/lower.rs: Intercept image_bvh* in image(), zeroing all 4 destination VGPRs under the active lane guard (RDNA2 zero hit mask -> traversal miss), and map BVH descriptors as raw buffer views (kind 11) in descriptor_data().

Verification

@r4tedx

r4tedx commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

A note for the triage, from reading this PR against main 940d32f: main already lowers both instructions for real, so this would replace a working lowering with a miss.

A miss for every ray was a reasonable way to get the lighting programs to translate while nothing lowered these instructions. On current main it would turn the real result into "nothing hit" for every program that traces. The PR also conflicts with main in the same function.

What still stops ray-tracing programs on main is elsewhere: in an offline count of 940d32f, the 40 compute programs that use image_bvh_intersect_ray are refused for a register joining a lane mask and data, read as data, which #1883 addresses (all 40 emit with it; with #2027 as well, all 40 validate). So my suggestion is to close this one in favour of what is in main, and if #1533 is still open, to point it at #1883.

Local title data was used for the count only (offline, CPU only, counts and reasons). Nothing was run for this comment beyond reading the code.

AI-assisted (Claude Code).

@Xvania7

Xvania7 commented Nov 25, 2026

Copy link
Copy Markdown
Author

Thanks @r4tedx for checking against \940d32f! Confirmed \main\ now includes full BVH intersection lowering (\�b35b7f\ / \lower/bvh.rs), so this miss fallback is superseded. Closing in favor of \main\ (and #1883 / #2027 for the remaining register-join validation on the 40 RT programs).

@Xvania7 Xvania7 closed this Nov 25, 2026

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts with current main (940d32f) — verified locally: git merge origin/main fails. image_bvh intersect emulation needs a rebase; I'll re-test after. The approach (emulate as miss) is sound for unsupported BVH-intersect instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ready to merge] Shaders: emulate image_bvh intersect instructions as miss to enable lighting compute shaders

3 participants