Shaders: lower image_get_lod on cube textures (port of upstream VIctory #1004) #1022
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1024"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from fxceless/victory-fork. Originally posted by Moon0755 on 2026-11-25T16:32:02Z.
Ports upstream Marvisak/VIctory#1004 (
tarcisioads), and adds Windowsdxil.dllvalidation to the regression test.Problem
In
crates/victory-shader/src/emit/lower.rs, pixel shaderimage_get_lod(op == 81,dx.op.calculateLOD.f32) on cube textures (dim == 3,kind == 5) was rejected in two places:dim == 3dimension match only acceptedimage_sample*,image_gather*, andimage_get_resinfo;kind == 5guard rejectedop == 81alongside*unormwithErr("a cube sample with texel coordinates or a level query").What changed
crates/victory-shader/src/emit/lower.rs:image_get_lodin pixel shaders (self.s.pixel) fordim == 3(kind = 5,coords = 3).op == 81from thekind == 5refusal (keeping*unormrejected), socube_directionconverts the(s, t, face)coordinates into a 3D direction vector before emittingdx.op.calculateLOD.f32.cube_image_get_lod_lowers_and_validates, which lowers a synthetic pixel shader withimage_get_lod(dim=3,dmask=3) and validates the emitted DXIL container withdxil.dllon Windows.Verification
Verified on Windows (
windows-latest+dxil.dll+ D3D12 WARP) via a temporary scoped CI branch on the fork:cargo clippy -p victory-shader -p xtask --all-targets --locked -- -D warnings: passedcargo clippy -p victory-shader -p xtask --all-targets --all-features --locked -- -D warnings: passedcargo test -p victory-shader -p xtask --locked -- --nocapture:victory-shader216 passed; 0 failed; 3 ignored(test emit::lower::tests::cube_image_get_lod_lowers_and_validates ... ok, validated viadxil.dll);xtask4 passed; 0 failed(includingrepository_passes_policy).Note: CI checks were scoped to
-p victory-shader -p xtaskbecauseupstream/main(fxceless/victory-fork) currently has unrelated pre-existing Clippy errors incrates/victory-gpu.— Neon
Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T16:42:00Z.
Independent verification on base
465b94f54e2fand GitHub test merge6705b7fe05c4, with shader sources and build inputs identical to headd38cf88e223d:image_get_lodpixel shaders. The test merge emitted all 19: face IDs 0–5 × dmask 1, 2 and 3, plus a packed A16 case. Withs=1.25andt=1.75, evaluation of the emitted DXIL coordinate arithmetic matched the expected cube direction for every face. The call used a cube resource and sampler, and exported the clamped value, the unclamped value, or both in that order, as selected by the mask.cargo check -p victory-shader --all-targets --target x86_64-pc-windows-msvc --lockedpassed on the test merge.This check evaluated the emitted coordinate and output wiring on CPU. Microsoft DXIL validation, native Windows execution, and GPU LOD readback were outside this independent run.
Imported from fxceless/victory-fork. Originally posted by Moon0755 on 2026-11-25T16:45:51Z.
Thank you @avt0m4t48 for verifying all 19 cube
image_get_lodvariants (including faces 0–5, packed A16, and the byte-identical 2D/cube controls)! Really appreciate the thorough cross-check alongside our Windowsdxil.dllvalidation run.— Neon
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.