image_get_lod on array textures passes the slice as a LOD coordinate #74

Closed
opened 2026-11-26 03:31:46 +00:00 by github-bot · 2 comments
Owner

@⁠j-fuxa on GitHub · 2026-11-26 01:40 UTC · original

Where. crates/victory-shader/src/emit/lower.rs, image sample lowering, the op == 81 arm (image_get_lod). It calls calculateLOD with [h, sh, cs[0], cs[1], cs[2], clamped], where cs holds every address coordinate. For dim 4 and 5 (1-D and 2-D arrays, kind 6 and 7) the last coordinate is the array slice, so it lands in a coordinate slot of the LOD query. DXIL's LOD query has no slice, and the validator requires unused coordinates to be undef ("out of bound coord must be undef").

Evidence. In our tree (same lineage) three pixel programs, G-buffer alpha-clip passes, failed validation for exactly this reason. Passing undef for the slice slot (cs[2] for a 2-D array, cs[1] for a 1-D array) made all three translate. We did not run your tree: this is from reading 0a435665, and something earlier in the path may already replace the slot; we did not see it.

Why it matters. A pixel program that does not translate has its draws dropped (pipeline.rs: "shader does not translate; its pipelines' draws are dropped"), so alpha-clipped surfaces using it would be missing, with that warning as the only trace.

Suggested fix. Build the coordinate list of op 81 from the spatial coordinates only and give every slot from spatial on the undef value fu. A validator test next to cube_lod_tests.rs with a 2-D array image_get_lod would pin it.

Not checked for your tree, for comparison only. Two other families refused in ours; your victory shaders reason list would show them if they refuse here. (1) Deferred pixel programs with unrolled light-list loops, refused as "a lane mask read as data": proving the joined mask unread through later joins translated 254 programs with no wave op emitted. (2) Vehicle-livery pixel programs where a guarded write in a waterfall loop keeps a dead v_interp_p1ll_f16 result in the register ("the first half of an interpolation"): giving that half its hardware value P0 + i*(P1-P0) through SV_Barycentrics translated all 20. Your with_first_half_pairs retry may already cover (2).

**@⁠j-fuxa** on GitHub · 2026-11-26 01:40 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/74) **Where.** `crates/victory-shader/src/emit/lower.rs`, image sample lowering, the `op == 81` arm (`image_get_lod`). It calls `calculateLOD` with `[h, sh, cs[0], cs[1], cs[2], clamped]`, where `cs` holds every address coordinate. For `dim` 4 and 5 (1-D and 2-D arrays, `kind` 6 and 7) the last coordinate is the array slice, so it lands in a coordinate slot of the LOD query. DXIL's LOD query has no slice, and the validator requires unused coordinates to be undef ("out of bound coord must be undef"). **Evidence.** In our tree (same lineage) three pixel programs, G-buffer alpha-clip passes, failed validation for exactly this reason. Passing undef for the slice slot (`cs[2]` for a 2-D array, `cs[1]` for a 1-D array) made all three translate. We did not run your tree: this is from reading `0a435665`, and something earlier in the path may already replace the slot; we did not see it. **Why it matters.** A pixel program that does not translate has its draws dropped (`pipeline.rs`: "shader does not translate; its pipelines' draws are dropped"), so alpha-clipped surfaces using it would be missing, with that warning as the only trace. **Suggested fix.** Build the coordinate list of op 81 from the `spatial` coordinates only and give every slot from `spatial` on the undef value `fu`. A validator test next to `cube_lod_tests.rs` with a 2-D array `image_get_lod` would pin it. **Not checked for your tree, for comparison only.** Two other families refused in ours; your `victory shaders` reason list would show them if they refuse here. (1) Deferred pixel programs with unrolled light-list loops, refused as "a lane mask read as data": proving the joined mask unread through later joins translated 254 programs with no wave op emitted. (2) Vehicle-livery pixel programs where a guarded write in a waterfall loop keeps a dead `v_interp_p1ll_f16` result in the register ("the first half of an interpolation"): giving that half its hardware value `P0 + i*(P1-P0)` through `SV_Barycentrics` translated all 20. Your `with_first_half_pairs` retry may already cover (2).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:31:46 +00:00
Author
Owner

@⁠BE29ZZ on GitHub · 2026-11-26 01:46 UTC · original

Are you still struggling with this error? Would you like me to help?

**@⁠BE29ZZ** on GitHub · 2026-11-26 01:46 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/74#issuecomment-7180110822) Are you still struggling with this error? Would you like me to help?
github-bot 2026-11-26 07:36:21 +00:00
Author
Owner

@⁠avatarmanz on GitHub · 2026-11-26 07:31 UTC · original

Fixed on main by 41d3184e: image_get_lod no longer passes the array slice as a coordinate.

**@⁠avatarmanz** on GitHub · 2026-11-26 07:31 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/74#issuecomment-7185556410) Fixed on main by 41d3184e: image_get_lod no longer passes the array slice as a coordinate.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/avatarmanz--VIctory-7900XTX#74
No description provided.