tombox-xshader: exact v_cvt_rpi_i32_f32 floor and sign-saturated NaN for rpi/flr #377
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!377
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/377/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?
@Ctrl-Alt-Haze on GitHub · 2026-11-24 23:31 UTC · original
Ctrl-Alt-Haze:fix/xshader-374-cvt-rpi-flr-nan→main· +41 −16 · 3 files · 1 commits · closed without mergingLibrary / area:
crates/tombox-xshader(hlsl.rs,tests/exec.rs,tests/isa_sweep/ops_v.rs)Exports changed (exports.txt rows): none (RDNA2-to-HLSL lowering and tests only)
Source of the behaviour: #374 (gfx1036 hardware measurements referenced from
Marvisak/VIctory#605andxcl-dev/xcl#639/xcl-dev/xcl#1020, implemented independently intombox-xshader)Fixes #374
Summary
tb_cvt_flr_i(float)andtb_cvt_rpi_i(float)helpers incrates/tombox-xshader/src/hlsl.rs:v_cvt_rpi_i32_f32now computesr = floor(x); d = x - r; TB_SEL(d >= 0.5, r + 1.0, r)so half-way comparisons use the exact residual rather than single-precisionx + 0.5rounding (0x3EFFFFFF->0,8388609.0->8388609,-8388609.0->-8388609).v_cvt_flr_i32_f32andv_cvt_rpi_i32_f32saturate NaN inputs by sign bit (0x7FFFFFFFfor positive NaN,0x80000000for negative NaN, qNaN and sNaN), leavingv_cvt_i32_f32/v_cvt_u32_f32NaN ->0untouched.crates/tombox-xshader/tests/exec.rs(vector_vop1) with exactf64floor + signed-NaN expectations and added the edge bit patterns from #374 (0x3EFFFFFF,0x4B000001,0x4B000003,0xCB000001,0xBF000001, ±qNaN, ±sNaN) plusv_cvt_i32_f32/v_cvt_u32_f32NaN checks; removed now-unusedcvt_i.crates/tombox-xshader/tests/isa_sweep/ops_v.rsreference model (rpiandv_cvt_flr_i32_f32) to match the signed-NaN and exact-floor behavior..rsfiles free of added comment lines.Tested
Windows 11 x64, MSVC toolchain, DXC, NVIDIA GeForce RTX 5070 Ti + WARP at commit
5ce01d5:python .github/scripts/pr_gate.py --base upstream/main --head HEAD:3 file(s) checked, 0 problem(s)cargo test -p tombox-xshader --test isa_sweep:2 passed; 0 failed(isa_sweep: 555 mnemonics, 544 pass, 0 fail, 11 known WARP deviations, 28 skipped)cargo test -p tombox-xshader --test exec -- vector_vop1:1 passed; 0 failedcargo test -p tombox-xshader -- --test-threads=1:345 passed; 0 failed; 18 ignoredacross all test targets (lib: 116 passed / 3 ignored;xshader_prelaunch: 4;centroid: 1;dxc_host: 1;dxc_host_crash: 1;exec: 128 passed / 2 ignored;fmask_identity_warp: 1;gcn_dims: 3;isa_sweep: 2;isa_table: 3;linkage: 3;mesh: 24 passed / 1 ignored;mixed_table: 3;msaa_dim: 1;opcodes: 26;ps_linkage: 1;synthetic: 24;xdxr_console: 1;xshader_cli: 2; ignored-only targets:amp4,f861_repro1,fixtures6,hlsl_determinism1)cargo test -p tombox-xshaderearlier hit transientDXGI_ERROR_DEVICE_REMOVED(0x887a0005) duringexec;--test-threads=1completed cleanly with 0 failures.Checklist
cargo test -p tombox-xshader -- --test-threads=1passes (345 passed; 0 failed; 18 ignored)missingwith a noteAI use: Antigravity (Google DeepMind; exact model version not exposed to agent) implemented the fix, tests, and PR text.
@omonkeyz on GitHub · 2026-11-25 13:51 UTC · original
Applied on main in
474314f(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed