Shaders: verify no-hit ray results on D3D12 and skip unused ray operands #1218

Open
BradRoland wants to merge 1 commit from upstream-pr/1221 into main
BradRoland commented 2026-11-26 00:30:20 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by BradRoland on 2026-11-26T00:30:20Z.


The optional no-hit translation from 96ff135 only needs the node kind in the low pointer word. It was resolving every ray operand and emitting ten float casts before returning. This change resolves the pointer for the no-hit result and constructs the ray only on the intersection path.

The regression test now translates in fresh processes using the actual launch settings. With VICTORY_BVH_NO_HIT=1 and the builder off, it dispatches both pointer widths with generated ray records, no node bytes, and no scene-directory or fault bindings. It checks all four result words per lane for all eight node kinds and verifies that masked lanes retain their prior values. With the builder enabled as well, both widths request the scene directory and fault bindings again.

On a GeForce RTX 4080 and WARP, the readbacks passed. As a negative control, locally removing the lane guard made hardware batch 9, lane 20 overwrite [1, 2, 3, 4] with the miss result. The submitted shader preserves that lane.

With optimizer passes disabled the synthetic no-hit DXIL shrank by 40 bytes for each width. With the default passes the sizes were 2,300 bytes (64-bit) and 2,308 bytes (32-bit), the same as before. Gameplay lighting and frame time remain unmeasured.

The complete shader library suite passed on Windows (217 passed, 3 ignored), and the seven intersection tests passed with diagnostics enabled.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6616697200 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1221). Originally posted by [BradRoland](https://github.com/BradRoland) on 2026-11-26T00:30:20Z. --- The optional no-hit translation from `96ff135` only needs the node kind in the low pointer word. It was resolving every ray operand and emitting ten float casts before returning. This change resolves the pointer for the no-hit result and constructs the ray only on the intersection path. The regression test now translates in fresh processes using the actual launch settings. With `VICTORY_BVH_NO_HIT=1` and the builder off, it dispatches both pointer widths with generated ray records, no node bytes, and no scene-directory or fault bindings. It checks all four result words per lane for all eight node kinds and verifies that masked lanes retain their prior values. With the builder enabled as well, both widths request the scene directory and fault bindings again. On a GeForce RTX 4080 and WARP, the readbacks passed. As a negative control, locally removing the lane guard made hardware batch 9, lane 20 overwrite `[1, 2, 3, 4]` with the miss result. The submitted shader preserves that lane. With optimizer passes disabled the synthetic no-hit DXIL shrank by 40 bytes for each width. With the default passes the sizes were 2,300 bytes (64-bit) and 2,308 bytes (32-bit), the same as before. Gameplay lighting and frame time remain unmeasured. The complete shader library suite passed on Windows (217 passed, 3 ignored), and the seven intersection tests passed with diagnostics enabled.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1221:upstream-pr/1221'
git switch 'upstream-pr/1221'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1221'
git switch 'upstream-pr/1221'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1221'
git switch 'upstream-pr/1221'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1221'
git switch 'main'
git merge --squash 'upstream-pr/1221'
git switch 'main'
git merge --ff-only 'upstream-pr/1221'
git switch 'main'
git merge 'upstream-pr/1221'
git push origin 'main'
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
fxceless/victory-fork!1218
No description provided.