shader: emit binary32 float literals in graphics HLSL #3570

Manually merged
github merged 4 commits from github-bot/gh-3568 into gh-pr/3568/base 2026-11-30 09:41:59 +00:00 AGit
Owner

@⁠tedin7 on GitHub · 2026-11-30 09:10 UTC · original
tedin7:uppr-gfx2hlsl-f32-literals → main · +105 −94 · 17 files · 4 commits · merged 2026-11-30 09:36 UTC

Problem

  1. tools/startup/gfx2hlsl.py emitted unsuffixed floating-point literals (such as 1.0, 0.0, 255.0, 0.0625, 6.283185307), which DXC/HLSL can treat as double-precision literals or trigger implicit conversion issues in graphics HLSL.
  2. tests/startup_gfx2hlsl_f16_alu_check.py evaluated lowered HLSL expressions in Python without stripping the f suffix from float literals.

Fix

  • Add the f suffix to binary32 floating-point literals emitted by tools/startup/gfx2hlsl.py.
  • Update tests/startup_gfx2hlsl_vcvt_omod_check.py, tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py, and tests/startup_gfx2hlsl_f16_alu_check.py (plus tests/checks/python-linux/gfx2hlsl-vcvt-omod.txt) to expect and parse binary32 f-suffixed float literals.

Verification

  • python3 -B tests/startup_gfx2hlsl_vcvt_omod_check.py (passed)
  • python3 -B tests/startup_gfx2hlsl_f16_alu_check.py (passed)
  • python3 -B tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py (passed)
  • python3 -B tests/bidi_controls_check.py (passed)
  • python3 -B tests/docs_links_check.py (passed)
  • git diff --check origin/main..HEAD (passed)
**@⁠tedin7** on GitHub · 2026-11-30 09:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3568) `tedin7:uppr-gfx2hlsl-f32-literals` → `main` · +105 −94 · 17 files · 4 commits · merged 2026-11-30 09:36 UTC ### Problem 1. `tools/startup/gfx2hlsl.py` emitted unsuffixed floating-point literals (such as `1.0`, `0.0`, `255.0`, `0.0625`, `6.283185307`), which DXC/HLSL can treat as double-precision literals or trigger implicit conversion issues in graphics HLSL. 2. `tests/startup_gfx2hlsl_f16_alu_check.py` evaluated lowered HLSL expressions in Python without stripping the `f` suffix from float literals. ### Fix - Add the `f` suffix to binary32 floating-point literals emitted by `tools/startup/gfx2hlsl.py`. - Update `tests/startup_gfx2hlsl_vcvt_omod_check.py`, `tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py`, and `tests/startup_gfx2hlsl_f16_alu_check.py` (plus `tests/checks/python-linux/gfx2hlsl-vcvt-omod.txt`) to expect and parse binary32 `f`-suffixed float literals. ### Verification - `python3 -B tests/startup_gfx2hlsl_vcvt_omod_check.py` (passed) - `python3 -B tests/startup_gfx2hlsl_f16_alu_check.py` (passed) - `python3 -B tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py` (passed) - `python3 -B tests/bidi_controls_check.py` (passed) - `python3 -B tests/docs_links_check.py` (passed) - `git diff --check origin/main..HEAD` (passed)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 09:17:53 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-30 09:10 UTC · original · edited 2026-11-30 09:24 UTC

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-30T09:24:25.986615Z 78fe2be PR opened
ℹ️ 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.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-30 09:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3568#issuecomment-7273846333) · edited 2026-11-30 09:24 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"78fe2bec9a5beec74c12a8893bb115597e894740","has_any_findings":true,"has_unresolved_findings":true,"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-30T09:24:25.986615Z">2026-11-30T09:24:25.986615Z</relative-time> | `78fe2be` | PR opened | <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>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-30 09:24 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78fe2bec9a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-30 09:24 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3568#pullrequestreview-6109593316) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `78fe2bec9a` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
@ -3015,3 +3015,3 @@
if scale != 1.0:
factor = ('%d.0' % int(scale)) if scale == int(scale) else ('%g' % scale)
expr = '(%s) * %s' % (expr, factor)
expr = '(%s) * %sf' % (expr, factor)
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-30 09:24 UTC · original

P1 Badge Update the remaining literal-sensitive shader checks

The python-linux job in .github/workflows/windows.yml still runs several checks that were not adapted to these suffixes. In particular, tests/startup_gfx2hlsl_sdwa_cvt_check.py::eval_emitted_v0 sends the generated * 0.5f expression directly to Python eval, raising SyntaxError: invalid decimal literal; startup_gfx2hlsl_fma_mix_check.py and startup_gfx2hlsl_float_transcendental_check.py also fail because their golden strings and mutation patterns still require unsuffixed literals. All three checks pass on the parent revision. Update the remaining evaluators and literal-sensitive expectations alongside the emission change so the standard CI regression suite continues to pass.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-30 09:24 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3568#discussion_r4737110517) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Update the remaining literal-sensitive shader checks** The `python-linux` job in `.github/workflows/windows.yml` still runs several checks that were not adapted to these suffixes. In particular, `tests/startup_gfx2hlsl_sdwa_cvt_check.py::eval_emitted_v0` sends the generated `* 0.5f` expression directly to Python `eval`, raising `SyntaxError: invalid decimal literal`; `startup_gfx2hlsl_fma_mix_check.py` and `startup_gfx2hlsl_float_transcendental_check.py` also fail because their golden strings and mutation patterns still require unsuffixed literals. All three checks pass on the parent revision. Update the remaining evaluators and literal-sensitive expectations alongside the emission change so the standard CI regression suite continues to pass. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -3015,3 +3015,3 @@
if scale != 1.0:
factor = ('%d.0' % int(scale)) if scale == int(scale) else ('%g' % scale)
expr = '(%s) * %s' % (expr, factor)
expr = '(%s) * %sf' % (expr, factor)
Author
Owner

@⁠tedin7 on GitHub · 2026-11-30 09:30 UTC · original

Fixed in 831b7e612 and 96c1506ed.

**@⁠tedin7** on GitHub · 2026-11-30 09:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3568#discussion_r4737173585) Fixed in 831b7e612 and 96c1506ed.
github-bot changed target branch from main to gh-pr/3568/base 2026-11-30 09:41:56 +00:00
github manually merged commit 96c1506edc into gh-pr/3568/base 2026-11-30 09:41:59 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.