Skip to content

[BUNDLE] Lane-mask, scalar descriptor read and cube-sample shader fixes: #1057 #1073 #1074 #1084 #953 #1056 #1015 #1055 #563 #1004 - #1319

Closed
MamaLeVrai wants to merge 20 commits into
Marvisak:mainfrom
MamaLeVrai:bundle/lane-masks-scalar-reads
Closed

MamaLeVrai wants to merge 20 commits into
Marvisak:mainfrom
MamaLeVrai:bundle/lane-masks-scalar-reads

Conversation

@MamaLeVrai

@MamaLeVrai MamaLeVrai commented Nov 24, 2026 •

Copy link
Copy Markdown

One PR in place of ten. It merges ten open shader PRs onto main (ffe310e) with every head unchanged, and reports that the result builds and passes together. Two of the merges needed a hand resolution, described below. Nothing else is changed.

For reviewers and for anyone verifying with an agent (Claude, Codex, a person): this is the [BUNDLE] PR. The re-verification commands are below, so one run covers all ten.

What is inside

PR Author Head Topic
#1057 bartikele a793ad86a lower all-zero and all-one constant lane masks
#1073 undeadhuman37 986fa6db9 a scalar joining a lane mask and a number (pixel, vertex)
#1074 undeadhuman37 ec337a025 a lane mask spilled to a VGPR lane is still that mask
#1084 undeadhuman37 48a41fb85 select or carry-in on an untracked mask tests this lane's bit
#953 MartinIndra02 c42cbb073 s_buffer_load uses in descriptor_data (#798)
#1056 adamdotpy 417f4e30d scalar loads from a root view's address read its memory
#1015 justrealyme b8cfe8ce7 scalar loads through a heap buffer that vector accesses use
#1055 adamdotpy 21d1b4682 scalar buffer loads from a UAV read it raw
#563 SAitken91 10ac6ceac cube samples with gradients, image_sample_d_cl
#1004 tarcisioads cbc8c33dc image_get_lod on cube textures

The first four target "a lane mask read as data", named in the in-game refusal tables on #293 (the latest one there puts "a lane mask read as data" first, at 408 per frame). The next four target "a scalar memory read as data". The last two are the image-sample refusals.

All ten are MERGEABLE against main on their own. Merged in the order above they conflict in two places, which this PR resolves:

  1. Shaders: scalar loads through a heap buffer that vector accesses use read a buffer view #1015 + Shaders: scalar buffer loads from a UAV read it raw #1055, emit/lower.rs, the raw view chosen for a scalar buffer load of a descriptor. Resolution: an SRV range reads a raw SRV view, a UAV range a raw UAV view (Shaders: scalar buffer loads from a UAV read it raw #1055), a descriptor of no listed kind the heap buffer view (Shaders: scalar loads through a heap buffer that vector accesses use read a buffer view #1015). Both PRs' tests in emit/valu_tests.rs are kept.
  2. Shaders: cube samples with gradients, and image_sample_d_cl #563 + Shaders: lower image_get_lod on cube textures #1004, emit/lower.rs, the cube-sample refusal. Shaders: cube samples with gradients, and image_sample_d_cl #563 lowers gradients, Shaders: lower image_get_lod on cube textures #1004 the level query, so only texel coordinates are still refused.

Left out, and why

Verification

Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain):

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings clean
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings clean
cargo test --workspace --locked 350 passed, 0 failed, 6 ignored (main: 342 passed, 6 ignored)

Each of the ten also passes the same three checks alone on main (matrix on #801). The tests that exercise the lowering run on the GPU and on WARP. The title was not run, so this says nothing about in-game effect: a testing run with this branch is the next useful step.

Re-verify in one go

git fetch https://github.com/MamaLeVrai/VIctory.git bundle/lane-masks-scalar-reads
git checkout FETCH_HEAD
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked

To confirm that no component PR moved since this was built, compare each Head above with gh pr view <n> --repo Marvisak/VIctory --json headRefOid. If one differs, this branch needs a rebuild: merge the new head in the same order.

If this lands

The ten heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. If you prefer to merge them one by one instead, the order above has no conflicts except the two noted.

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

SAitken91 and others added 20 commits November 23, 2026 22:57
image_sample_d_cl was refused by name, and behind it every program hit
a cube sample with explicit gradients, refused as "a cube sample with
... gradients". Both now translate to sampleGrad:

- A cube's gradients on GFX10 are of the face coordinates (s, t), four
  addresses rather than six, so the coordinates follow at 4. They become
  the direction's gradients through the face's linear part of
  cube_direction (u = 2s - 3, v = 2t - 3; the major axis does not move),
  in the new cube_gradient.
- `_cl`: the level-of-detail clamp follows the coordinates and is passed
  as sampleGrad's clamp.

translate --validate on shaders.rpf: vertex/pixel 12172 -> 12197
validated; both errors are gone from the list. Not yet compared against
the console's sampling at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e a buffer view

A descriptor fetched from the resource heap by index has no used-resource
entry, so a scalar buffer load (s_buffer_load_dword*) through it was
lowered through a 64 KiB constant buffer handle. When vector buffer loads
read the same descriptor, the slot holds a buffer SRV (the title made it
one), and reading it through a CBV handle is a descriptor of the wrong
type, which D3D12 leaves undefined. Such loads now read the slot as a raw
buffer, as table SRVs already do. A descriptor also written through
(a UAV) and one only scalar loads read are unchanged.

In the title's shaders.rpf this changes 38,829 scalar loads in about 1,900
of 26,084 programs; emit and validation counts are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s_buffer_load_dword* through a table's UAV took the constant buffer
path: a CBV handle at the heap index of a UAV. Reading through it
removes the device (WARP: "The GPU device instance has been
suspended"). Such a load now reads the UAV raw, as a raw SRV is read
and as vector buffer accesses read a UAV.

The test writes a value to the VALU tests' raw UAV, reads it back with
a scalar buffer load and stores that; it removed the WARP device before
this change and passes on the hardware GPU and WARP after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An s_load_dword* whose address is a root descriptor's, and whose
result the program never uses as a descriptor, reads that buffer's
data. It stopped with "a descriptor read only as data". It is now read
as global loads from a root view already are: a root SRV raw, a root
CBV (or a root view the used-resource list does not name) as a
constant buffer. A root UAV still stops, with its own reason.

Test: dwords 2 and 3 of a root SRV and of a root CBV read with one
s_load_dwordx2 and stored, exact on the hardware GPU and WARP; main
refuses the program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d vertex programs

A register can hold a compare result's high dword on one path and a loaded
number on another; the compiler only reads it where the number is live. The
join's mask side was "a lane mask read as data", which refused the program.
A pixel or vertex program now takes the mask's ballot as that incoming value
(counts and zero tests mean the same on any wave size). shortcut: the ballot
is the host wave's, so a join read some other way would differ from the console.

Offline corpus: "a lane mask read as data" 250 -> 212, vertex/pixel programs
emitted 12243 -> 12250; the other 31 move on to descriptor/scalar-memory
refusals. Synthetic wave64 pixel program fails before, lowers after.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The console compiler spills scalars, lane-mask pairs among them, with
v_writelane_b32 into constant lanes of a VGPR and restores them with
v_readlane_b32 of the same lane. The restored pair was an opaque mask, so
the selects, EXEC writes and joins that used it refused ("a select on an
untracked mask", "an opaque lane mask", "a lane-mask join of an untracked
mask"). structure now follows a constant-lane readlane back through a plain
chain of writelanes to the scalar written to that lane, and gives the
restored pair that scalar pair's mask. A chain with a phi or another write
of the VGPR stays opaque (shortcut noted in code).

Offline corpus, against fix/mask-phi-ballot (neither branch carries Marvisak#585):
vertex/pixel programs emitted 12250 -> 12269, compute 1443 -> 1452,
"a lane-mask join of an untracked mask" 20 -> 0, "an opaque lane mask"
29 -> 8, "a conditional export" 8 -> 0. Synthetic pixel program fails
before, lowers after. Stacked on fix/mask-phi-ballot (shares its test helper).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
v_cndmask_b32 and v_*_co_ci_u32 refused when their scalar mask was not one
structure followed (a plain SGPR number). In compute with console lanes the
lane now tests its own bit of the register (pair in wave64); inline 0 and -1
masks are constants. Taken from upstream PR Marvisak#585 (mask part only; its
descriptor-dimension hunk is left to the resource work).

Offline corpus (26148 programs): "a select on an untracked mask" 288 -> 0, no
new refusal text; those programs now stop at later refusals (descriptor read
as data +205, unknown stride +32, descriptor address/format +33), so compute
programs emitted only 1441 -> 1443. Synthetic test on hardware: fails before,
passes after. WARP cannot pin a wave size, so the test skips it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The first commit left a heap descriptor of no listed kind that a vector
buffer store or atomic also uses on the constant buffer path, which is a
CBV handle on the UAV the title made. Scalar loads through it now read a
raw UAV (11 | 0x1000), as Marvisak#1055 does for a table's UAV; read-only use
stays a raw SRV. The test's store case now expects no CBV handle.

In the title's shaders.rpf no program has this case (all 38,829 changed
loads are the read-only one); emit and validation counts are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tory into bundle/lane-masks-scalar-reads

# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
#	crates/victory-shader/src/emit/valu_tests.rs
…tory into bundle/lane-masks-scalar-reads

# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
… verified together

Merges Marvisak#1057 Marvisak#1073 Marvisak#1074 Marvisak#1084 Marvisak#953 Marvisak#1056 Marvisak#1015 Marvisak#1055 Marvisak#563 Marvisak#1004 onto main
(ffe310e), each head unchanged. Two merges needed a hand resolution:

- Marvisak#1015 + Marvisak#1055 (emit/lower.rs, the raw-view choice for a scalar buffer
  load of a descriptor): an SRV range reads a raw SRV view, a UAV range a
  raw UAV view, a descriptor of no listed kind the heap buffer view of Marvisak#1015.
  Both of their tests (emit/valu_tests.rs) are kept.
- Marvisak#563 + Marvisak#1004 (emit/lower.rs, cube sample refusal): Marvisak#563 lowers gradients
  and Marvisak#1004 the level query, so only texel coordinates are still refused.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(350 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 24, 2026 17:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@DeerSilver

Copy link
Copy Markdown

The NVIDIA side of the AMD run above. Tested head 643aef6 merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. Pass. No game files: the test suite only.

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings clean
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings clean
cargo test --workspace --locked 350 passed, 0 failed, 6 ignored (main: 342 / 6), the same totals as on the RX 6950 XT
  • The bundle's tests that dispatch ran on both the RTX 5060 (hardware) and WARP, and the log has no no SM 6.6 skip:
    • scalar_loads_read_a_root_srv_and_a_root_cbv (root_view_tests.rs)
    • v_cndmask_on_an_untracked_mask_tests_this_lanes_bit (valu_tests.rs)
    • scalar_buffer_loads_read_a_uav_through_its_table (valu_tests.rs)
  • The lowering tests pass too:
    • scalar_loads_through_a_heap_buffer_that_vector_accesses_use_read_a_buffer_view
    • s_buffer_load_descriptor_size_reads_as_data
    • cube_image_get_lod_lowers
    • a_scalar_joining_a_lane_mask_and_a_number_lowers_in_pixel_programs
    • a_lane_mask_spilled_to_a_vgpr_lane_stays_a_mask

So the ten PRs pass together on both AMD and NVIDIA. Like the AMD run, this says nothing about in-game effect.

AI-assisted (Claude Code).

MamaLeVrai added a commit to MamaLeVrai/VIctory that referenced this pull request Nov 24, 2026
…#1504, verified together

Merges Marvisak#1145 Marvisak#343 Marvisak#1042 Marvisak#1303 Marvisak#477 on top of the stack of Marvisak#1504 (Marvisak#1319,
Marvisak#1402, Marvisak#1492, Marvisak#1504, on main ffe310e), each head unchanged, no conflicts
and no changes of mine. cargo clippy --workspace --all-targets --locked
-- -D warnings, with and without --all-features, is clean and cargo test
--workspace --locked passes (406 passed, 6 ignored; main has 342 passed,
6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
MamaLeVrai added a commit to MamaLeVrai/VIctory that referenced this pull request Nov 24, 2026
…#1504, verified together

Merges Marvisak#1145 Marvisak#343 Marvisak#1042 Marvisak#1303 Marvisak#477 on top of the stack of Marvisak#1504 (Marvisak#1319,
Marvisak#1402, Marvisak#1492, Marvisak#1504, on main ffe310e), each head unchanged, no conflicts
and no changes of mine. cargo clippy --workspace --all-targets --locked
-- -D warnings, with and without --all-features, is clean and cargo test
--workspace --locked passes (406 passed, 6 ignored; main has 342 passed,
6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@MamaLeVrai

Copy link
Copy Markdown
Author

Thanks to DeerSilver for the RTX 5060 run (350 passed, the same totals as on the RX 6950 XT) and to sinan-cmyk for the offline measurement (+285 programs, 0 lost, and the walls the programs now stop at, which drove #1402 and #1504). The head is unchanged since those runs, 643aef6. AI-assisted (Claude Code); no game data.

@Bullet18x

Copy link
Copy Markdown
Contributor

NVIDIA RTX 5090 run of this bundle in the title, against main.

Machine: RTX 5090 32 GB, driver 621.40 (32.0.16.2114), Ryzen 9 9950X3D, 64 GB, Windows 11 Pro 10.0.28000.
Builds: main ffe310e and this bundle bundle/lane-masks-scalar-reads 643aef646, both cargo build --profile diag -p victory --features diagnostics, warm shader and pipeline caches.
Run: VICTORY_KEYS=8:Enter,20:Enter,35:Enter, VICTORY_D3D12_DRED=1, VICTORY_CAPTURE=<dir>, VICTORY_CAPTURE_FRAMES = every second frame 900–990, one run each.

main this bundle
shader does not translate warnings in the run 433 398 (−35)
Frames until DXGI_ERROR_DEVICE_HUNG ~966 ~932
World frames, 3D scene black black
  • Captured world frames (mean brightness of every frame from 900 on): only the 2D title cards and subtitles are drawn; the 3D scene behind them is black (mean ~0.3 / 255) on both builds until the hang, so the effect of the newly translated shaders cannot be seen on this card yet.
  • The bundle reached the world earlier (by frame ~900 vs ~960) and hung earlier; one run each, so not conclusive.
  • Offline census of all 26,148 programs (victory translate <dump>), main → this bundle:

The NVIDIA world hang itself is tracked in #1586 (what does not stop it on this machine).

No game data, captured frames or screenshots attached (asset policy). AI use: Claude Code (Claude Opus 5.5) built, ran and measured; I checked the results.

KainanP pushed a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…fied together

Merges Marvisak#156 Marvisak#162 Marvisak#168 Marvisak#169 Marvisak#368 Marvisak#379 Marvisak#456 Marvisak#587 Marvisak#990 Marvisak#1021 Marvisak#1048 Marvisak#1052 Marvisak#1053
Marvisak#1095 Marvisak#1142 Marvisak#1190 Marvisak#1211 Marvisak#1223 Marvisak#1259 Marvisak#1293 on top of the bundle of Marvisak#1402
(which is on Marvisak#1319, on main ffe310e), each head unchanged. Hunks that
conflicted in emit/lower.rs, emit/valu_tests.rs and emit/diff_tests.rs were
merged by keeping both sides (additions next to each other); a PR was kept
only if cargo clippy -p victory-shader --all-targets -- -D warnings still
passed with it. No instruction name is handled in two places.

Marvisak#98 is not in this version: an offline measurement on a retail dump showed
it loses 31 programs that validate on Marvisak#1402.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(381 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@MamaLeVrai

Copy link
Copy Markdown
Author

Bullet18x: thank you for the RTX 5090 run and for the offline census; the census (+294 emitted, 771 to 0 for "a scalar memory read as data") is what the bundle is for. One caution about what it measures: it is against main at ffe310e. main has since moved (28 commits of the maintainer's own, ffe310e..70564ae, among them lane masks, bounded root views and 64-bit image atomics), and on that main only 1 of this bundle's 10 PRs merges as it stands (the others conflict in the shader lowering), so this branch is not rebuilt yet and your numbers are for the earlier base.

AI-assisted (Claude Code); no game data.

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because this pull request re-packages other open pull requests. Each of those is reviewed on its own, so a bundle cannot be merged.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
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.