Repository navigation
Conversation
The console reads f32 denormals as zeros, but DXIL floor/ceil/fract leave that to the host. vkd3d on NVIDIA does not advertise FP32 denorm flush, so both adapters returned the unfloored result. Flush on the bits first, as the other denormal-sensitive lowerings do.
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified against main (63bcca43) on Windows 11 (RTX 5090 + WARP + dxil.dll) — clean fix and ready to merge:
- Applying
self.ftz(a)after source modifiers (abs/neg) inv_fract_f32,v_floor_f32, andv_ceil_f32(crates/victory-shader/src/emit/lower.rs:6340-6347) flushes subnormals to signed zero (±0.0) while leavingNaNand±Infuntouched, matching RDNA2 behavior on NVIDIA drivers (where-denormotherwise produced-1.0forfloorand0x3F7F_FFFFforfract). emit/lower.rssize on63bcca43: 521,164 B (+601 B, 3,124 B under the 512 KiB policy limit).- (Minor non-blocking note: adding a
±denormregression case tovalu_testsforv_floor_f32/v_ceil_f32/v_fract_f32would lock this behavior in directly.)
Local verification:
cargo test --locked -p victory-shader -- fract floor ceil denorm: 7/7 passed (GPU + WARP +dxil.dll)cargo clippy --locked -p victory-shader --tests -- -D warnings: 0 warningscargo xtask policy: 191 files ok
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP, dxil.dll validator active):
cargo test -p victory-shader --lib emit::semantics_tests::arithmetic_matches_the_hardware: 1 passed, 0 failed (hardware + WARP, 0 mismatches).cargo test -p victory-shader --lib emit::lower::tests: 33 passed, 0 failed.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Flushing f32 denormal operands via self.ftz(a) before fract (op 22), floor (op 27), and ceil (op 28) matches RDNA2 FTZ behavior and avoids vkd3d/NVIDIA denormal retention.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
kotekompotek
left a comment
There was a problem hiding this comment.
Verified: flushing the operand to zero before DXIL floor/ceil/fract matches the console's denormal-as-zero reads and the existing ftz treatment for max/min and the floor conversions in this same lowering — needed precisely because vkd3d can't request FP32 denormal flush on NVIDIA. ops 27/28/22 are the right sites.
…l operands (by neonbyte1) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thanks for checking. On a ±denormal case: |
fyernald
left a comment
There was a problem hiding this comment.
A native Windows data point, since this was tested under vkd3d-proton: RTX 3080 (driver 617.42), Windows 10 22H2. Base is main 63bcca4 + #486 (Agility opt-in) + #2596 (so the suite gets past the #2571 crash).
| base | + this PR (e4a11fd) |
|
|---|---|---|
emit::semantics_tests::rounding_matches_the_hardware |
passes | passes |
cargo test -p victory-shader --lib -- --test-threads=1 |
298 passed, 4 failed, 3 ignored | 298 passed, 4 failed, 3 ignored (same 4) |
So the native NVIDIA D3D12 driver already gives the console's results for those denormal inputs here. The failure you saw is specific to vkd3d-proton. The change doesn't move anything on Windows, and it stops the result from depending on the driver's denorm mode, the same as max/min already do.
|
Automated triage for the maintainers. Merge candidate. In CI: passing. Recommending a look, not approving. Generated by Claude Code |
The console reads f32 denormals as zeros of their sign. DXIL
floor,ceilandfracleave that to the host, and vkd3d-proton on NVIDIA does not advertise FP32 denorm flush, sov_floor_f32,v_ceil_f32andv_fract_f32of a denormal kept it.v_fract_f32of0x80000001gave0x3f7fffff(just under 1.0) instead of 0. The operand is now flushed on the bits first, asmax/minand the float-to-int conversions already do.Tests (Linux, Wine 11.22, vkd3d-proton 3.1-83 from GE-Proton11-14, RTX 5090, driver 620.73.04; run with
cargo xtask wine-testfrom #1218):emit::semantics_tests::rounding_matches_the_hardwarefailed before on the 5090 and on the vkd3d-proton software path, 2 of 38 inputs each for floor, ceil and fract. It passes with this change.victory-shader: 299 passed, 3 failed, against 298/4 onmain(63bcca4). The other 3 failures are Wine/vkd3d-proton gaps fixed elsewhere: Tests: keep the D3D12 pipeline smoke check portable under Wine #1266, and a PR of mine that follows.cargo clippy --workspace --all-targets(with and withoutdiagnostics) andcargo xtask policyare clean.Translation over the whole shader pack: no program starts or stops translating. 11,157 programs emit different DXIL, all from the added flush. That's broad, so I ran it in game: two 7-minute runs on our NVIDIA/Wine test build, with no crash or new drops (556 against 558 dropped draws a frame, 86 against 90 indirect). Frame 1500 was still the loading screen in both, so this is not a visual comparison.
Not tested on Windows. On a host that flushes denormals already, the extra
and/selectis a no-op.AI-assisted (Claude); measured on my machine, no game data shared.