[pr-fix][shaders][RAYTRACING] RayQuery callbacks: sampled-slot marks queued in a callback are written inside it #105
Loading…
Reference in a new issue
No description provided.
Delete branch "wutzebaer/Darner:callback-marks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
With hardware ray tracing and
DARNER_SAMPLED_MARKS=1, four of the title's compute programs do not translate:17829ac71aab4e8d,a1b20bc47e3c9597,afeea48bbb9913adande8c962358d862e3f. The emitter panics with "forward reference outside a phi" (crates/darner-shader/src/emit/bitcode.rs).A fetch inside a RayQuery callback queues a wave-uniform sampled-slot mark, and the slot index it marks is defined inside the callback. The queue was only written at the end of the enclosing IR block. That end comes after the query, so the mark read a value from a part of the function that does not come before it.
The queued marks are now written where the callback's instructions end, for both callback kinds (
InlineandBlocks), and before a section's side effects are lowered. With the marks off (the default ofdarner.exe) nothing is queued and nothing changes.How it was tested
619e417e(this change onmainat4a92569f), Windows 11, RTX 5090, debug build.darner translate --warm <file with the four hashes> <game folder>withDARNER_HW_RT=1 DARNER_BVH_MISS=1 DARNER_NAN_SCRUB=1 DARNER_SAMPLED_MARKS=1 DARNER_HOST_WAVE=32:mainat4a92569f: four panics, "forward reference outside a phi".mainwithDARNER_SAMPLED_MARKS=0: all four translate, so the marks are what it takes.cargo clippy --workspace --all-targets --locked -- -D warnings: passed.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed.cargo test --workspace --locked --no-fail-fast: three tests fail, and the same three fail onmainat4a92569fwithout this change:darner-gpu:host::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end(1704 passed, 1 failed, 79 ignored)darner-shader:emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shadersandemit::wave64_tests::lds_shared_atomic_add_producer_executes_wave32_on_hardware(554 passed, 2 failed, 15 ignored)Checklist
main.docs/asset-policy.md.Checked for overlap
crates/darner-shader/src/emit/rayquery.rs; no issue names the four hashes).