Prevent scalar buffer-load components wrapping to the view's start #4046

Closed
masteraapjes wants to merge 2 commits from upstream-pr/4046 into main
masteraapjes commented 2026-11-30 15:07:28 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by masteraapjes on 2026-11-30T15:07:28Z.


What it changes

A heap-picked s_buffer_load_dwordx2 at 0xffff_fffc can wrap a later component to the view’s first dword; WIDE x8/x16 chunks can wrap similarly. Select zero when a later component/chunk address is unsigned-less-than the original address. Preserve first-component behavior, scalar/WIDE grouping, descriptor routing and #3894 alignment. Classify the synthetic test-only environment flag in the cache-key audit.

Rebuilt independently on upstream main 5fabb46eaf6ed8771321787f8871051abde69b9b to resolve the conflict after upstream history changed. Obsolete shared CI commits have been removed from the PR diff. Current upstream changes are retained.

How it was tested

Windows, pinned Rust 1.98.1. Tested head: 7fa2c645ca1730b8041b480b05553bf4ac2a6da9.

  • cargo test --locked -p victory-shader --lib emit::size_tests::picked_scalar_component_boundary_shaders_validate_without_device -- --exact --nocapture: 1 passed, covering eight authored shader programs.
  • cargo test --locked -p victory-gpu --lib shader_cache::tests::every_switch_of_the_translator_is_in_the_key -- --exact --nocapture: 1 passed.
  • Scoped strict shader Clippy passed with default and all features:
    • cargo clippy --locked --jobs 2 -p victory-shader --all-targets -- -D warnings
    • cargo clippy --locked --jobs 2 -p victory-shader --all-targets --all-features -- -D warnings
  • cargo run --locked --package xtask -- policy: 464 files passed. git diff --check passed.

Current upstream CI blocker, independently reproduced on unmodified main 5fabb46e: both cargo clippy --workspace --all-targets --locked -- -D warnings and cargo clippy --workspace --all-targets --all-features --locked -- -D warnings exit 101 with five errors in host/font.rs:213/260, host/menu.rs:667 and host/panel.rs:602/668. Existing #4679 addresses these. No unrelated fixes or lint suppressions are carried here. This is not a claim that the latest CI check job passed.

CPU-only DXIL translation/validation and cache-key auditing were rerun. No fresh GPU dispatch, wave64 or gameplay result is claimed. This is a heap-selected scalar/raw-chunk fix, not a general VMEM bounds rewrite. The full workspace test suite was not rerun for this conflict-resolution update. No game data is included.

Checked for overlap

  • Rechecked current main and targeted open-PR searches alongside the earlier overlap review. Related #3501 refactors heap-picked scalar loads without guarding this overflow. #3894 supplies retained alignment; #3919 tests a dword carry rather than 32-bit component overflow.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5567904555 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4046). Originally posted by [masteraapjes](https://github.com/masteraapjes) on 2026-11-30T15:07:28Z. --- ## What it changes A heap-picked `s_buffer_load_dwordx2` at `0xffff_fffc` can wrap a later component to the view’s first dword; WIDE x8/x16 chunks can wrap similarly. Select zero when a later component/chunk address is unsigned-less-than the original address. Preserve first-component behavior, scalar/WIDE grouping, descriptor routing and #3894 alignment. Classify the synthetic test-only environment flag in the cache-key audit. Rebuilt independently on upstream main `5fabb46eaf6ed8771321787f8871051abde69b9b` to resolve the conflict after upstream history changed. Obsolete shared CI commits have been removed from the PR diff. Current upstream changes are retained. ## How it was tested Windows, pinned Rust 1.98.1. Tested head: `7fa2c645ca1730b8041b480b05553bf4ac2a6da9`. - `cargo test --locked -p victory-shader --lib emit::size_tests::picked_scalar_component_boundary_shaders_validate_without_device -- --exact --nocapture`: 1 passed, covering eight authored shader programs. - `cargo test --locked -p victory-gpu --lib shader_cache::tests::every_switch_of_the_translator_is_in_the_key -- --exact --nocapture`: 1 passed. - Scoped strict shader Clippy passed with default and all features: - `cargo clippy --locked --jobs 2 -p victory-shader --all-targets -- -D warnings` - `cargo clippy --locked --jobs 2 -p victory-shader --all-targets --all-features -- -D warnings` - `cargo run --locked --package xtask -- policy`: 464 files passed. `git diff --check` passed. Current upstream CI blocker, independently reproduced on unmodified main `5fabb46e`: both `cargo clippy --workspace --all-targets --locked -- -D warnings` and `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` exit 101 with five errors in `host/font.rs:213/260`, `host/menu.rs:667` and `host/panel.rs:602/668`. Existing [#4679](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4679) addresses these. No unrelated fixes or lint suppressions are carried here. This is not a claim that the latest CI `check` job passed. CPU-only DXIL translation/validation and cache-key auditing were rerun. No fresh GPU dispatch, wave64 or gameplay result is claimed. This is a heap-selected scalar/raw-chunk fix, not a general VMEM bounds rewrite. The full workspace test suite was not rerun for this conflict-resolution update. No game data is included. ## Checked for overlap - [x] Rechecked current main and targeted open-PR searches alongside the earlier overlap review. Related #3501 refactors heap-picked scalar loads without guarding this overflow. #3894 supplies retained alignment; #3919 tests a dword carry rather than 32-bit component overflow.
VibeCodeGuy commented 2026-11-30 22:39:04 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by VibeCodeGuy on 2026-11-30T22:39:04Z.


Offline corpus check (every shader container in a v1.0.2.1 dump: 25,699 unique programs), main e1251c31 against main + this PR at 42233939.

  • Newly failing: 0. Newly passing: 0.
  • DXIL output changed: 50 programs (47 Cs, 3 Ps); 50 of them pass the validator.
The 50 changed programs
  • 01250e3bd6a6fb99 Ps FSwatchPresetCxform
  • 0c995954a3497528 Ps FSwatchPreset
  • 1ab9a55b284ff72c Ps PS_PreviewSwatchPreset
  • 952fd529dd779b27 Cs bvh_skinning:CSUnpackIB_CCW
  • 1a77e876755eff12 Cs bvh_skinning:CSUnpackIB
  • 4fb416369fc50b6e Cs meshlet_culling:CS_BatchCullBatchCSMeshlets
  • 104640cfaf62c06c Cs meshlet_culling:CS_BatchCullBatchCSMeshlets_Prev
  • 3b471c122be79b3e Cs meshlet_culling:CS_BatchCullMeshlets
  • 764ca63daec9c616 Cs meshlet_culling:CS_BatchCullMeshlets_ParaboloidShadows
  • e8dae012dd07a9ba Cs meshlet_culling:CS_BatchCullMeshlets_ParaboloidShadows_Prev
  • fc5e66f8f873d3bb Cs meshlet_culling:CS_BatchCullMeshlets_Prev
  • c00c13b91c2a72c5 Cs meshlet_culling:CS_BatchCullPreSkinnedMeshlets_ParaboloidShadows_Prev
  • 87bf9e3f2bf2f052 Cs meshlet_culling:CS_BatchCullPreSkinnedMeshlets_ParaboloidShadows
  • 0452fc2d2e2fc4c3 Cs meshlet_culling:CS_BatchCullPreSkinnedMeshlets_Prev
  • 9f017d9011377efa Cs meshlet_culling:CS_BatchCullPreSkinnedMeshlets
  • c7a507806ab10911 Cs ped_skinning_cs:CS_GenWorldAabbs
  • 1459863b79e1c6c1 Cs ped_standard_face_mask:CS_RaytracingResolve
  • 41819a1d0f885f45 Cs ped_standard_face_mask:CS_RaytracingResolve
  • a73284b60aa303ed Cs ped_standard_head:CS_RaytracingResolve
  • a1266cc7391ae0d6 Cs ped_standard_head:CS_RaytracingResolve
  • 4e69dc8770bf27fc Cs ped_standard_lod_head:CS_RaytracingResolve
  • 203f78efece5bbdf Cs ped_standard_lod_head:CS_RaytracingResolve
  • f018c205b5199d39 Cs ped_standard_lod_skin:CS_RaytracingResolve
  • 52ab310c43b9f99c Cs ped_standard_lod_skin:CS_RaytracingResolve
  • 0ae69044bfd15035 Cs ped_standard_skin:CS_RaytracingResolve
  • 3fa1fda35402c93f Cs ped_standard_skin:CS_RaytracingResolve
  • be85f65a58656cec Cs ped_standard_skin_tattoo_bake:CS_RaytracingResolve
  • 36bcbae3c6ee20b3 Cs ped_standard_skin_tattoo_bake:CS_RaytracingResolve
  • 58b1400a40af4738 Cs smh_gen_104:CS_InterpolateStrands
  • 07fdf30955c4abbc Cs smh_gen_136:CS_InterpolateStrands
  • c4f1becd11afec3e Cs smh_gen_168:CS_InterpolateStrands
  • 142831c820dca7a3 Cs smh_gen_200:CS_InterpolateStrands
  • b63e7606ee1302fa Cs smh_gen_232:CS_InterpolateStrands
  • 8c970301dd4eee4f Cs smh_gen_264:CS_InterpolateStrands
  • e4688ae9d52294f8 Cs smh_gen_296:CS_InterpolateStrands
  • e7c9e7210ffff1fc Cs smh_gen_328:CS_InterpolateStrands
  • 029dfbaa64951060 Cs smh_gen_360:CS_InterpolateStrands
  • 35813c04e939bc21 Cs smh_gen_392:CS_InterpolateStrands
  • bd0dfdfb50657f60 Cs smh_gen_40:CS_InterpolateStrands
  • 9ac37ee176bd2353 Cs smh_gen_424:CS_InterpolateStrands
  • 234d47be72397f85 Cs smh_gen_456:CS_InterpolateStrands
  • 9267f0cfc6452000 Cs smh_gen_488:CS_InterpolateStrands
  • ebce8db62fe43ed9 Cs smh_gen_72:CS_InterpolateStrands
  • e6b1160ee45c1666 Cs smh_gen_8:CS_InterpolateStrands
  • 526c84818961beb6 Cs sr_tracing:CS_RaytraceVBuffer_Voxels
  • 697f2629f7dc5be0 Cs sr_tracing:CS_RaytraceVBuffer_Voxels_RayBinning
  • ffa3a7645374474b Cs vfx_proj_decal_trail:CS_SpawnLiquidTrail_SampleDecalRaycastTriangleTest
  • 98fef92f7a6d825e Cs vfx_proj_decal_trail:CS_SpawnLiquidTrail_SampleDecalRaycastTriangleTest_Nodes
  • aeac9d880daff3ba Cs vfx_proj_decal_trail:CS_UpdateProjDecalTrailAttachment
  • a09f0c1fae2b5ca3 Cs vfx_proj_decal_trail:CS_UpdateProjDecalTrailAttachment_Nodes

How: victory translate <dump> --validate --list built for each side (release, cross-built with cargo-xwin, run under Wine), VICTORY_HOST_WAVE=32, plus the four shader-cache-key settings play starts with (VICTORY_EARLY_DEPTH=1, VICTORY_NAN_SCRUB=1, VICTORY_BVH_MISS=1, VICTORY_SAMPLED_MARKS=1). Validator: dxil.dll from DXC v1.9.2609. "Changed" compares translate's emitted hash of each module and its bindings. There was no GPU on this side, so no host pipelines were made and nothing was run on a card. On main the same run has 72 failures: 71 mesh programs over the 32 KiB output limit (the known shortcut in mesh_prologue) and CS_TraceShadowRays_FullAdaptive (#2993).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294126205 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4046#issuecomment-7294126205). Originally posted by [VibeCodeGuy](https://github.com/VibeCodeGuy) on 2026-11-30T22:39:04Z. --- **Offline corpus check** (every shader container in a v1.0.2.1 dump: 25,699 unique programs), `main` e1251c31 against `main` + this PR at 42233939. - Newly failing: **0**. Newly passing: **0**. - DXIL output changed: **50** programs (47 Cs, 3 Ps); 50 of them pass the validator. <details><summary>The 50 changed programs</summary> - `01250e3bd6a6fb99` Ps `FSwatchPresetCxform` - `0c995954a3497528` Ps `FSwatchPreset` - `1ab9a55b284ff72c` Ps `PS_PreviewSwatchPreset` - `952fd529dd779b27` Cs `bvh_skinning:CSUnpackIB_CCW` - `1a77e876755eff12` Cs `bvh_skinning:CSUnpackIB` - `4fb416369fc50b6e` Cs `meshlet_culling:CS_BatchCullBatchCSMeshlets` - `104640cfaf62c06c` Cs `meshlet_culling:CS_BatchCullBatchCSMeshlets_Prev` - `3b471c122be79b3e` Cs `meshlet_culling:CS_BatchCullMeshlets` - `764ca63daec9c616` Cs `meshlet_culling:CS_BatchCullMeshlets_ParaboloidShadows` - `e8dae012dd07a9ba` Cs `meshlet_culling:CS_BatchCullMeshlets_ParaboloidShadows_Prev` - `fc5e66f8f873d3bb` Cs `meshlet_culling:CS_BatchCullMeshlets_Prev` - `c00c13b91c2a72c5` Cs `meshlet_culling:CS_BatchCullPreSkinnedMeshlets_ParaboloidShadows_Prev` - `87bf9e3f2bf2f052` Cs `meshlet_culling:CS_BatchCullPreSkinnedMeshlets_ParaboloidShadows` - `0452fc2d2e2fc4c3` Cs `meshlet_culling:CS_BatchCullPreSkinnedMeshlets_Prev` - `9f017d9011377efa` Cs `meshlet_culling:CS_BatchCullPreSkinnedMeshlets` - `c7a507806ab10911` Cs `ped_skinning_cs:CS_GenWorldAabbs` - `1459863b79e1c6c1` Cs `ped_standard_face_mask:CS_RaytracingResolve` - `41819a1d0f885f45` Cs `ped_standard_face_mask:CS_RaytracingResolve` - `a73284b60aa303ed` Cs `ped_standard_head:CS_RaytracingResolve` - `a1266cc7391ae0d6` Cs `ped_standard_head:CS_RaytracingResolve` - `4e69dc8770bf27fc` Cs `ped_standard_lod_head:CS_RaytracingResolve` - `203f78efece5bbdf` Cs `ped_standard_lod_head:CS_RaytracingResolve` - `f018c205b5199d39` Cs `ped_standard_lod_skin:CS_RaytracingResolve` - `52ab310c43b9f99c` Cs `ped_standard_lod_skin:CS_RaytracingResolve` - `0ae69044bfd15035` Cs `ped_standard_skin:CS_RaytracingResolve` - `3fa1fda35402c93f` Cs `ped_standard_skin:CS_RaytracingResolve` - `be85f65a58656cec` Cs `ped_standard_skin_tattoo_bake:CS_RaytracingResolve` - `36bcbae3c6ee20b3` Cs `ped_standard_skin_tattoo_bake:CS_RaytracingResolve` - `58b1400a40af4738` Cs `smh_gen_104:CS_InterpolateStrands` - `07fdf30955c4abbc` Cs `smh_gen_136:CS_InterpolateStrands` - `c4f1becd11afec3e` Cs `smh_gen_168:CS_InterpolateStrands` - `142831c820dca7a3` Cs `smh_gen_200:CS_InterpolateStrands` - `b63e7606ee1302fa` Cs `smh_gen_232:CS_InterpolateStrands` - `8c970301dd4eee4f` Cs `smh_gen_264:CS_InterpolateStrands` - `e4688ae9d52294f8` Cs `smh_gen_296:CS_InterpolateStrands` - `e7c9e7210ffff1fc` Cs `smh_gen_328:CS_InterpolateStrands` - `029dfbaa64951060` Cs `smh_gen_360:CS_InterpolateStrands` - `35813c04e939bc21` Cs `smh_gen_392:CS_InterpolateStrands` - `bd0dfdfb50657f60` Cs `smh_gen_40:CS_InterpolateStrands` - `9ac37ee176bd2353` Cs `smh_gen_424:CS_InterpolateStrands` - `234d47be72397f85` Cs `smh_gen_456:CS_InterpolateStrands` - `9267f0cfc6452000` Cs `smh_gen_488:CS_InterpolateStrands` - `ebce8db62fe43ed9` Cs `smh_gen_72:CS_InterpolateStrands` - `e6b1160ee45c1666` Cs `smh_gen_8:CS_InterpolateStrands` - `526c84818961beb6` Cs `sr_tracing:CS_RaytraceVBuffer_Voxels` - `697f2629f7dc5be0` Cs `sr_tracing:CS_RaytraceVBuffer_Voxels_RayBinning` - `ffa3a7645374474b` Cs `vfx_proj_decal_trail:CS_SpawnLiquidTrail_SampleDecalRaycastTriangleTest` - `98fef92f7a6d825e` Cs `vfx_proj_decal_trail:CS_SpawnLiquidTrail_SampleDecalRaycastTriangleTest_Nodes` - `aeac9d880daff3ba` Cs `vfx_proj_decal_trail:CS_UpdateProjDecalTrailAttachment` - `a09f0c1fae2b5ca3` Cs `vfx_proj_decal_trail:CS_UpdateProjDecalTrailAttachment_Nodes` </details> How: `victory translate <dump> --validate --list` built for each side (release, cross-built with cargo-xwin, run under Wine), `VICTORY_HOST_WAVE=32`, plus the four shader-cache-key settings `play` starts with (`VICTORY_EARLY_DEPTH=1`, `VICTORY_NAN_SCRUB=1`, `VICTORY_BVH_MISS=1`, `VICTORY_SAMPLED_MARKS=1`). Validator: `dxil.dll` from DXC v1.9.2609. "Changed" compares translate's `emitted` hash of each module and its bindings. There was no GPU on this side, so no host pipelines were made and nothing was run on a card. On `main` the same run has 72 failures: 71 mesh programs over the 32 KiB output limit (the known shortcut in `mesh_prologue`) and `CS_TraceShadowRays_FullAdaptive` (#2993).
trustno1-coder commented 2026-12-01 18:46:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:46:49Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321529489 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4046#issuecomment-7321529489). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:46:49Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

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
trustno1-coder/VIctory-NVIDIA!4046
No description provided.