shader: lower RGB-only pixel texture samples #303

Manually merged
github merged 8 commits from gh-pr/303/head into gh-pr/303/base 2026-11-26 21:41:34 +00:00
Owner

@⁠Vonsek on GitHub · 2026-11-21 21:34 UTC · original
Vonsek:codex/pixel-rgb-sample → main · +47 −7 · 3 files · 8 commits · merged 2026-11-22 09:13 UTC

Change

Support the entry-mask gfx1013 2D image_sample RGB form, dmask:0x7, in tools/pixel_aot.py. The masked sample fills exactly three vector registers. The fourth register stays available, including while the sample is outstanding. Existing sample-count and execution-mask checks still apply.

Verification

Tested 09812d3 on Windows 26200.9974 with WARP 10.0.26100.9818 and RTX 5080 driver 32.0.16.1692. The renderer reported the debug layer unavailable on both adapters.

cmake --preset dev
cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links)$'
python -B tests/bidi_controls_check.py
git diff --check

All five CTests passed without capability skips. The bidi and whitespace checks passed.

python -B tests/pixel_aot_check.py binary "<LLVM 15.0.7 gfx1013 assembler wrapper>" "<LLVM 15.0.7 llvm-objcopy.exe>" "<LLVM 15.0.7 LLVM-C.dll>"

The source-built fixture fails on b53bfb0 at instruction 16 with an unsupported image_sample diagnostic. The LLVM round trip passes with this change. The normal tools/pixel_aot.py CLI also extracts the same 22-instruction synthetic record and emits identical HLSL. The Windows assembler wrapper invokes clang -cc1as -triple amdgcn--amdpal -target-cpu gfx1013 -filetype obj.

Capability-skip verification

At 3c4b1c0, the RGB fixture runs after the draw that propagates capability skips. Using a stub compiler that exits 0 and a stub renderer that exits 77, python -B tests/pixel_aot_check.py draw <stub-compiler> <stub-renderer> hardware now exits 77. CTest reports the case as skipped with SKIP_RETURN_CODE 77. The real WARP and hardware pixel tests and docs_links passed again.

Evidence and follow-up

The MIT-licensed test builds from the repository's handwritten texture-copy shader. It presets the register next to the RGB destination to 0.5 and exports that value as alpha. The draw matches the independent CPU reference bitwise for all 4,096 pixels and 16,384 color channels on both adapters. Expecting the texture's alpha of 1.0 instead yields the first mismatch at (0, 0). Controls reject a wrong destination width, a different data mask and an overwrite of a pending RGB result.

The isolated RGB behavior is separate from the partial VM waits in #176 and the affine coordinate work in #283. The surveyed multi-sample program still encounters an earlier whole-quad sample rejection. Reproduction steps

This contribution was AI-assisted.

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.

Upstream merge verification

Merged upstream through 6ee2406 at 3393ef8. The integrated fixture retains the RGB case and the merged scalar ALU, literal FMA and half conversion checks. LLVM 15 binary, bidi and whitespace checks passed. Reconfigured the dev preset and ran:

ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links|pso_readiness_check|sgd5_effect_candidates)$'

All seven checks passed on the available adapters without skips. The newly merged half-conversion fixture introduced a separate no-adapter ordering regression on main. Its fix and simulated skip evidence are in #322.

**@⁠Vonsek** on GitHub · 2026-11-21 21:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303) `Vonsek:codex/pixel-rgb-sample` → `main` · +47 −7 · 3 files · 8 commits · merged 2026-11-22 09:13 UTC ## Change Support the entry-mask gfx1013 2D `image_sample` RGB form, `dmask:0x7`, in `tools/pixel_aot.py`. The masked sample fills exactly three vector registers. The fourth register stays available, including while the sample is outstanding. Existing sample-count and execution-mask checks still apply. ## Verification Tested `09812d3` on Windows 26200.9974 with WARP 10.0.26100.9818 and RTX 5080 driver 32.0.16.1692. The renderer reported the debug layer unavailable on both adapters. ```powershell cmake --preset dev cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links)$' python -B tests/bidi_controls_check.py git diff --check ``` All five CTests passed without capability skips. The bidi and whitespace checks passed. ```powershell python -B tests/pixel_aot_check.py binary "<LLVM 15.0.7 gfx1013 assembler wrapper>" "<LLVM 15.0.7 llvm-objcopy.exe>" "<LLVM 15.0.7 LLVM-C.dll>" ``` The source-built fixture fails on `b53bfb0` at instruction 16 with an unsupported `image_sample` diagnostic. The LLVM round trip passes with this change. The normal `tools/pixel_aot.py` CLI also extracts the same 22-instruction synthetic record and emits identical HLSL. The Windows assembler wrapper invokes `clang -cc1as -triple amdgcn--amdpal -target-cpu gfx1013 -filetype obj`. ### Capability-skip verification At `3c4b1c0`, the RGB fixture runs after the draw that propagates capability skips. Using a stub compiler that exits 0 and a stub renderer that exits 77, `python -B tests/pixel_aot_check.py draw <stub-compiler> <stub-renderer> hardware` now exits 77. CTest reports the case as skipped with `SKIP_RETURN_CODE 77`. The real WARP and hardware pixel tests and `docs_links` passed again. ## Evidence and follow-up The MIT-licensed test builds from the repository's handwritten texture-copy shader. It presets the register next to the RGB destination to 0.5 and exports that value as alpha. The draw matches the independent CPU reference bitwise for all 4,096 pixels and 16,384 color channels on both adapters. Expecting the texture's alpha of 1.0 instead yields the first mismatch at (0, 0). Controls reject a wrong destination width, a different data mask and an overwrite of a pending RGB result. The isolated RGB behavior is separate from the partial VM waits in #176 and the affine coordinate work in #283. The surveyed multi-sample program still encounters an earlier whole-quad sample rejection. [Reproduction steps](https://github.com/Vonsek/Xbox2Windows/blob/codex/pixel-rgb-sample/docs/experiments.md#offline-pixel-shader-recompilation) This contribution was AI-assisted. ## 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. ### Upstream merge verification Merged upstream through `6ee2406` at `3393ef8`. The integrated fixture retains the RGB case and the merged scalar ALU, literal FMA and half conversion checks. LLVM 15 binary, bidi and whitespace checks passed. Reconfigured the dev preset and ran: ```powershell ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links|pso_readiness_check|sgd5_effect_candidates)$' ``` All seven checks passed on the available adapters without skips. The newly merged half-conversion fixture introduced a separate no-adapter ordering regression on main. Its fix and simulated skip evidence are in #322.
The RGB data mask produces three values and leaves the next vector register live. Use the encoded destination width so the existing sample-write and wait tracking cover just those values.
The first pixel draw propagates the renderer capability result to CTest. Run the RGB fixture after that check so a host without a compatible adapter still reports a skip.
# Conflicts:
#	README.md
#	tests/pixel_aot_check.py
# Conflicts:
#	README.md
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:41:33 +00:00
github manually merged commit 7e60916231 into gh-pr/303/base 2026-11-26 21:41:34 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 21:34 UTC · original · edited 2026-11-21 22:11 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-21T22:11:28.321904Z 3393ef8 Manual request
ℹ️ 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-21 21:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#issuecomment-7069570917) · edited 2026-11-21 22:11 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"3393ef8dd34f3e7931b4d93c72aa4f10cc4987da","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-21T22:11:28.321904Z">2026-11-21T22:11:28.321904Z</relative-time> | `3393ef8` | Manual request | <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>
@ -3177,0 +3203,4 @@
for green in RAMP for red in RAMP)
case.write_bytes(bytes(256) + b"".join(colors))
if alpha == 0.5:
subprocess.run(draw, check=True)
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 21:36 UTC · original

P2 Badge Preserve capability skips in the new RGB draw

On a Windows host without a D3D12-capable hardware adapter, offscreen_check returns 77 (tests/offscreen_check.cpp:396–398). The new RGB check runs before the skip-aware draw in check_render(), so this check=True raises an uncaught CalledProcessError, changing the Python exit code from 77 to 1. Consequently, pixel_aot_hardware fails instead of skipping despite SKIP_RETURN_CODE 77 in CMakeLists.txt:902—the property CMake documents as “Return code to mark a test as skipped.” Propagate 77 to the script's exit status, or run this check after the initial skip-aware draw, preserving the distinction between skips and failures required by AGENTS.md.

AGENTS.md reference: AGENTS.md:L87-L89

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 21:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#discussion_r4655114984) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Preserve capability skips in the new RGB draw** On a Windows host without a D3D12-capable hardware adapter, `offscreen_check` returns 77 (`tests/offscreen_check.cpp:396–398`). The new RGB check runs before the skip-aware draw in `check_render()`, so this `check=True` raises an uncaught `CalledProcessError`, changing the Python exit code from 77 to 1. Consequently, `pixel_aot_hardware` fails instead of skipping despite `SKIP_RETURN_CODE 77` in `CMakeLists.txt:902`—the property CMake documents as “Return code to mark a test as skipped.” Propagate 77 to the script's exit status, or run this check after the initial skip-aware draw, preserving the distinction between skips and failures required by `AGENTS.md`. AGENTS.md reference: [AGENTS.md:L87-L89](https://github.com/R0Y00/Xbox2Windows/blob/09812d3c8d8de31a31e7e23d7c50b0c81c2f06c7/AGENTS.md#L87-L89) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -3177,0 +3203,4 @@
for green in RAMP for red in RAMP)
case.write_bytes(bytes(256) + b"".join(colors))
if alpha == 0.5:
subprocess.run(draw, check=True)
Author
Owner

@⁠Vonsek on GitHub · 2026-11-21 21:39 UTC · original

Moved the RGB fixture after the existing capability-aware draws in 3c4b1c0. I reproduced the original failure by making the renderer return 77. The draw command now exits with 77 and reaches only the initial capability-aware draw. The real pixel CTests pass on WARP and RTX 5080.

**@⁠Vonsek** on GitHub · 2026-11-21 21:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#discussion_r4655122510) Moved the RGB fixture after the existing capability-aware draws in `3c4b1c0`. I reproduced the original failure by making the renderer return 77. The draw command now exits with 77 and reaches only the initial capability-aware draw. The real pixel CTests pass on WARP and RTX 5080.
Author
Owner

@⁠Vonsek on GitHub · 2026-11-21 21:41 UTC · original

@⁠codex review

**@⁠Vonsek** on GitHub · 2026-11-21 21:41 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#issuecomment-7069654378) @⁠codex review
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 21:44 UTC · original

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 3c4b1c02c6

ℹ️ 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-21 21:44 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#issuecomment-7069685212) <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. You're on a roll. **Reviewed commit:** `3c4b1c02c6` <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>
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 21:58 UTC · original

At 3c4b1c0 the merge conflicts are in README.md, tests/pixel_aot_check.py. Preserve RGB and RGBA sample controls alongside the existing single-mip tests. Please also update scanner recognition for dmask:0x7 so the PSO report can reach the lowerer.

**@⁠R0Y00** on GitHub · 2026-11-21 21:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#issuecomment-7069849830) At `3c4b1c0` the merge conflicts are in `README.md`, `tests/pixel_aot_check.py`. Preserve RGB and RGBA sample controls alongside the existing single-mip tests. Please also update scanner recognition for `dmask:0x7` so the PSO report can reach the lowerer.
Author
Owner

@⁠Vonsek on GitHub · 2026-11-21 22:08 UTC · original

@⁠codex review

**@⁠Vonsek** on GitHub · 2026-11-21 22:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#issuecomment-7069964180) @⁠codex review
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 22:11 UTC · original

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 3393ef8dd3

ℹ️ 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-21 22:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#issuecomment-7070002984) <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. Keep it up! **Reviewed commit:** `3393ef8dd3` <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>
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 02:56 UTC · original

A test merge of 3393ef8 against main conflicts in README.md and tests/pixel_aot_check.py. Keep the RGB fixture in the LLVM list alongside affine_coordinates() and the MAD controls. Please refresh the branch and rerun the relevant fixture and Windows CI.

**@⁠R0Y00** on GitHub · 2026-11-22 02:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#issuecomment-7073226414) A test merge of `3393ef8` against main conflicts in `README.md` and `tests/pixel_aot_check.py`. Keep the RGB fixture in the LLVM list alongside `affine_coordinates()` and the MAD controls. Please refresh the branch and rerun the relevant fixture and Windows CI.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 21:36 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09812d3c8d

ℹ️ 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-21 21:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/303#pullrequestreview-6008318867) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `09812d3c8d` <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>
This discussion has been locked. Commenting is limited to contributors.
No description provided.