d3d12_xs: eager blendclamp leaves R32G32B32A32_FLOAT targets alone #320

Closed
enderrr9 wants to merge 1 commit from upstream-pr/320 into main
enderrr9 commented 2026-11-23 18:19:28 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by enderrr9 on 2026-11-23T18:19:28Z.


Fixes the BLOCKERS.md entry "eager blendclamp also clamps R32G32B32A32_FLOAT (fmt 2) to +-65504 ... looks unintended".

Bug

blendclamp::small_float() listed DXGI format 2 (R32G32B32A32_FLOAT) next to the fp16 formats. So with TOMBOX_BLEND_CLAMP in eager mode, every blended fp32 target was clamped to ±65504, the fp16 range. ps mode (shader_xlat::export_kind) already leaves format 2 alone, and ps_clamp_kinds_only_change_the_small_float_formats pins that.

Fix

small_float now lists 10/34/54 (fp16) and 26 (R11G11B10), the same formats ps mode clamps. It's a one-line change.

Test

New: blendclamp_hw::warp_blendclamp_leaves_fp32_targets_above_the_fp16_range. It's a WARP test, #[ignore]d like the other blendclamp GPU tests: cargo test -p d3d12_xs --lib warp_blendclamp -- --ignored. It makes three additive draws (40000, 40000, 1) on an R32G32B32A32_FLOAT target:

run result
raw control 80001.0 everywhere
eager, before 65504.0 (0x477fe000), with clamp passes run
eager, after 80001.0, no clamp passes

bpp() and channels() in the test kit learn the 16-byte format.

The existing warp_blendclamp_lazy_matches_eager_for_an_additive_chain_that_overflows_to_inf and warp_ps_clamp_matches_eager_blendclamp_for_shader_inf_and_nan still pass.

cargo test -p d3d12_xs --lib: 666 passed, 2 failed. Both failures are unrelated to this change:

  • fixed_result_dxgix_exports_match_every_console_d3d12_xs needs a console d3d12_xs.dll under D:\xbox-pc-port\games;
  • one_megabyte_detiles_on_one_thread_in_a_few_ms is a timing test that took 26 ms on this laptop in a debug build.

pr_gate.py: 3 files, 0 problems.

🤖 Generated with Claude Code

<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6565939591 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/320). Originally posted by [enderrr9](https://github.com/enderrr9) on 2026-11-23T18:19:28Z. --- Fixes the BLOCKERS.md entry "eager blendclamp also clamps R32G32B32A32_FLOAT (fmt 2) to +-65504 ... looks unintended". ## Bug `blendclamp::small_float()` listed DXGI format 2 (`R32G32B32A32_FLOAT`) next to the fp16 formats. So with `TOMBOX_BLEND_CLAMP` in eager mode, every blended fp32 target was clamped to ±65504, the fp16 range. ps mode (`shader_xlat::export_kind`) already leaves format 2 alone, and `ps_clamp_kinds_only_change_the_small_float_formats` pins that. ## Fix `small_float` now lists 10/34/54 (fp16) and 26 (R11G11B10), the same formats ps mode clamps. It's a one-line change. ## Test New: `blendclamp_hw::warp_blendclamp_leaves_fp32_targets_above_the_fp16_range`. It's a WARP test, `#[ignore]`d like the other blendclamp GPU tests: `cargo test -p d3d12_xs --lib warp_blendclamp -- --ignored`. It makes three additive draws (40000, 40000, 1) on an `R32G32B32A32_FLOAT` target: | run | result | |---|---| | raw control | 80001.0 everywhere | | eager, before | **65504.0** (`0x477fe000`), with clamp passes run | | eager, after | 80001.0, no clamp passes | `bpp()` and `channels()` in the test kit learn the 16-byte format. The existing `warp_blendclamp_lazy_matches_eager_for_an_additive_chain_that_overflows_to_inf` and `warp_ps_clamp_matches_eager_blendclamp_for_shader_inf_and_nan` still pass. `cargo test -p d3d12_xs --lib`: 666 passed, 2 failed. Both failures are unrelated to this change: - `fixed_result_dxgix_exports_match_every_console_d3d12_xs` needs a console `d3d12_xs.dll` under `D:\xbox-pc-port\games`; - `one_megabyte_detiles_on_one_thread_in_a_few_ms` is a timing test that took 26 ms on this laptop in a debug build. `pr_gate.py`: 3 files, 0 problems. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
omonkeyz commented 2026-11-25 13:49:36 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:49:36Z.


Applied on main in 92c998d (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7164346406 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/320#issuecomment-7164346406). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-25T13:49:36Z. --- Applied on main in 92c998d (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
omonkeyz/xbox-emulator!320
No description provided.