Shaders: cube-map face coordinates read denormals as zeros #1766
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!1766
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1766/head"
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?
@alexdeliu on GitHub · 2026-11-24 22:13 UTC · original
alexdeliu:fix/cube-ftz→main· +64 −1 · 2 files · 2 commits · merged 2026-11-25 21:51 UTCv_cubeid/sc/tc/ma_f32return one of the coordinates, or its negation. So a denormal coordinate comes out as the host chooses:v_cubesc_f32(0, NaN, 0x00000001)gives0x80000001on an RX 9070.0x80000000.mainmodels it since77053a0(32-bit denormals flushed on input and output), reads it as a zero of its sign.min/maxoperands already go throughftz(77053a0). The cube coordinates didn't.Change
The three coordinates go through
self.ftzbefore the major-axis compare and the pick (lower.rs, the cube arm).Test
semantics_tests::cube_faces_match_the_hardwareadds a probe family in the existing framework:triples(F32_EDGES, F32_EDGES, F32_THIRD), i.e. 14,440 inputs with signed zeros, denormals, infinities and NaN in each coordinate;cube(): the major-axis rule from the ISA, with coordinates read throughftz.main@70564aev_cubesc_f32alone)Checks
On Windows 11 with the RX 9070:
cargo test --workspace --lockedpasses 475 (main: 474, plus this probe);mainitself with the SDK's 1.7dxil.dll(rect::tests::rectangles_get_their_fourth_corner,tests::elements_sharing_a_row_keep_their_order; see #1744).Found by the cross-device fuzzer in #1614. It is the remaining denormal case after
77053a0(FIND-4 in #1633).🤖 Generated with Claude Code
@DesertGamer on GitHub · 2026-11-24 22:13 UTC · original
VIctory V2: community PRs, merged and tested
Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.
Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).
⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.
Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2
Unofficial community fork of Marvisak/VIctory, GPL-3.0.
@upipibi on GitHub · 2026-11-24 22:46 UTC · original
Overlap for the reviewers: #1709 (Calvix2k, opened 21:03, rebased onto
70564ae) makes the same change inlower.rs:let (x, y, z) = (self.ftz(x), self.ftz(y), self.ftz(z));on thev_cube*_f32inputs. It also passes the result throughself.ftz(r). Its test isv_cube_flushes_subnormals_in_dxilinvalu_tests.rs; this PR's is insemantics_tests.rs. Only one of the two code changes can merge as is. From reading both diffs; nothing built.AI-assisted (Claude Code).
@alexdeliu on GitHub · 2026-11-24 23:59 UTC · original
@upipibi thanks. #1709 came first and makes the same input flush, so only one of the two should merge. The real difference is that #1709 also flushes the result. I will check on the RX 9070 and the gfx1036 whether the hardware flushes
v_cube*results too, and post it on both PRs. If it does, #1709 is the more complete fix, and this PR'ssemantics_testsprobe can move on top of it.@alexdeliu on GitHub · 2026-11-25 00:19 UTC · original
Follow-up on the #1709 overlap: the two PRs behave the same. #1709's extra
self.ftz(r)on the result is a no-op, so no hardware check is needed to choose between them.v_cube*_f32result is built from an input or a constant.cubesc/cubetcreturn a coordinate, possibly negated;cubemareturns 2 × the major coordinate;cubeidreturns a face index from 0 to 5. With the inputs flushed, every input is ±0 or normal, so no result can be denormal.omod×0.5 on a value near FLT_MIN.write_falready handles that: it flushes, multiplies, then turns a tiny product into +0 for every VALU op.So either change is correct. #1709 was opened first. This PR adds a
semantics_testsprobe, which runs the GPU on both sides. #1709's test checks the DXIL text. If #1709 is the one taken, I'm happy to move the probe on top of it.@Calvix2k on GitHub · 2026-11-25 00:41 UTC · original
Thanks for the cross-reference. #1709 was opened first and is still mergeable, so this is a duplicate of it. The GPU probe from this PR (semantics_tests on RX 9070 and gfx1036) is the useful extra piece; it would be welcome as a follow-up on top of #1709. Suggest closing this PR in favour of #1709.
@Marvisak on GitHub · 2026-11-25 03:41 UTC · original · edited 2026-11-25 06:22 UTC
Automated triage for the maintainers.
Merge candidate. The new head only merges
main; the change is the same. Thev_cube*_f32arm incrates/victory-shader/src/emit/lower.rsflushes the three coordinates throughself.ftzbefore choosing the major axis. That matchesmain's model of the console's float mode, andmainstill lacks the flush there. Thecube_faces_match_the_hardwareprobe insemantics_tests.rscompares the GPU against an ISA-based model over signed zeros, denormals, infinities and NaN. #1709 makes the same input flush (its extra result flush is a no-op, as argued here) and also merges cleanly. Only one of the two should land, and this one carries the hardware probe.Agreed with the reply: either change is correct, and the choice between this and #1709 is the maintainer's.
CI: passing (
check).Generated by Claude Code
@alexdeliu on GitHub · 2026-11-25 04:50 UTC · original
@Calvix2k thanks. As I wrote above, the two behave the same. I'll leave the choice to the maintainer; whichever one lands, the other can be closed. If it's #1709, I'll move the
semantics_testsprobe on top of it.@Calvix2k on GitHub · 2026-11-25 05:15 UTC · original
Understood — whichever the maintainer picks, the other closes. #1709 is green and mergeable; if it lands first, moving your
semantics_testsprobe on top of it is the right follow-up. The difference I saw on my side is only in what the tests compare (mine checks the four emitted sequences; yours measures the hardware's denormal output forv_cube*_f32), and both are useful.