Shaders: validate LOD queries across five texture shapes #235

Open
github-bot wants to merge 1 commit from github-bot/gh-235 into a-publier AGit
Owner

@⁠loyodea on GitHub · 2026-11-26 08:01 UTC · original
loyodea:victory-rx9070xt-array-lod → a-publier · +76 −1 · 1 files · 1 commits · open

Related to the array-slice report in #218. The current default branch already omits array slice coordinates from LOD queries via 41d3184. This PR keeps the original synthetic regression.

The fixture validates both LOD outputs for 1D, 2D, and 3D textures and for 1D and 2D arrays. Both the existing array test and the five-shape test passed using the Microsoft DXIL validator on a-publier at 4eb6cfdf.

The code diff is unchanged from the previous revision. This PR now targets a-publier, where #328 and #330 fixed the WARP depth-bounds fixture and Clippy errors that failed CI on rx9070xt. The fixture uses generated shader instructions. Codex contributed the test and verification.

**@⁠loyodea** on GitHub · 2026-11-26 08:01 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/235) `loyodea:victory-rx9070xt-array-lod` → `a-publier` · +76 −1 · 1 files · 1 commits · open Related to the array-slice report in #218. The current default branch already omits array slice coordinates from LOD queries via 41d3184. This PR keeps the original synthetic regression. The fixture validates both LOD outputs for 1D, 2D, and 3D textures and for 1D and 2D arrays. Both the existing array test and the five-shape test passed using the Microsoft DXIL validator on a-publier at 4eb6cfdf. The code diff is unchanged from the previous revision. This PR now targets a-publier, where #328 and #330 fixed the WARP depth-bounds fixture and Clippy errors that failed CI on rx9070xt. The fixture uses generated shader instructions. Codex contributed the test and verification.
Backport upstream commit fec4d026c8 by Claude to rx9070xt. Reuse the branch spatial dimension count and verify actual DXIL for five texture shapes. Related to #218.

Co-authored-by: Claude <[email protected]>
Co-authored-by: Codex <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:18:01 +00:00
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 16:19 UTC · original · reviewed

AI-assisted review. I inspected the LOD coordinate lowering and the added validator fixture statically; I did not run tests. This review suggests one additional texture-shape case.

**@⁠gut0to** on GitHub · 2026-11-26 16:19 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/235#pullrequestreview-6077442966) · **reviewed** AI-assisted review. I inspected the LOD coordinate lowering and the added validator fixture statically; I did not run tests. This review suggests one additional texture-shape case.
@ -11101,1 +11101,4 @@
let f32t = self.s.t.f32;
// DXIL takes only the spatial coordinates. Leave the array slice undef.
let mut lod_coords = [fu; 3];
lod_coords[..spatial].copy_from_slice(&cs[..spatial]);
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 16:19 UTC · original

AI-assisted review; I did not run tests. Could the validator fixture include a cube-array query as well? The current matrix covers 1D/2D arrays and 3D textures, but a cube-array carries a fourth array-slice coordinate alongside its three spatial direction coordinates. That case would directly verify that the slice stays undefined while all three spatial coordinates are preserved.

**@⁠gut0to** on GitHub · 2026-11-26 16:19 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/235#discussion_r4711018015) AI-assisted review; I did not run tests. Could the validator fixture include a cube-array query as well? The current matrix covers 1D/2D arrays and 3D textures, but a cube-array carries a fourth array-slice coordinate alongside its three spatial direction coordinates. That case would directly verify that the slice stays undefined while all three spatial coordinates are preserved.
@ -11101,1 +11101,4 @@
let f32t = self.s.t.f32;
// DXIL takes only the spatial coordinates. Leave the array slice undef.
let mut lod_coords = [fu; 3];
lod_coords[..spatial].copy_from_slice(&cs[..spatial]);
Author
Owner

@⁠loyodea on GitHub · 2026-11-26 18:53 UTC · original

Thanks for checking the texture shapes. GFX10 uses one cube selector and packs the cube-array slice into the face operand. This branch currently rejects cube LOD queries. DXIL calculateLOD takes three direction coordinates for both cubes and cube arrays, so a cube-array fixture here would first need cube LOD lowering. The current fixture covers the five supported shapes. AMD RDNA 2 ISA, table 43 · DXIL CalculateLOD

**@⁠loyodea** on GitHub · 2026-11-26 18:53 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/235#discussion_r4712404929) Thanks for checking the texture shapes. GFX10 uses one cube selector and packs the cube-array slice into the face operand. This branch currently rejects cube LOD queries. DXIL `calculateLOD` takes three direction coordinates for both cubes and cube arrays, so a cube-array fixture here would first need cube LOD lowering. The current fixture covers the five supported shapes. [AMD RDNA 2 ISA, table 43](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf#page=71) · [DXIL CalculateLOD](https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#calculatelod)
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 22:42 UTC · original

Checked by reading the code on rx9070xt cd8dfc0 (head 1e500d2); I did not build or run this PR.

  • cd8dfc0 already has the same fix in 41d3184 ("Shaders: a level query takes no array slice"). For op 81 only the spatial coordinates are read (crates/victory-shader/src/emit/lower.rs:11776-11782). cs starts undef (lower.rs:11763) and the call passes cs[0..3] (lower.rs:11815). The lod_coords copy here would be a no-op on that base.
  • The 1D array case is covered by the same code: dim 4 gives 2 coords with 1 spatial (lower.rs:11422, lower.rs:11750).
  • cd8dfc0 only tests the 2D array: a_level_query_of_an_array_takes_no_slice (emit/mod.rs:1209). Your five-shape fixture adds coverage for 1D, 2D, 3D and 1D array. It could stay as a test-only change rebased on cd8dfc0. texture_tables, Parts and S_ENDPGM are all there.
  • The branch still carries the old 81ebb7b. Merging it into cd8dfc0 conflicts in crates/victory-gpu/src/ambient.rs, host.rs and pipeline/make.rs. Commit 1e500d2 on its own applies to cd8dfc0's lower.rs without conflict.
  • a-publier has since moved to 4eb6cfd. None of those commits touch lower.rs or emit/mod.rs, so the above holds there too.
  • Separately, I ran a whole-archive translate --validate of cd8dfc0: 0 "out of bound coord" validator errors, and 14247 of 14247 vertex and pixel programs validated. That includes the three pixel programs named in 41d3184.

Not checked: building or running the fixture on cd8dfc0.

**@⁠adrianmjim** on GitHub · 2026-11-26 22:42 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/235#issuecomment-7204919411) Checked by reading the code on rx9070xt cd8dfc0 (head 1e500d2); I did not build or run this PR. - cd8dfc0 already has the same fix in 41d3184 ("Shaders: a level query takes no array slice"). For op 81 only the spatial coordinates are read (`crates/victory-shader/src/emit/lower.rs:11776-11782`). `cs` starts undef (`lower.rs:11763`) and the call passes `cs[0..3]` (`lower.rs:11815`). The `lod_coords` copy here would be a no-op on that base. - The 1D array case is covered by the same code: dim 4 gives 2 coords with 1 spatial (`lower.rs:11422`, `lower.rs:11750`). - cd8dfc0 only tests the 2D array: `a_level_query_of_an_array_takes_no_slice` (`emit/mod.rs:1209`). Your five-shape fixture adds coverage for 1D, 2D, 3D and 1D array. It could stay as a test-only change rebased on cd8dfc0. `texture_tables`, `Parts` and `S_ENDPGM` are all there. - The branch still carries the old 81ebb7b. Merging it into cd8dfc0 conflicts in `crates/victory-gpu/src/ambient.rs`, `host.rs` and `pipeline/make.rs`. Commit 1e500d2 on its own applies to cd8dfc0's `lower.rs` without conflict. - a-publier has since moved to 4eb6cfd. None of those commits touch `lower.rs` or `emit/mod.rs`, so the above holds there too. - Separately, I ran a whole-archive `translate --validate` of cd8dfc0: 0 "out of bound coord" validator errors, and 14247 of 14247 vertex and pixel programs validated. That includes the three pixel programs named in 41d3184. Not checked: building or running the fixture on cd8dfc0.
github-bot changed title from Shaders: leave array slices undefined in LOD queries to Shaders: validate LOD queries across five texture shapes 2026-11-27 01:33:48 +00:00
github-bot changed target branch from rx9070xt to a-publier 2026-11-27 01:33:49 +00:00
github-bot force-pushed github-bot/gh-235 from 1e500d25d8 to fcfd790c32 2026-11-27 01:33:49 +00:00 Compare
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/235/head:github-bot/gh-235'
git switch 'github-bot/gh-235'

Merge

Merge the changes and update on Forgejo.
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-235'
git switch 'github-bot/gh-235'
git rebase 'a-publier'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-235'
git switch 'github-bot/gh-235'
git rebase 'a-publier'
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-235'
git switch 'a-publier'
git merge --squash 'github-bot/gh-235'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-235'
git switch 'a-publier'
git merge 'github-bot/gh-235'
git push origin 'a-publier'
This discussion has been locked. Commenting is limited to contributors.
No description provided.