Shaders respect the minimum LOD of biased cubemap gradient samples #3523
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3523
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3523"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-27 13:41 UTC · original
andrewpozdnakov7-jpg:codex2/cube-gradient-min-lod-bias→main· +157 −30 · 2 files · 1 commits · openCubemap
image_sample_d_clfolds its explicit minimum into an LOD forSampleLevel. The host then applies the sampler bias, which can move the sample below its minimum or push it to a blurrier mip.Use
SampleGradfor clamped cubemap gradient samples. Convert the two face-space derivatives into the tangent vectors expected by D3D12 using the existing cube-face transform. This lets the host apply sampler bias and then enforce the explicit minimum LOD. D3D12 SampleGrad clamp · Cube derivative projectionA synthetic GFX10 shader samples all six faces at both centered and off-center coordinates. A trilinear cube encodes its selected mip in the readback. The same test fails on
mainand passes with the change. For an unbiased LOD of3and an explicit minimum of3.5:The test checks 3,456 samples, including the unclamped control and zero bias. The bias/clamp matrix ran on app-local WARP 1.0.22 with Agility 1.620.2. Physical GPU behavior and in-game impact remain to be measured. The tangent conversion builds on the approach discussed in #563 and #1280. Coordination comment
36 VALU tests and 33 lowering tests passed. Shader Clippy passed with warnings denied in default and all-feature builds. The asset policy check passed.
Please retain the original Git author when cherry-picking or rebasing this commit. If folding it into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>. AI-assisted.@andrewpozdnakov7-jpg on GitHub · 2026-11-27 13:44 UTC · original
GitHub CI passed on
f9fe970f6c4123a1daca3bc343d8d91761927b8c, including both Clippy configurations and the workspace tests. Exact-head Windows CIA physical-adapter check would complement the app-local WARP readback. The focused command is
cargo test --locked -p victory-shader --lib emit::valu_tests::cube_gradient_lod_bias_precedes_explicit_min_lod -- --exact --test-threads=1. LeaveVICTORY_WARPunset to include the physical adapter. The fixture is synthetic and checks both bias signs across all six faces.@andrewpozdnakov7-jpg on GitHub · 2026-11-27 14:03 UTC · original
I combined
f9fe970with the earlier #1256/#2372 cube-array and packed-gradient work on63bcca4. Tested branch 378a316 keeps the original commits. The cube direction and its tangent derivatives now use the same decoded face. The array slice is passed as a coordinate to SampleGrad. TextureCubeArray SampleGradThe new synthetic cube-array fixture exercises layer 1, ordinary face 2 and encoded face 7 (mapped to face 5), both bias signs, and all four combinations of
a16and_g16. On the earlier integration102b5c2, the first +1-bias case returned 85.072914 where the face/mip tag should be 84. The new branch matches all 512 per-lane values on app-local WARP 1.0.22. It also passes the original six-face #3523 fixture, all 12 cube tests and all 49 VALU tests with DXIL validation. Strict shader Clippy and asset policy passed.If folding the integration or its test into another commit, please retain Git authorship or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex. Synthetic texture and shader data only.
@oni-swr on GitHub · 2026-11-27 14:17 UTC · original
Independent verification of
f9fe970f(base63bcca4), claimed in #1633. WARP + CPU only.Environment: AMD Ryzen 7 5700X3D, Windows 11 25H2 build 10.0.26200.9974, rustc 1.98.1,
VICTORY_WARP=1+VICTORY_D3D12_WARP=1, system WARPd3d10warp.dll10.0.26100.9818 (not the app-local 1.0.22 from the PR body),VICTORY_DXIL= Windows SDK 10.0.26100.0 x64dxil.dll1.8.2502.11. No physical GPU.Trees: base =
63bcca4; head =f9fe970f(unchanged when I posted).New test
emit::valu_tests::cube_gradient_lod_bias_precedes_explicit_min_lod(--test-threads=1):valu_tests.rscopied in: FAILED (panics at valu_tests.rs:2014). So it fails on main, as the PR says.victory-shader lib suite (
cargo test -p victory-shader --lib --no-fail-fast -- --test-threads=1):synthetic_tests::a_mask_joined_with_data_at_a_uniform_loop_is_its_number,gathers_at_a_level_match_the_hardware,permutes_mask_high_address_bits_and_divergent_branches,permutes_read_the_lane_named_and_zero_from_lanes_left_out. The +1 passed on head is the new test.Diff read:
cube_faceis captured beforecs[..3]is overwritten by the direction, so the face index used for the gradient projection is the right one. Unclampedimage_sample_don a cube keeps the old isotropic-LOD path; the clamped (_cl) form now goes throughSampleGradso the host applies bias before the min-LOD clamp. Nothing wrong found; I did not check the physical-GPU result.AI-assisted: Claude Code, Claude Sonnet 5.5.
@oddmaniv on GitHub · 2026-11-27 16:35 UTC · original
Independent verification of the PR author's shader-package parser tests at
f9fe970f6c4123a1daca3bc343d8d91761927b8c.cargo test --locked -p victory-game --lib shaderpack::tests -- --nocaptureMain baseline pin:
63bcca43c6a00a758510398fa43096ce7e4f7df0.Windows x86_64 MSVC native runs. Local and remote source snapshots matched before and after each check. The adaptation applies the PR diff without additional source edits.
This is focused regression coverage, not the full workspace suite, a gameplay test, or an independent validation of every behavior in the PR. No new fix is claimed.
AI-assisted verification.
@kilolimaVI on GitHub · 2026-11-27 16:35 UTC · original · reviewed
Verified on AMD hardware, head
f9fe970: Windows 11, Radeon 780M (RDNA3 iGPU), toolchain 1.98.1.cube_gradient_lod_bias_precedes_explicit_min_lod(hardware + WARP in one run): passes, 0/20 failures over 20 runs.lower.rsrestored: fails on the 780M as expected,warp false, face 0, bias 1, lane 0, sample 2: 4.5 vs 4(clamp 3.5 applied before the +1 bias), so the test catches the old ordering on RDNA3, not only on WARP.cargo test -p victory-shaderon the 780M: 303 passed, 0 failed (302 on main plus the new test).AI-assisted (Claude).
@UncommonDLL on GitHub · 2026-11-27 18:13 UTC · original
We tested
f9fe970f6c4123a1daca3bc343d8d91761927b8con an RTX 5070 Ti with NVIDIA driver 621.40. The requested command ran withVICTORY_WARPunset and exited 0 with one test passed. That output did not identify which adapter ran.A separate observation build logged the test’s D3D12 device and each case after the original assertions passed. The RTX 5070 Ti completed all six cube faces at biases 0, +1 and −2. All 18 cases passed, with 32 lanes and six readback checks per lane. WARP separately passed 18/18. Neither adapter skipped a case. OpenAI Codex ran the Windows tests and verified the readbacks.
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.