Shaders: pass undef for array slices in calculateLOD #156

Open
IAmTheSween wants to merge 1 commit from upstream-pr/156 into main
IAmTheSween commented 2026-11-25 16:13:05 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by IAmTheSween on 2026-11-25T15:37:47Z.


Fixes validator: Function: main: error: out of bound coord must be undef. on image_get_lod against array textures (e.g. SQ_RSRC_IMG_2D_ARRAY).

What is in it

  • In crates/victory-shader/src/emit/lower.rs, dx.op.calculateLOD.f32 only accepts spatial coordinates (1 for 1D / 1DArray, 2 for 2D / 2DArray, 3 for 3D) and requires unused coordinate slots to be undef, whereas cs[spatial] holds the array slice for kind 6 and 7. Pass fu (undef) for slots beyond spatial.
  • Added image_get_lod_array_leaves_slice_undef in crates/victory-shader/src/emit/mod.rs covering dim=4 (SQ_RSRC_IMG_1D_ARRAY) and dim=5 (SQ_RSRC_IMG_2D_ARRAY) with dxil.dll validation.

Tested

  • Windows 11 x64, NVIDIA GeForce RTX 5070, Windows SDK dxil.dll 10.0.26100.0:
    • cargo test -p victory-shader --locked --lib image_get_lod_array: 1 passed, 0 failed.
    • cargo clippy --workspace --all-targets --locked -- -D warnings: 0 warnings.
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: 0 warnings.
    • cargo test --workspace --locked -- --test-threads=1 (--test-threads=1 due to WARP contention documented in valu_tests.rs:198): 497 passed, 0 failed, 7 ignored (4 in victory_formats, 1 in victory_gpu, 2 in victory_shader).
    • victory --release translate --validate on shaders.rpf: 0 remaining out of bound coord must be undef. errors (cleared all 3 affected pixel programs -> 14048 validated of 14156 emitted VP programs, up from 14045 on main; also verified D3D12 PSO creation on #cc182397d5d326f9 and #d52fbc5975d0fa65).

AI use

Written with Antigravity.

<!-- greyfinch-sync:Zettrox/ztrx:issue:6608141626 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/156). Originally posted by [IAmTheSween](https://github.com/IAmTheSween) on 2026-11-25T15:37:47Z. --- Fixes `validator: Function: main: error: out of bound coord must be undef.` on `image_get_lod` against array textures (e.g. `SQ_RSRC_IMG_2D_ARRAY`). ### What is in it - In `crates/victory-shader/src/emit/lower.rs`, `dx.op.calculateLOD.f32` only accepts spatial coordinates (`1` for 1D / 1DArray, `2` for 2D / 2DArray, `3` for 3D) and requires unused coordinate slots to be `undef`, whereas `cs[spatial]` holds the array slice for `kind` 6 and 7. Pass `fu` (`undef`) for slots beyond `spatial`. - Added `image_get_lod_array_leaves_slice_undef` in `crates/victory-shader/src/emit/mod.rs` covering `dim=4` (`SQ_RSRC_IMG_1D_ARRAY`) and `dim=5` (`SQ_RSRC_IMG_2D_ARRAY`) with `dxil.dll` validation. ### Tested - Windows 11 x64, NVIDIA GeForce RTX 5070, Windows SDK `dxil.dll` `10.0.26100.0`: - `cargo test -p victory-shader --locked --lib image_get_lod_array`: 1 passed, 0 failed. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: 0 warnings. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: 0 warnings. - `cargo test --workspace --locked -- --test-threads=1` (`--test-threads=1` due to WARP contention documented in `valu_tests.rs:198`): 497 passed, 0 failed, 7 ignored (4 in `victory_formats`, 1 in `victory_gpu`, 2 in `victory_shader`). - `victory --release translate --validate` on `shaders.rpf`: 0 remaining `out of bound coord must be undef.` errors (cleared all 3 affected pixel programs -> `14048 validated` of `14156` emitted VP programs, up from `14045` on `main`; also verified D3D12 PSO creation on `#cc182397d5d326f9` and `#d52fbc5975d0fa65`). ### AI use Written with Antigravity.
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/156:upstream-pr/156'
git switch 'upstream-pr/156'

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/156'
git switch 'upstream-pr/156'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/156'
git switch 'upstream-pr/156'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/156'
git switch 'main'
git merge --squash 'upstream-pr/156'
git switch 'main'
git merge --ff-only 'upstream-pr/156'
git switch 'main'
git merge 'upstream-pr/156'
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
Zettrox/ztrx!156
No description provided.