shader: lower one-source binary32 math in the depth mask translator #1295

Merged
tedin7 merged 1 commit from upstream-pr/1302 into main 2026-11-24 08:06:12 +00:00
tedin7 commented 2026-11-24 07:21:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T07:21:16Z.


Change

tools/depth_mask_aot.py now lowers v_rcp_f32_e32, v_rsq_f32_e32, v_sqrt_f32_e32, v_floor_f32_e32, v_trunc_f32_e32 and v_rndne_f32_e32 (to 1.0f / x, rsqrt, sqrt, floor, trunc, round). Source modifiers, clamp, output modifiers, a second source and the e64 encodings still reject translation. v_fract_f32_e32 is unchanged (already NaN-safe). Precision of rcp/rsq/sqrt is not claimed; NaN, infinity, denormals, signed zero and zero or negative operands of rsq/sqrt are not exercised. Twin of the mesh entry change (#1202). AI-assisted.

Verification

  • python3 -B tests/depth_mask_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so.1: passes with this change; on origin/main the same new test fails with Unsupported depth instruction: v_rcp_f32_e32. LLVM 15 was not available locally.
  • New depth_mask_unary_draw_* (unary mode) is a WARP readback against an independent Python reference: the approximate forms get inputs with integer exact results, through a runtime zero, rounded before use; floor/trunc/rndne are compared exactly. Every other form's reference must fail on exactly the differing pixels. Not run on Linux; it is outside --preset pr: ctest --preset dev -R "^depth_mask_unary_draw_".

Evidence and follow-up

Fixtures are synthetic. No WARP readback has been run yet.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6576751613 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1302). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T07:21:16Z. --- ## Change `tools/depth_mask_aot.py` now lowers `v_rcp_f32_e32`, `v_rsq_f32_e32`, `v_sqrt_f32_e32`, `v_floor_f32_e32`, `v_trunc_f32_e32` and `v_rndne_f32_e32` (to `1.0f / x`, `rsqrt`, `sqrt`, `floor`, `trunc`, `round`). Source modifiers, clamp, output modifiers, a second source and the e64 encodings still reject translation. `v_fract_f32_e32` is unchanged (already NaN-safe). Precision of rcp/rsq/sqrt is not claimed; NaN, infinity, denormals, signed zero and zero or negative operands of rsq/sqrt are not exercised. Twin of the mesh entry change (#1202). AI-assisted. ## Verification - `python3 -B tests/depth_mask_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so.1`: passes with this change; on origin/main the same new test fails with `Unsupported depth instruction: v_rcp_f32_e32`. LLVM 15 was not available locally. - New `depth_mask_unary_draw_*` (`unary` mode) is a WARP readback against an independent Python reference: the approximate forms get inputs with integer exact results, through a runtime zero, rounded before use; floor/trunc/rndne are compared exactly. Every other form's reference must fail on exactly the differing pixels. Not run on Linux; it is outside `--preset pr`: `ctest --preset dev -R "^depth_mask_unary_draw_"`. ## Evidence and follow-up Fixtures are synthetic. No WARP readback has been run yet. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
tedin7 commented 2026-11-24 08:01:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T07:25:35Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP) at 1c3dd0ad:

  • Debug (--preset dev): ctest --preset dev -R "^depth_mask_.*_warp$" — 4/4 PASS (2.82s, including depth_mask_unary_draw_warp 2.69s)
  • Release /O2 (--preset release): ctest --preset release -R "^depth_mask_.*_warp$" — 4/4 PASS (2.71s, build 0.96s, including depth_mask_unary_draw_warp 2.63s)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7124978730 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1302#issuecomment-7124978730). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T07:25:35Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP) at `1c3dd0ad`: - Debug (`--preset dev`): `ctest --preset dev -R "^depth_mask_.*_warp$"` — **4/4 PASS** (`2.82s`, including `depth_mask_unary_draw_warp` `2.69s`) - Release `/O2` (`--preset release`): `ctest --preset release -R "^depth_mask_.*_warp$"` — **4/4 PASS** (`2.71s`, build `0.96s`, including `depth_mask_unary_draw_warp` `2.63s`)
chatgpt-codex-connector[bot commented 2026-11-24 08:01:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T07:25:42Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T07:29:20.013776Z 1c3dd0a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7124980793 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1302#issuecomment-7124980793). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T07:25:42Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"1c3dd0adc2537e080100d316b7ba0c0e5d2b79f4","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T07:29:20.013776Z">2026-11-24T07:29:20.013776Z</relative-time> | `1c3dd0a` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
upstream-sync closed this pull request 2026-11-24 09:04:26 +00:00
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
R0Y00/Xbox2Windows!1295
No description provided.