shader: support BUF_FMT_2_10_10_10_UNORM fetch format in gfx2hlsl (Part of #1723) #1999

Merged
tedin7 merged 10 commits from upstream-pr/2006 into main 2026-11-26 06:44:28 +00:00
tedin7 commented 2026-11-24 22:57:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T22:57:56Z.


Part of #1723

What this unblocks: vertex shaders whose input layout uses packed 10-10-10-2 UNORM (DXGI_FORMAT_R10G10B10A2_UNORM) no longer get refused with buffer format BUF_FMT_2_10_10_10_UNORM.

Changes:

  • tools/startup/gfx2hlsl.py: FETCH_FORMATS gains BUF_FMT_2_10_10_10_UNORM (x, y, z = 10-bit fields / 1023, w = 2-bit field / 3, one dword read with ldu). FETCH_DXGI maps DXGI 24 to it.
  • tests/startup_gfx2hlsl_tbuffer_2101010_check.py (new, registered in CMake): constructed MTBUF bytes, decoded, translated, emitted expressions evaluated against a reference from the format definition. Also checks the SNORM sibling stays refused.

Verification:

  • Shader cache revision moved to x2w-startup-shader-20 / 20cs (the run-time FORMAT switch gains case 50); known-answer keys updated in startup_shader_cache_key_check.py and startup_compute_request_offline_check.py.
  • tests/startup_buffer_format_word3_check.cpp now lists DXGI_FORMAT_R10G10B10A2_UNORM in decoded[] and checks view_word3 gives 50u << 12 | identity.
  • Docs: docs/experiments.md and docs/startup-runtime.md describe the WARP/hardware draw readback and revision 20.
  • Win2025 (Windows Server 2025 build 26100, MSVC 14.44.35207, D3D12 WARP) at a2e70c73d2b16e42a1bb0adbb016a37507f916da, ctest --preset dev|release -R '^(startup_gfx2hlsl_tbuffer_2101010|startup_buffer_format_word3|startup_vertex_fetch_formats_controls|startup_vertex_fetch_formats_warp|startup_shader_cache_key|startup_compute_request_offline)' --no-tests=error: dev 8/8 and release 8/8 passed. Tests: startup_gfx2hlsl_tbuffer_2101010, startup_buffer_format_word3, startup_buffer_format_word3_mapping_control, startup_buffer_format_word3_table, startup_shader_cache_key, startup_compute_request_offline, startup_vertex_fetch_formats_controls, startup_vertex_fetch_formats_warp.
  • Linux: python3 -B tests/startup_gfx2hlsl_tbuffer_2101010_check.py PASS; the same test against the unmodified gfx2hlsl.py from origin/main fails with Unsupported: buffer format BUF_FMT_2_10_10_10_UNORM.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593096860 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T22:57:56Z. --- Part of #1723 What this unblocks: vertex shaders whose input layout uses packed 10-10-10-2 UNORM (`DXGI_FORMAT_R10G10B10A2_UNORM`) no longer get refused with `buffer format BUF_FMT_2_10_10_10_UNORM`. Changes: - `tools/startup/gfx2hlsl.py`: `FETCH_FORMATS` gains `BUF_FMT_2_10_10_10_UNORM` (x, y, z = 10-bit fields / 1023, w = 2-bit field / 3, one dword read with `ldu`). `FETCH_DXGI` maps DXGI 24 to it. - `tests/startup_gfx2hlsl_tbuffer_2101010_check.py` (new, registered in CMake): constructed MTBUF bytes, decoded, translated, emitted expressions evaluated against a reference from the format definition. Also checks the SNORM sibling stays refused. Verification: - Shader cache revision moved to `x2w-startup-shader-20` / `20cs` (the run-time FORMAT switch gains `case 50`); known-answer keys updated in `startup_shader_cache_key_check.py` and `startup_compute_request_offline_check.py`. - `tests/startup_buffer_format_word3_check.cpp` now lists `DXGI_FORMAT_R10G10B10A2_UNORM` in `decoded[]` and checks `view_word3` gives `50u << 12 | identity`. - Docs: `docs/experiments.md` and `docs/startup-runtime.md` describe the WARP/hardware draw readback and revision 20. - Win2025 (Windows Server 2025 build 26100, MSVC 14.44.35207, D3D12 WARP) at `a2e70c73d2b16e42a1bb0adbb016a37507f916da`, `ctest --preset dev|release -R '^(startup_gfx2hlsl_tbuffer_2101010|startup_buffer_format_word3|startup_vertex_fetch_formats_controls|startup_vertex_fetch_formats_warp|startup_shader_cache_key|startup_compute_request_offline)' --no-tests=error`: dev 8/8 and release 8/8 passed. Tests: `startup_gfx2hlsl_tbuffer_2101010`, `startup_buffer_format_word3`, `startup_buffer_format_word3_mapping_control`, `startup_buffer_format_word3_table`, `startup_shader_cache_key`, `startup_compute_request_offline`, `startup_vertex_fetch_formats_controls`, `startup_vertex_fetch_formats_warp`. - Linux: `python3 -B tests/startup_gfx2hlsl_tbuffer_2101010_check.py` PASS; the same test against the unmodified `gfx2hlsl.py` from `origin/main` fails with `Unsupported: buffer format BUF_FMT_2_10_10_10_UNORM`.
chatgpt-codex-connector[bot commented 2026-11-24 23:03:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:58:14Z.


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-24T23:04:17.962325Z e05cff2 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7146858588 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7146858588). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:58:14Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"e05cff26769669304744bbab0016e83bd58229d1","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-24T23:04:17.962325Z">2026-11-24T23:04:17.962325Z</relative-time> | `e05cff2` | 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>
chatgpt-codex-connector[bot commented 2026-11-25 00:04:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:04:15Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e05cff2676

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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6048809835 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#pullrequestreview-6048809835). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:04:15Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `e05cff2676` <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>
tedin7 commented 2026-11-25 01:01:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:50:31Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049852916 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#pullrequestreview-6049852916). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:50:31Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 01:01:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:50:33Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049853281 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#pullrequestreview-6049853281). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:50:33Z. **Review:** COMMENTED --- _No description provided._
ChazY11 commented 2026-11-25 01:01:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:11:03Z.


Ran it, broke it four ways — all caught — and checked the unpacking against the DXGI definition

Windows 11 build 26300.9974, device-free:

out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_tbuffer_2101010_check.py
DXGI 24 maps to the format: ok
the SNORM sibling stays refused: ok
PASS      exit 0
mutation in FETCH_FORMATS result
((w >> 10) & 1023) → (w >> 10) (y picks up z's bits) caught
/ 1023.0 → / 1024.0 on x caught
(w >> 30) / 3.0 → / 4.0 on w caught
x taken from bits 20 instead of 0 (x and z swapped) caught

So the field order, the per-field mask and the divisor are each pinned, not only the text.

The arithmetic, checked against DXGI_FORMAT_R10G10B10A2_UNORM

I transcribed the four emitted expressions and compared them with the format definition over the boundary values of every 10-bit channel and all
four values of the 2-bit one:

words checked: 512  mismatches: 0  worst delta: 0

x endpoints: field 0 -> 0.000000, field 1023 -> 1.000000
w levels:    0.000000, 0.333333, 0.666667, 1.000000

The endpoint being exactly 1.0 matters for a vertex attribute: x / 1023.0 reaches 1.0 only because the divisor is 1023 and not 1024, which is
also why the second mutation above is the one that would corrupt a fully-saturated channel silently.

On the merge with what is already on main

Your branch is 15 commits behind (merge-base 36a9a06f), so a plain diff against main shows #1992's six VEC_U entries as deletions — they are
not yours to delete. I checked the actual merge rather than the diff:

git checkout -B merge-2006 origin/main && git merge review-2006
# no conflicts
out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_tbuffer_2101010_check.py   # exit 0
out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_int_med3_check.py          # exit 0
# v_min3_i32 is still present after the merge

Both suites are green together, so no rebase is required for this to land — just be aware that a diff-based reviewer may misread those deletions.

What is not covered

The SNORM sibling staying refused is asserted; the rest of the 10-10-10 family (BUF_FMT_2_10_10_10_SNORM, the _A2 spellings) is not, and this
patch does not claim otherwise. No vertex shader was compiled or run, which matches the description's framing (it unblocks the refusal, it does not
measure a draw).

Notes

  • AI-assisted review.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147109762 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7147109762). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T23:11:03Z. --- ## Ran it, broke it four ways — all caught — and checked the unpacking against the DXGI definition Windows 11 build 26300.9974, device-free: ```powershell out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_tbuffer_2101010_check.py DXGI 24 maps to the format: ok the SNORM sibling stays refused: ok PASS exit 0 ``` | mutation in `FETCH_FORMATS` | result | |---|---| | `((w >> 10) & 1023)` → `(w >> 10)` (y picks up z's bits) | **caught** | | `/ 1023.0` → `/ 1024.0` on x | **caught** | | `(w >> 30) / 3.0` → `/ 4.0` on w | **caught** | | x taken from bits 20 instead of 0 (x and z swapped) | **caught** | So the field order, the per-field mask and the divisor are each pinned, not only the text. ## The arithmetic, checked against `DXGI_FORMAT_R10G10B10A2_UNORM` I transcribed the four emitted expressions and compared them with the format definition over the boundary values of every 10-bit channel and all four values of the 2-bit one: ```text words checked: 512 mismatches: 0 worst delta: 0 x endpoints: field 0 -> 0.000000, field 1023 -> 1.000000 w levels: 0.000000, 0.333333, 0.666667, 1.000000 ``` The endpoint being *exactly* `1.0` matters for a vertex attribute: `x / 1023.0` reaches 1.0 only because the divisor is 1023 and not 1024, which is also why the second mutation above is the one that would corrupt a fully-saturated channel silently. ## On the merge with what is already on `main` Your branch is 15 commits behind (`merge-base 36a9a06f`), so a plain diff against `main` shows #1992's six `VEC_U` entries as deletions — they are not yours to delete. I checked the actual merge rather than the diff: ```powershell git checkout -B merge-2006 origin/main && git merge review-2006 # no conflicts out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_tbuffer_2101010_check.py # exit 0 out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_int_med3_check.py # exit 0 # v_min3_i32 is still present after the merge ``` Both suites are green together, so no rebase is required for this to land — just be aware that a diff-based reviewer may misread those deletions. ## What is not covered The `SNORM` sibling staying refused is asserted; the rest of the 10-10-10 family (`BUF_FMT_2_10_10_10_SNORM`, the `_A2` spellings) is not, and this patch does not claim otherwise. No vertex shader was compiled or run, which matches the description's framing (it unblocks the refusal, it does not measure a draw). ## Notes - AI-assisted review.
ChazY11 commented 2026-11-25 01:01:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:14:09Z.


Merge matrix for the 16 open PRs that touch tools/startup/gfx2hlsl.py

I computed each PR's changed line ranges against its own merge base (not against main, which makes stale branches look like they delete other
people's work), then looked for pairs whose ranges overlap.

PR      hunks  lines  behind  ranges
#2020      3     54       7  (1444,1486) (1528,1530) (1907,1914)
#2014      5     15       7  (677,679) (682,683) (686,692) (704,705) (1719,1719)
#2012      1     18     121  (1272,1289)
#2010      2      7      22  (1649,1649) (1846,1851)
#2008      6     48      22  (8,8) (13,13) (2009,2015) (2037,2038) (2041,2071) (2337,2342)
#2007      1     43      27  (923,965)
#2006      2      4      22  (78,79) (87,88)
#2005      1      3      22  (87,89)
#2004      1      1      22  (85,85)
#2003      1     33      22  (923,955)
#2002      3     12      48  (104,105) (157,162) (1079,1082)
#1997      3     23      38  (1146,1158) (1162,1170) (1993,1993)
#1995      1     20      40  (1304,1323)
#1984      1      5      69  (293,297)
#1952      2      6     119  (1597,1597) (1792,1796)
#1946      1     11     121  (424,434)

Only 2 of 120 pairs overlap:

pair overlap what it is
#2007 vs #2003 923–955 both add op_s_bfm_b64
#2006 vs #2005 87–88 both extend FETCH_FORMATS (10-10-10-2 UNORM vs 16-16 SNORM)

But line overlap is only half the story

I merged the overlapping pairs, and then a pair that does not overlap:

#2006 + #2005   conflict: CMakeLists.txt
#2003 + #2007   conflict: AGENTS.md, tests/startup_gfx2hlsl_bfm_b64_check.py (AA), tools/startup/gfx2hlsl.py
#2012 + #1995   order-dependent:
                  merge 2012 then 1995 -> conflict only in CMakeLists.txt, gfx2hlsl.py merges to ONE op_v_swap_b32
                  merge 1995 then 2012 -> conflicts in CMakeLists.txt, tests/..._swap_check.py (AA), gfx2hlsl.py
                                          and then BOTH implementations are present in that file

#2012 and #1995 add the same method at lines 1272 and 1304 — far apart, so nothing overlaps, yet they are the same feature. In one merge order
git silently keeps a single definition (one author's behaviour is lost with no marker); in the other it keeps both. Neither outcome is a rebase of
the other, and the reviewer would have to notice by reading the file.

So: line-overlap predicts textual conflicts, not duplicate additions. For a file where 16 people are each adding one handler, the dangerous
case is the one this matrix does not flag, and the two duplicate pairs above (#1995/#2012 on v_swap_b32, #2003/#2007 on s_bfm_b64) are
exactly that.

What I would do with this

  1. Land one of each duplicate pair first, and tell the other author to rebase onto it (I have already reviewed #2007 at behaviour level and #1995
    the same way, so both are safe choices).
  2. For #2006 / #2005, whichever goes second needs a one-line rebase of two adjacent dict entries — trivial, but it will be a conflict rather
    than a merge.
  3. Everything else in the table is disjoint: any order among the remaining 12 lands without touching another PR's lines.

The script is 40 lines (merge-base, git diff -U0, range intersection) if you want it as a CI job — but a cheaper version is just "search the
open PR titles for the mnemonic", which would have caught both duplicates before either branch existed.

Applied to this PR

This PR is one half of the #2006 + #2005 overlap: both extend FETCH_FORMATS at lines 87–88, so whichever lands second needs a one-line
rebase of two adjacent dict entries. Nothing else here affects you.

Notes

  • AI-assisted analysis, computed on main 7f149ac9.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147169233 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7147169233). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T23:14:09Z. --- ## Merge matrix for the 16 open PRs that touch `tools/startup/gfx2hlsl.py` I computed each PR's changed line ranges against its own merge base (not against `main`, which makes stale branches look like they delete other people's work), then looked for pairs whose ranges overlap. ```text PR hunks lines behind ranges #2020 3 54 7 (1444,1486) (1528,1530) (1907,1914) #2014 5 15 7 (677,679) (682,683) (686,692) (704,705) (1719,1719) #2012 1 18 121 (1272,1289) #2010 2 7 22 (1649,1649) (1846,1851) #2008 6 48 22 (8,8) (13,13) (2009,2015) (2037,2038) (2041,2071) (2337,2342) #2007 1 43 27 (923,965) #2006 2 4 22 (78,79) (87,88) #2005 1 3 22 (87,89) #2004 1 1 22 (85,85) #2003 1 33 22 (923,955) #2002 3 12 48 (104,105) (157,162) (1079,1082) #1997 3 23 38 (1146,1158) (1162,1170) (1993,1993) #1995 1 20 40 (1304,1323) #1984 1 5 69 (293,297) #1952 2 6 119 (1597,1597) (1792,1796) #1946 1 11 121 (424,434) ``` **Only 2 of 120 pairs overlap:** | pair | overlap | what it is | |---|---|---| | #2007 vs #2003 | 923–955 | both add `op_s_bfm_b64` | | #2006 vs #2005 | 87–88 | both extend `FETCH_FORMATS` (10-10-10-2 UNORM vs 16-16 SNORM) | ## But line overlap is only half the story I merged the overlapping pairs, and then a pair that does **not** overlap: ```text #2006 + #2005 conflict: CMakeLists.txt #2003 + #2007 conflict: AGENTS.md, tests/startup_gfx2hlsl_bfm_b64_check.py (AA), tools/startup/gfx2hlsl.py #2012 + #1995 order-dependent: merge 2012 then 1995 -> conflict only in CMakeLists.txt, gfx2hlsl.py merges to ONE op_v_swap_b32 merge 1995 then 2012 -> conflicts in CMakeLists.txt, tests/..._swap_check.py (AA), gfx2hlsl.py and then BOTH implementations are present in that file ``` `#2012` and `#1995` add the same method at lines 1272 and 1304 — far apart, so nothing overlaps, yet they are the same feature. In one merge order git silently keeps a single definition (one author's behaviour is lost with no marker); in the other it keeps both. Neither outcome is a rebase of the other, and the reviewer would have to notice by reading the file. **So: line-overlap predicts textual conflicts, not duplicate additions.** For a file where 16 people are each adding one handler, the dangerous case is the one this matrix does not flag, and the two duplicate pairs above (#1995/#2012 on `v_swap_b32`, #2003/#2007 on `s_bfm_b64`) are exactly that. ## What I would do with this 1. Land one of each duplicate pair first, and tell the other author to rebase onto it (I have already reviewed #2007 at behaviour level and #1995 the same way, so both are safe choices). 2. For `#2006` / `#2005`, whichever goes second needs a one-line rebase of two adjacent dict entries — trivial, but it will be a conflict rather than a merge. 3. Everything else in the table is disjoint: any order among the remaining 12 lands without touching another PR's lines. The script is 40 lines (merge-base, `git diff -U0`, range intersection) if you want it as a CI job — but a cheaper version is just "search the open PR titles for the mnemonic", which would have caught both duplicates before either branch existed. ## Applied to this PR This PR is one half of the #2006 + #2005 overlap: both extend FETCH_FORMATS at lines 87–88, so whichever lands second needs a one-line rebase of two adjacent dict entries. Nothing else here affects you. ## Notes - AI-assisted analysis, computed on `main` `7f149ac9`.
chatgpt-codex-connector[bot commented 2026-11-25 01:02:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:04:15Z.

Code review location: tools/startup/gfx2hlsl.py; line 88

@@ -75,14 +75,17 @@ def strip_header(code):
 # DXGI format -> (BUF_FMT name in FETCH_FORMATS, bytes per element).
 FETCH_DXGI = {2: ('BUF_FMT_32_32_32_32_FLOAT', 16), 6: ('BUF_FMT_32_32_32_FLOAT', 12), 16: ('BUF_FMT_32_32_FLOAT', 8),
               41: ('BUF_FMT_32_FLOAT', 4), 28: ('BUF_FMT_8_8_8_8_UNORM', 4), 49: ('BUF_FMT_8_8_UNORM', 2),
-              61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4)}
+              61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4),
+              24: ('BUF_FMT_2_10_10_10_UNORM', 4)}
 # Typed buffer loads: (word load or None, the four component expressions). Components a format lacks read as
 # 0, 0, 0, 1 here, as in the existing tbuffer translation; that default is an assumption, not a measurement.
 FETCH_FORMATS = {
     'BUF_FMT_8_8_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', 'U(((w >> 16) & 255) / 255.0)', 'U((w >> 24) / 255.0)']),
     'BUF_FMT_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', '0u', 'U(1.0)']),
     'BUF_FMT_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', '0u', '0u', 'U(1.0)']),
     'BUF_FMT_8_UINT': ('{0}.Load(a & ~3u) >> ((a & 3u) * 8u)', ['w & 255u', '0u', '0u', '1u']),
+    # Three 10-bit fields and a 2-bit one in one dword, lowest bits first: x, y, z, then w.
+    'BUF_FMT_2_10_10_10_UNORM': ('ldu({0}, a)', ['U((w & 1023) / 1023.0)', 'U(((w >> 10) & 1023) / 1023.0)', 'U(((w >> 20) & 1023) / 1023.0)', 'U((w >> 30) / 3.0)']),

P1 Badge Decode format 50 with its two-bit X field first

For MTBUF format 50, BUF_FMT_2_10_10_10_UNORM places X in bits 1:0 and Y/Z/W in bits 11:2, 21:12, and 31:22. These expressions instead implement the distinct BUF_FMT_10_10_10_2_UNORM format (44): loading 0x00000003 produces X = 3/1023 instead of 1. Consequently, previously refused MTBUF loads now translate with incorrect component values. The new fixture passes because its reference() repeats the same layout error. Implement the actual format-50 unpacking, and associate the DXGI 24 layout and mapping with a separate format-44 entry.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4687746500 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#discussion_r4687746500). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:04:15Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 88 ~~~~diff @@ -75,14 +75,17 @@ def strip_header(code): # DXGI format -> (BUF_FMT name in FETCH_FORMATS, bytes per element). FETCH_DXGI = {2: ('BUF_FMT_32_32_32_32_FLOAT', 16), 6: ('BUF_FMT_32_32_32_FLOAT', 12), 16: ('BUF_FMT_32_32_FLOAT', 8), 41: ('BUF_FMT_32_FLOAT', 4), 28: ('BUF_FMT_8_8_8_8_UNORM', 4), 49: ('BUF_FMT_8_8_UNORM', 2), - 61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4)} + 61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4), + 24: ('BUF_FMT_2_10_10_10_UNORM', 4)} # Typed buffer loads: (word load or None, the four component expressions). Components a format lacks read as # 0, 0, 0, 1 here, as in the existing tbuffer translation; that default is an assumption, not a measurement. FETCH_FORMATS = { 'BUF_FMT_8_8_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', 'U(((w >> 16) & 255) / 255.0)', 'U((w >> 24) / 255.0)']), 'BUF_FMT_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', '0u', 'U(1.0)']), 'BUF_FMT_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', '0u', '0u', 'U(1.0)']), 'BUF_FMT_8_UINT': ('{0}.Load(a & ~3u) >> ((a & 3u) * 8u)', ['w & 255u', '0u', '0u', '1u']), + # Three 10-bit fields and a 2-bit one in one dword, lowest bits first: x, y, z, then w. + 'BUF_FMT_2_10_10_10_UNORM': ('ldu({0}, a)', ['U((w & 1023) / 1023.0)', 'U(((w >> 10) & 1023) / 1023.0)', 'U(((w >> 20) & 1023) / 1023.0)', 'U((w >> 30) / 3.0)']), ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Decode format 50 with its two-bit X field first** For MTBUF format 50, `BUF_FMT_2_10_10_10_UNORM` places X in bits 1:0 and Y/Z/W in bits 11:2, 21:12, and 31:22. These expressions instead implement the distinct `BUF_FMT_10_10_10_2_UNORM` format (44): loading `0x00000003` produces X = `3/1023` instead of `1`. Consequently, previously refused MTBUF loads now translate with incorrect component values. The new fixture passes because its `reference()` repeats the same layout error. Implement the actual format-50 unpacking, and associate the DXGI 24 layout and mapping with a separate format-44 entry. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-25 01:02:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:04:15Z.

Code review location: CMakeLists.txt; line 2167

@@ -2162,6 +2162,9 @@ if(EXISTS "${INTAKE_PYTHON}")
     # A typed buffer load of BUF_FMT_16_16_16_16_FLOAT reads four halves from one 8-byte element (#1695).
     add_test(NAME startup_gfx2hlsl_tbuffer_16f COMMAND "${INTAKE_PYTHON}" -B
         "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_16f_check.py")
+    # A typed buffer load of BUF_FMT_2_10_10_10_UNORM reads three 10-bit fields and a 2-bit one from one dword (#1723).
+    add_test(NAME startup_gfx2hlsl_tbuffer_2101010 COMMAND "${INTAKE_PYTHON}" -B
+        "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_2101010_check.py")

P1 Badge Document the new capability and reproduction command

This adds a public shader capability and registers a new reproduction test, but changes neither README.md nor docs/experiments.md, violating the explicit documentation requirement in AGENTS.md. Update the relevant capability documentation and record the test invocation and host-expression-only verification scope in docs/experiments.md, as CONTRIBUTING.md also requires, so the published experiment inventory distinguishes this newly accepted format from formats validated through DXIL/WARP readback.

AGENTS.md reference: AGENTS.md:L207-L208

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4687746506 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#discussion_r4687746506). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:04:15Z. **Code review location:** `CMakeLists.txt`; line 2167 ~~~~diff @@ -2162,6 +2162,9 @@ if(EXISTS "${INTAKE_PYTHON}") # A typed buffer load of BUF_FMT_16_16_16_16_FLOAT reads four halves from one 8-byte element (#1695). add_test(NAME startup_gfx2hlsl_tbuffer_16f COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_16f_check.py") + # A typed buffer load of BUF_FMT_2_10_10_10_UNORM reads three 10-bit fields and a 2-bit one from one dword (#1723). + add_test(NAME startup_gfx2hlsl_tbuffer_2101010 COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_2101010_check.py") ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Document the new capability and reproduction command** This adds a public shader capability and registers a new reproduction test, but changes neither `README.md` nor `docs/experiments.md`, violating the explicit documentation requirement in `AGENTS.md`. Update the relevant capability documentation and record the test invocation and host-expression-only verification scope in `docs/experiments.md`, as `CONTRIBUTING.md` also requires, so the published experiment inventory distinguishes this newly accepted format from formats validated through DXIL/WARP readback. AGENTS.md reference: [AGENTS.md:L207-L208](https://github.com/R0Y00/Xbox2Windows/blob/e05cff26769669304744bbab0016e83bd58229d1/AGENTS.md#L207-L208) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
tedin7 commented 2026-11-25 01:02:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:50:31Z.

Code review location: tools/startup/gfx2hlsl.py; line 88

@@ -75,14 +75,17 @@ def strip_header(code):
 # DXGI format -> (BUF_FMT name in FETCH_FORMATS, bytes per element).
 FETCH_DXGI = {2: ('BUF_FMT_32_32_32_32_FLOAT', 16), 6: ('BUF_FMT_32_32_32_FLOAT', 12), 16: ('BUF_FMT_32_32_FLOAT', 8),
               41: ('BUF_FMT_32_FLOAT', 4), 28: ('BUF_FMT_8_8_8_8_UNORM', 4), 49: ('BUF_FMT_8_8_UNORM', 2),
-              61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4)}
+              61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4),
+              24: ('BUF_FMT_2_10_10_10_UNORM', 4)}
 # Typed buffer loads: (word load or None, the four component expressions). Components a format lacks read as
 # 0, 0, 0, 1 here, as in the existing tbuffer translation; that default is an assumption, not a measurement.
 FETCH_FORMATS = {
     'BUF_FMT_8_8_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', 'U(((w >> 16) & 255) / 255.0)', 'U((w >> 24) / 255.0)']),
     'BUF_FMT_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', '0u', 'U(1.0)']),
     'BUF_FMT_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', '0u', '0u', 'U(1.0)']),
     'BUF_FMT_8_UINT': ('{0}.Load(a & ~3u) >> ((a & 3u) * 8u)', ['w & 255u', '0u', '0u', '1u']),
+    # Three 10-bit fields and a 2-bit one in one dword, lowest bits first: x, y, z, then w.
+    'BUF_FMT_2_10_10_10_UNORM': ('ldu({0}, a)', ['U((w & 1023) / 1023.0)', 'U(((w >> 10) & 1023) / 1023.0)', 'U(((w >> 20) & 1023) / 1023.0)', 'U((w >> 30) / 3.0)']),

Fixed in 46d28538 (rebased on origin/main, branch rb2006, pending host force-push). Format 50 now decodes the 2-bit X field first; DXGI 24 maps to new format-44 entry; README and docs/experiments.md updated with repro command and host-expression-only scope. Ran: python3 tests/startup_gfx2hlsl_tbuffer_2101010_check.py (PASS). AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688677951 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#discussion_r4688677951). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:50:31Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 88 ~~~~diff @@ -75,14 +75,17 @@ def strip_header(code): # DXGI format -> (BUF_FMT name in FETCH_FORMATS, bytes per element). FETCH_DXGI = {2: ('BUF_FMT_32_32_32_32_FLOAT', 16), 6: ('BUF_FMT_32_32_32_FLOAT', 12), 16: ('BUF_FMT_32_32_FLOAT', 8), 41: ('BUF_FMT_32_FLOAT', 4), 28: ('BUF_FMT_8_8_8_8_UNORM', 4), 49: ('BUF_FMT_8_8_UNORM', 2), - 61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4)} + 61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4), + 24: ('BUF_FMT_2_10_10_10_UNORM', 4)} # Typed buffer loads: (word load or None, the four component expressions). Components a format lacks read as # 0, 0, 0, 1 here, as in the existing tbuffer translation; that default is an assumption, not a measurement. FETCH_FORMATS = { 'BUF_FMT_8_8_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', 'U(((w >> 16) & 255) / 255.0)', 'U((w >> 24) / 255.0)']), 'BUF_FMT_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', '0u', 'U(1.0)']), 'BUF_FMT_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', '0u', '0u', 'U(1.0)']), 'BUF_FMT_8_UINT': ('{0}.Load(a & ~3u) >> ((a & 3u) * 8u)', ['w & 255u', '0u', '0u', '1u']), + # Three 10-bit fields and a 2-bit one in one dword, lowest bits first: x, y, z, then w. + 'BUF_FMT_2_10_10_10_UNORM': ('ldu({0}, a)', ['U((w & 1023) / 1023.0)', 'U(((w >> 10) & 1023) / 1023.0)', 'U(((w >> 20) & 1023) / 1023.0)', 'U((w >> 30) / 3.0)']), ~~~~ --- Fixed in 46d28538 (rebased on origin/main, branch rb2006, pending host force-push). Format 50 now decodes the 2-bit X field first; DXGI 24 maps to new format-44 entry; README and docs/experiments.md updated with repro command and host-expression-only scope. Ran: python3 tests/startup_gfx2hlsl_tbuffer_2101010_check.py (PASS). AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 01:02:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:50:33Z.

Code review location: CMakeLists.txt; line 2167

@@ -2162,6 +2162,9 @@ if(EXISTS "${INTAKE_PYTHON}")
     # A typed buffer load of BUF_FMT_16_16_16_16_FLOAT reads four halves from one 8-byte element (#1695).
     add_test(NAME startup_gfx2hlsl_tbuffer_16f COMMAND "${INTAKE_PYTHON}" -B
         "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_16f_check.py")
+    # A typed buffer load of BUF_FMT_2_10_10_10_UNORM reads three 10-bit fields and a 2-bit one from one dword (#1723).
+    add_test(NAME startup_gfx2hlsl_tbuffer_2101010 COMMAND "${INTAKE_PYTHON}" -B
+        "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_2101010_check.py")

Fixed in 46d28538 (rebased on origin/main, branch rb2006, pending host force-push). Format 50 now decodes the 2-bit X field first; DXGI 24 maps to new format-44 entry; README and docs/experiments.md updated with repro command and host-expression-only scope. Ran: python3 tests/startup_gfx2hlsl_tbuffer_2101010_check.py (PASS). AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688678255 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#discussion_r4688678255). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:50:33Z. **Code review location:** `CMakeLists.txt`; line 2167 ~~~~diff @@ -2162,6 +2162,9 @@ if(EXISTS "${INTAKE_PYTHON}") # A typed buffer load of BUF_FMT_16_16_16_16_FLOAT reads four halves from one 8-byte element (#1695). add_test(NAME startup_gfx2hlsl_tbuffer_16f COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_16f_check.py") + # A typed buffer load of BUF_FMT_2_10_10_10_UNORM reads three 10-bit fields and a 2-bit one from one dword (#1723). + add_test(NAME startup_gfx2hlsl_tbuffer_2101010 COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_2101010_check.py") ~~~~ --- Fixed in 46d28538 (rebased on origin/main, branch rb2006, pending host force-push). Format 50 now decodes the 2-bit X field first; DXGI 24 maps to new format-44 entry; README and docs/experiments.md updated with repro command and host-expression-only scope. Ran: python3 tests/startup_gfx2hlsl_tbuffer_2101010_check.py (PASS). AI-assisted; commands listed were executed locally.
RavenCurseBurg commented 2026-11-25 08:05:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T07:54:03Z.


I ran an independent device readback against the translator at 2a920695. The test-only commit applies directly to this head and extends the existing format suite.

On WARP and a physical D3D12 adapter, I compiled the generated VS with DXC and invoked the same vertex body from the compute readback wrapper. Sixteen packed vertices at stride 5, offset 3 cover all four byte alignments and all four alpha levels. On each adapter all 64 decoded components and 256 surrounding sentinel words matched. Reading blue from green, dividing alpha by four and replacing the unaligned load with an aligned load each produced a readback mismatch. The existing device-free test also passed.

Reproduce with python -B tests/startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warp and again with hardware. Both full runs passed all 13 formats and detected all 12 shader mutations. The local debug layer was unavailable.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7156378301 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7156378301). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T07:54:03Z. --- I ran an independent device readback against the translator at `2a920695`. The [test-only commit](https://github.com/RavenCurseBurg/Xbox2Windows/commit/61db123d46390bcf61d22ab23a118ebba28026fe) applies directly to this head and extends the existing format suite. On WARP and a physical D3D12 adapter, I compiled the generated VS with DXC and invoked the same vertex body from the compute readback wrapper. Sixteen packed vertices at stride 5, offset 3 cover all four byte alignments and all four alpha levels. On each adapter all 64 decoded components and 256 surrounding sentinel words matched. Reading blue from green, dividing alpha by four and replacing the unaligned load with an aligned load each produced a readback mismatch. The existing device-free test also passed. Reproduce with `python -B tests/startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warp` and again with `hardware`. Both full runs passed all 13 formats and detected all 12 shader mutations. The local debug layer was unavailable.
tedin7 commented 2026-11-25 11:02:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:01:23Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6056364582 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#pullrequestreview-6056364582). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T11:01:23Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 11:02:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:01:26Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6056365398 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#pullrequestreview-6056365398). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T11:01:26Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 11:02:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:01:23Z.

Code review location: tools/startup/gfx2hlsl.py; line 88

@@ -75,14 +75,17 @@ def strip_header(code):
 # DXGI format -> (BUF_FMT name in FETCH_FORMATS, bytes per element).
 FETCH_DXGI = {2: ('BUF_FMT_32_32_32_32_FLOAT', 16), 6: ('BUF_FMT_32_32_32_FLOAT', 12), 16: ('BUF_FMT_32_32_FLOAT', 8),
               41: ('BUF_FMT_32_FLOAT', 4), 28: ('BUF_FMT_8_8_8_8_UNORM', 4), 49: ('BUF_FMT_8_8_UNORM', 2),
-              61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4)}
+              61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4),
+              24: ('BUF_FMT_2_10_10_10_UNORM', 4)}
 # Typed buffer loads: (word load or None, the four component expressions). Components a format lacks read as
 # 0, 0, 0, 1 here, as in the existing tbuffer translation; that default is an assumption, not a measurement.
 FETCH_FORMATS = {
     'BUF_FMT_8_8_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', 'U(((w >> 16) & 255) / 255.0)', 'U((w >> 24) / 255.0)']),
     'BUF_FMT_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', '0u', 'U(1.0)']),
     'BUF_FMT_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', '0u', '0u', 'U(1.0)']),
     'BUF_FMT_8_UINT': ('{0}.Load(a & ~3u) >> ((a & 3u) * 8u)', ['w & 255u', '0u', '0u', '1u']),
+    # Three 10-bit fields and a 2-bit one in one dword, lowest bits first: x, y, z, then w.
+    'BUF_FMT_2_10_10_10_UNORM': ('ldu({0}, a)', ['U((w & 1023) / 1023.0)', 'U(((w >> 10) & 1023) / 1023.0)', 'U(((w >> 20) & 1023) / 1023.0)', 'U((w >> 30) / 3.0)']),

Re-checked on current head 328b603d: format 50 decodes the 2-bit X field first (confirmed by #2192, 2e4f44cb), and the capability, test registration and reproduction command are documented (328b603d). Resolving. AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4693917069 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#discussion_r4693917069). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T11:01:23Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 88 ~~~~diff @@ -75,14 +75,17 @@ def strip_header(code): # DXGI format -> (BUF_FMT name in FETCH_FORMATS, bytes per element). FETCH_DXGI = {2: ('BUF_FMT_32_32_32_32_FLOAT', 16), 6: ('BUF_FMT_32_32_32_FLOAT', 12), 16: ('BUF_FMT_32_32_FLOAT', 8), 41: ('BUF_FMT_32_FLOAT', 4), 28: ('BUF_FMT_8_8_8_8_UNORM', 4), 49: ('BUF_FMT_8_8_UNORM', 2), - 61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4)} + 61: ('BUF_FMT_8_UNORM', 1), 34: ('BUF_FMT_16_16_FLOAT', 4), 35: ('BUF_FMT_16_16_UNORM', 4), + 24: ('BUF_FMT_2_10_10_10_UNORM', 4)} # Typed buffer loads: (word load or None, the four component expressions). Components a format lacks read as # 0, 0, 0, 1 here, as in the existing tbuffer translation; that default is an assumption, not a measurement. FETCH_FORMATS = { 'BUF_FMT_8_8_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', 'U(((w >> 16) & 255) / 255.0)', 'U((w >> 24) / 255.0)']), 'BUF_FMT_8_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', 'U(((w >> 8) & 255) / 255.0)', '0u', 'U(1.0)']), 'BUF_FMT_8_UNORM': ('ldu({0}, a)', ['U((w & 255) / 255.0)', '0u', '0u', 'U(1.0)']), 'BUF_FMT_8_UINT': ('{0}.Load(a & ~3u) >> ((a & 3u) * 8u)', ['w & 255u', '0u', '0u', '1u']), + # Three 10-bit fields and a 2-bit one in one dword, lowest bits first: x, y, z, then w. + 'BUF_FMT_2_10_10_10_UNORM': ('ldu({0}, a)', ['U((w & 1023) / 1023.0)', 'U(((w >> 10) & 1023) / 1023.0)', 'U(((w >> 20) & 1023) / 1023.0)', 'U((w >> 30) / 3.0)']), ~~~~ --- Re-checked on current head 328b603d: format 50 decodes the 2-bit X field first (confirmed by #2192, 2e4f44cb), and the capability, test registration and reproduction command are documented (328b603d). Resolving. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 11:02:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:01:26Z.

Code review location: CMakeLists.txt; line 2167

@@ -2162,6 +2162,9 @@ if(EXISTS "${INTAKE_PYTHON}")
     # A typed buffer load of BUF_FMT_16_16_16_16_FLOAT reads four halves from one 8-byte element (#1695).
     add_test(NAME startup_gfx2hlsl_tbuffer_16f COMMAND "${INTAKE_PYTHON}" -B
         "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_16f_check.py")
+    # A typed buffer load of BUF_FMT_2_10_10_10_UNORM reads three 10-bit fields and a 2-bit one from one dword (#1723).
+    add_test(NAME startup_gfx2hlsl_tbuffer_2101010 COMMAND "${INTAKE_PYTHON}" -B
+        "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_2101010_check.py")

Re-checked on current head 328b603d: format 50 decodes the 2-bit X field first (confirmed by #2192, 2e4f44cb), and the capability, test registration and reproduction command are documented (328b603d). Resolving. AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4693917619 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#discussion_r4693917619). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T11:01:26Z. **Code review location:** `CMakeLists.txt`; line 2167 ~~~~diff @@ -2162,6 +2162,9 @@ if(EXISTS "${INTAKE_PYTHON}") # A typed buffer load of BUF_FMT_16_16_16_16_FLOAT reads four halves from one 8-byte element (#1695). add_test(NAME startup_gfx2hlsl_tbuffer_16f COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_16f_check.py") + # A typed buffer load of BUF_FMT_2_10_10_10_UNORM reads three 10-bit fields and a 2-bit one from one dword (#1723). + add_test(NAME startup_gfx2hlsl_tbuffer_2101010 COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_2101010_check.py") ~~~~ --- Re-checked on current head 328b603d: format 50 decodes the 2-bit X field first (confirmed by #2192, 2e4f44cb), and the capability, test registration and reproduction command are documented (328b603d). Resolving. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 12:01:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:54:36Z.


Thank you @ChazY11 for the four-mutation run and the DXGI cross-check of the unpacking, and @RavenCurseBurg for the independent WARP + hardware readback at 2a920695 (13 formats passed, 12 shader mutations detected). Recorded as extra evidence for this PR.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7161666291 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7161666291). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T11:54:36Z. --- Thank you @ChazY11 for the four-mutation run and the DXGI cross-check of the unpacking, and @RavenCurseBurg for the independent WARP + hardware readback at `2a920695` (13 formats passed, 12 shader mutations detected). Recorded as extra evidence for this PR. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 13:00:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:05:37Z.


Thanks @ChazY11 for the merge matrix, and @RavenCurseBurg for the readback.

I merged origin/main into this branch (plain merge, no rebase). It was clean, with no conflicts. The new head is 9fcd600a. The old head was 328b603d.

The diff against main is now only our 4 files (+134/-1): tools/startup/gfx2hlsl.py, the new tbuffer test, CMakeLists.txt and docs/experiments.md. The earlier phantom deletions of the VEC_U entries are gone.

On the #2005 overlap: whichever of #2006 and #2005 lands second needs a small rebase of the adjacent FETCH_FORMATS entries. I will do that for this PR if #2005 lands first.

Commands run locally on Linux:

  • git merge origin/main
  • python3 -I -B tests/startup_gfx2hlsl_tbuffer_2101010_check.py (PASS)
  • python3 -I -B tests/startup_gfx2hlsl_int_med3_check.py (PASS)
  • python3 -I -B -m py_compile tools/startup/gfx2hlsl.py

The Windows WARP run is still pending on the new head.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7161909558 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7161909558). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:05:37Z. --- Thanks @ChazY11 for the merge matrix, and @RavenCurseBurg for the readback. I merged `origin/main` into this branch (plain merge, no rebase). It was clean, with no conflicts. The new head is `9fcd600a`. The old head was `328b603d`. The diff against `main` is now only our 4 files (+134/-1): `tools/startup/gfx2hlsl.py`, the new tbuffer test, `CMakeLists.txt` and `docs/experiments.md`. The earlier phantom deletions of the `VEC_U` entries are gone. On the #2005 overlap: whichever of #2006 and #2005 lands second needs a small rebase of the adjacent `FETCH_FORMATS` entries. I will do that for this PR if #2005 lands first. Commands run locally on Linux: - `git merge origin/main` - `python3 -I -B tests/startup_gfx2hlsl_tbuffer_2101010_check.py` (PASS) - `python3 -I -B tests/startup_gfx2hlsl_int_med3_check.py` (PASS) - `python3 -I -B -m py_compile tools/startup/gfx2hlsl.py` The Windows WARP run is still pending on the new head. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 14:04:25 +00:00
tedin7 commented 2026-11-25 14:05:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:51:32Z.


Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is.

We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7164393088 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7164393088). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:51:32Z. --- Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is. We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here. AI-assisted; commands listed were executed locally.
upstream-sync reopened this pull request 2026-11-26 01:01:46 +00:00
tedin7 commented 2026-11-26 04:04:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:46:31Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit c23207494ca2ca604bf2df4d11cae90efcfbe9bf:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2): 160.87s (configure 4.49s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2): 205.87s (configure 3.62s)
  • Windows Python checks: tests/mesh_heap_sampler_check.py ok (1.0s), tests/startup_buffer_address_check.py ok (0.5s), tests/startup_buffer_format_word3_table_check.py ok (0.1s), tests/startup_compute_request_offline_check.py ok (0.5s), tests/startup_compute_store_format_xyzw_check.py ok (0.3s), tests/startup_compute_translate_check.py ok (0.2s), tests/startup_flat_param_check.py ok (0.2s), tests/startup_gfx2hlsl_add_sub_co_check.py ok (0.1s), tests/startup_gfx2hlsl_add_sub_co_ci_check.py ok (0.2s), tests/startup_gfx2hlsl_bit_alu_check.py ok (0.8s), tests/startup_gfx2hlsl_capture_check.py ok (1.2s), tests/startup_gfx2hlsl_cmp16_check.py ok (0.4s), tests/startup_gfx2hlsl_cmp_class_f16_sdwa_check.py ok (39.9s), tests/startup_gfx2hlsl_compare_dst_check.py ok (0.1s), tests/startup_gfx2hlsl_compute_check.py ok (0.5s), tests/startup_gfx2hlsl_cselect_mask_check.py ok (0.1s), tests/startup_gfx2hlsl_cvt_alu_check.py ok (0.3s), tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py ok (0.3s), tests/startup_gfx2hlsl_cvt_pk_int16_check.py ok (0.3s), tests/startup_gfx2hlsl_f32_lg_check.py ok (1.3s), tests/startup_gfx2hlsl_f32_nan_check.py ok (5.3s), tests/startup_gfx2hlsl_fma_mix_check.py ok (0.1s), tests/startup_gfx2hlsl_getpc_refusal_check.py ok (0.1s), tests/startup_gfx2hlsl_handler_arity_check.py ok (0.1s), tests/startup_gfx2hlsl_heap_record_check.py ok (0.2s), tests/startup_gfx2hlsl_image_arity_check.py ok (0.1s), tests/startup_gfx2hlsl_image_get_lod_check.py ok (0.2s), tests/startup_gfx2hlsl_int_med3_check.py ok (0.1s), tests/startup_gfx2hlsl_interp_p2_hi_check.py ok (0.3s), tests/startup_gfx2hlsl_join_symbols_check.py ok (0.3s), tests/startup_gfx2hlsl_loop_constants_check.py ok (0.1s), tests/startup_gfx2hlsl_mask_data_check.py ok (0.1s), tests/startup_gfx2hlsl_mask_overwrite_check.py ok (0.1s), tests/startup_gfx2hlsl_operand_count_check.py ok (0.4s), tests/startup_gfx2hlsl_pack_absdiff_check.py ok (3.1s), tests/startup_gfx2hlsl_pack_b32_f16_check.py ok (0.2s), tests/startup_gfx2hlsl_readfirstlane_recompute_check.py ok (0.1s), tests/startup_gfx2hlsl_readfirstlane_uniform_check.py ok (0.2s), tests/startup_gfx2hlsl_refusals_check.py ok (0.8s), tests/startup_gfx2hlsl_root_check.py ok (1.0s), tests/startup_gfx2hlsl_s_abs_check.py ok (0.1s), tests/startup_gfx2hlsl_s_bitset_check.py ok (0.2s), tests/startup_gfx2hlsl_s_ff0_check.py ok (0.1s), tests/startup_gfx2hlsl_s_ff1_check.py ok (0.1s), tests/startup_gfx2hlsl_s_flbit_check.py ok (0.1s), tests/startup_gfx2hlsl_s_quadmask_check.py ok (0.2s), tests/startup_gfx2hlsl_sad_check.py ok (0.6s), tests/startup_gfx2hlsl_saveexec_same_reg_check.py ok (0.2s), tests/startup_gfx2hlsl_scalar_arity_check.py ok (0.3s), tests/startup_gfx2hlsl_scalar_brev_fold_check.py ok (0.2s), tests/startup_gfx2hlsl_scalar_m0_check.py ok (0.2s), tests/startup_gfx2hlsl_scalar_null_check.py ok (0.4s), tests/startup_gfx2hlsl_scalar_table_arity_check.py ok (0.6s), tests/startup_gfx2hlsl_sdwa_cndmask_check.py ok (0.3s), tests/startup_gfx2hlsl_sdwa_cvt_check.py ok (0.4s), tests/startup_gfx2hlsl_sgpr_spill_check.py ok (0.2s), tests/startup_gfx2hlsl_shift64_check.py ok (0.3s), tests/startup_gfx2hlsl_sload_const_offset_check.py ok (0.1s), tests/startup_gfx2hlsl_smem_offset_check.py ok (0.1s), tests/startup_gfx2hlsl_sop2_complement_check.py ok (8.1s), tests/startup_gfx2hlsl_sopk_accum_check.py ok (1.7s), tests/startup_gfx2hlsl_sopk_signext_check.py ok (0.2s), tests/startup_gfx2hlsl_spill_branches_check.py ok (1.7s), tests/startup_gfx2hlsl_swap_check.py ok (0.6s), tests/startup_gfx2hlsl_vopc_sdwa_check.py ok (8.8s), tests/startup_gfx2hlsl_waitcnt_depctr_check.py ok (0.2s), tests/startup_gfx2hlsl_watch_check.py ok (3.1s), tests/startup_image_2d_array_check.py ok (0.3s), tests/startup_image_3d_check.py ok (0.3s), tests/startup_image_gather_lz_check.py ok (1.0s), tests/startup_image_load_d16_check.py ok (1.6s), tests/startup_image_sample_a16_check.py ok (0.3s), tests/startup_image_sample_b_check.py ok (0.3s), tests/startup_image_sample_c_check.py ok (0.4s), tests/startup_image_sample_l_check.py ok (0.3s), tests/startup_image_sample_lod_check.py ok (1.1s), tests/startup_inline_sampler_check.py ok (0.3s), tests/startup_mesh57_depth_only_check.py ok (0.3s), tests/startup_mesh57_lane_spill_check.py ok (0.4s), tests/startup_mesh57_loop_check.py ok (0.3s), tests/startup_mesh57_loop_refusal_check.py ok (0.3s), tests/startup_mesh57_skeleton_check.py ok (2.1s), tests/startup_run_ps1_check.py ok (34.8s), tests/startup_run_sh_check.py skipped (0.7s), tests/startup_sampler_heap_check.py ok (0.3s), tests/startup_shader_cache_rekey_check.py ok (7.4s), tests/startup_smem_address_check.py ok (0.3s), tests/startup_stream_fetch_check.py ok (0.4s), tests/startup_stream_interface_check.py ok (0.4s), tests/startup_translator_check.py ok (0.7s)
  • sccache: 34/77 hits; wall 526.5s
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7182012341 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7182012341). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:46:31Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `c23207494ca2ca604bf2df4d11cae90efcfbe9bf`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2`): `160.87s` (configure `4.49s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2`): `205.87s` (configure `3.62s`) - **Windows Python checks**: `tests/mesh_heap_sampler_check.py` ok (`1.0s`), `tests/startup_buffer_address_check.py` ok (`0.5s`), `tests/startup_buffer_format_word3_table_check.py` ok (`0.1s`), `tests/startup_compute_request_offline_check.py` ok (`0.5s`), `tests/startup_compute_store_format_xyzw_check.py` ok (`0.3s`), `tests/startup_compute_translate_check.py` ok (`0.2s`), `tests/startup_flat_param_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_add_sub_co_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_add_sub_co_ci_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_bit_alu_check.py` ok (`0.8s`), `tests/startup_gfx2hlsl_capture_check.py` ok (`1.2s`), `tests/startup_gfx2hlsl_cmp16_check.py` ok (`0.4s`), `tests/startup_gfx2hlsl_cmp_class_f16_sdwa_check.py` ok (`39.9s`), `tests/startup_gfx2hlsl_compare_dst_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_compute_check.py` ok (`0.5s`), `tests/startup_gfx2hlsl_cselect_mask_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_cvt_alu_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_cvt_pk_int16_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_f32_lg_check.py` ok (`1.3s`), `tests/startup_gfx2hlsl_f32_nan_check.py` ok (`5.3s`), `tests/startup_gfx2hlsl_fma_mix_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_getpc_refusal_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_handler_arity_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_heap_record_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_image_arity_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_image_get_lod_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_int_med3_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_interp_p2_hi_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_join_symbols_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_loop_constants_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_mask_data_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_mask_overwrite_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_operand_count_check.py` ok (`0.4s`), `tests/startup_gfx2hlsl_pack_absdiff_check.py` ok (`3.1s`), `tests/startup_gfx2hlsl_pack_b32_f16_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_readfirstlane_recompute_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_readfirstlane_uniform_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_refusals_check.py` ok (`0.8s`), `tests/startup_gfx2hlsl_root_check.py` ok (`1.0s`), `tests/startup_gfx2hlsl_s_abs_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_s_bitset_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_s_ff0_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_s_ff1_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_s_flbit_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_s_quadmask_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_sad_check.py` ok (`0.6s`), `tests/startup_gfx2hlsl_saveexec_same_reg_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_scalar_arity_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_scalar_brev_fold_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_scalar_m0_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_scalar_null_check.py` ok (`0.4s`), `tests/startup_gfx2hlsl_scalar_table_arity_check.py` ok (`0.6s`), `tests/startup_gfx2hlsl_sdwa_cndmask_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_sdwa_cvt_check.py` ok (`0.4s`), `tests/startup_gfx2hlsl_sgpr_spill_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_shift64_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_sload_const_offset_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_smem_offset_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_sop2_complement_check.py` ok (`8.1s`), `tests/startup_gfx2hlsl_sopk_accum_check.py` ok (`1.7s`), `tests/startup_gfx2hlsl_sopk_signext_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_spill_branches_check.py` ok (`1.7s`), `tests/startup_gfx2hlsl_swap_check.py` ok (`0.6s`), `tests/startup_gfx2hlsl_vopc_sdwa_check.py` ok (`8.8s`), `tests/startup_gfx2hlsl_waitcnt_depctr_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_watch_check.py` ok (`3.1s`), `tests/startup_image_2d_array_check.py` ok (`0.3s`), `tests/startup_image_3d_check.py` ok (`0.3s`), `tests/startup_image_gather_lz_check.py` ok (`1.0s`), `tests/startup_image_load_d16_check.py` ok (`1.6s`), `tests/startup_image_sample_a16_check.py` ok (`0.3s`), `tests/startup_image_sample_b_check.py` ok (`0.3s`), `tests/startup_image_sample_c_check.py` ok (`0.4s`), `tests/startup_image_sample_l_check.py` ok (`0.3s`), `tests/startup_image_sample_lod_check.py` ok (`1.1s`), `tests/startup_inline_sampler_check.py` ok (`0.3s`), `tests/startup_mesh57_depth_only_check.py` ok (`0.3s`), `tests/startup_mesh57_lane_spill_check.py` ok (`0.4s`), `tests/startup_mesh57_loop_check.py` ok (`0.3s`), `tests/startup_mesh57_loop_refusal_check.py` ok (`0.3s`), `tests/startup_mesh57_skeleton_check.py` ok (`2.1s`), `tests/startup_run_ps1_check.py` ok (`34.8s`), `tests/startup_run_sh_check.py` skipped (`0.7s`), `tests/startup_sampler_heap_check.py` ok (`0.3s`), `tests/startup_shader_cache_rekey_check.py` ok (`7.4s`), `tests/startup_smem_address_check.py` ok (`0.3s`), `tests/startup_stream_fetch_check.py` ok (`0.4s`), `tests/startup_stream_interface_check.py` ok (`0.4s`), `tests/startup_translator_check.py` ok (`0.7s`) - `sccache`: 34/77 hits; wall `526.5s`
tedin7 commented 2026-11-26 04:04:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:46:32Z.


@MasterDomino: #2006 is ready for review/merge.

What changed: merged current main into the branch (one docs conflict in docs/experiments.md, kept both sections). New head c2320749.

Verification:

  • python3 tests/startup_gfx2hlsl_tbuffer_2101010_check.py PASS
  • python3 tests/startup_buffer_format_word3_table_check.py ok
  • Win2025 WARP dev + release PASS on c23207494ca2ca604bf2df4d11cae90efcfbe9bf (receipt in the comment above), including the D3D12 WARP readback fetch test

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7182012536 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7182012536). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:46:32Z. --- @MasterDomino: #2006 is ready for review/merge. What changed: merged current main into the branch (one docs conflict in `docs/experiments.md`, kept both sections). New head `c2320749`. Verification: - `python3 tests/startup_gfx2hlsl_tbuffer_2101010_check.py` PASS - `python3 tests/startup_buffer_format_word3_table_check.py` ok - Win2025 WARP dev + release PASS on `c23207494ca2ca604bf2df4d11cae90efcfbe9bf` (receipt in the comment above), including the D3D12 WARP readback fetch test AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 07:00:07 +00:00
MasterDomino commented 2026-11-26 07:00:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T06:25:11Z.

Review: CHANGES_REQUESTED


Reviewed c2320749.

The decode is right:

  • x, y and z come from bits 9:0, 19:10 and 29:20, and w is bits 31:30 / 3. That's the R10G10B10A2 layout; llvm-mc 15 encodes BUF_DATA_FORMAT_2_10_10_10 + UNORM as unified format 50.
  • Formats 44–49 and 51–55 stay refused.
  • The earlier thread replies saying format 50 "decodes the 2-bit X field first" don't match the code or docs/experiments.md. The code is the correct one.

Three things before merge:

  1. Cache revision. mubuf_format's run-time FORMAT switch gains case 50u in programs that already translate; 8 compute programs from the existing compute checks change. With the shim now accepting code 50, a cached shader from the current revision would return the 0x7fc0f0f0 sentinel. main is now at x2w-startup-shader-19 / 19cs (since #2708). Please move both to 20 / 20cs, or one past whatever lands first; the switch is emitted for every stage, so the graphics key moves too.
  2. Runtime-shim regression. tests/startup_buffer_format_word3_check.cpp doesn't list DXGI_FORMAT_R10G10B10A2_UNORM. Dropping case 50 from formatted_buffer.h, or the R10G10B10A2 line from buffer_format_word3.h, still passes that source-built check; only the text-parsing table checks fail. Please add it to decoded[], and check that view_word3 gives 50u << 12 | identity.
  3. Docs and description. docs/experiments.md still says no D3D12 draw has been run for the format, but startup_vertex_fetch_formats_warp / _hardware now read it back. The PR description still says Win2025 hasn't been run.

Runs: Windows 11 build 26300; AMD Radeon RX 9070 XT (driver 32.0.32029.2010); WARP 10.0.26100.9818.

  • At c2320749: ctest --preset dev -R "tbuffer|vertex_fetch_formats|buffer_format_word3|formatted" 12/12. Format 50 reads back at stride 6 / offset 2 and through the descriptor path with 0 mismatches, and its three mutations fail.
  • Neighbours: -R "startup_gfx2hlsl|startup_compute_|startup_mesh57_formatted" 386/389:
    • fma_mix_dispatch_hardware (#2746);
    • startup_compute_dispatch_texture_warp / _hardware, which pass once merged with current main.
  • On a local merge with main: startup_vertex_fetch_formats_* stop at a source gate. That gate also fails on main since #2596, unrelated to this PR (noted on #2596).
  • Mutants caught: x/z swapped, alpha from bit 31, SNORM accepted with the UNORM decode, descriptor code 50 → 51, and DXGI 24 dropped. The two shim mutants above survive the source-built check.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069476338 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#pullrequestreview-6069476338). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T06:25:11Z. **Review:** CHANGES_REQUESTED --- Reviewed `c2320749`. **The decode is right:** - x, y and z come from bits 9:0, 19:10 and 29:20, and w is bits 31:30 / 3. That's the R10G10B10A2 layout; llvm-mc 15 encodes `BUF_DATA_FORMAT_2_10_10_10` + UNORM as unified format 50. - Formats 44–49 and 51–55 stay refused. - The earlier thread replies saying format 50 "decodes the 2-bit X field first" don't match the code or `docs/experiments.md`. The code is the correct one. **Three things before merge:** 1. **Cache revision.** `mubuf_format`'s run-time FORMAT switch gains `case 50u` in programs that already translate; 8 compute programs from the existing compute checks change. With the shim now accepting code 50, a cached shader from the current revision would return the 0x7fc0f0f0 sentinel. `main` is now at `x2w-startup-shader-19` / `19cs` (since #2708). Please move both to `20` / `20cs`, or one past whatever lands first; the switch is emitted for every stage, so the graphics key moves too. 2. **Runtime-shim regression.** `tests/startup_buffer_format_word3_check.cpp` doesn't list `DXGI_FORMAT_R10G10B10A2_UNORM`. Dropping `case 50` from `formatted_buffer.h`, or the R10G10B10A2 line from `buffer_format_word3.h`, still passes that source-built check; only the text-parsing table checks fail. Please add it to `decoded[]`, and check that `view_word3` gives `50u << 12 | identity`. 3. **Docs and description.** `docs/experiments.md` still says no D3D12 draw has been run for the format, but `startup_vertex_fetch_formats_warp` / `_hardware` now read it back. The PR description still says Win2025 hasn't been run. Runs: Windows 11 build 26300; AMD Radeon RX 9070 XT (driver 32.0.32029.2010); WARP 10.0.26100.9818. - **At `c2320749`:** `ctest --preset dev -R "tbuffer|vertex_fetch_formats|buffer_format_word3|formatted"` 12/12. Format 50 reads back at stride 6 / offset 2 and through the descriptor path with 0 mismatches, and its three mutations fail. - **Neighbours:** `-R "startup_gfx2hlsl|startup_compute_|startup_mesh57_formatted"` 386/389: - `fma_mix_dispatch_hardware` (#2746); - `startup_compute_dispatch_texture_warp` / `_hardware`, which pass once merged with current `main`. - **On a local merge with `main`:** `startup_vertex_fetch_formats_*` stop at a source gate. That gate also fails on `main` since #2596, unrelated to this PR (noted on #2596). - **Mutants caught:** x/z swapped, alpha from bit 31, SNORM accepted with the UNORM decode, descriptor code 50 → 51, and DXGI 24 dropped. The two shim mutants above survive the source-built check. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-26 07:00:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T06:32:30Z.

Review: APPROVED


Rebuilt the Release renderer and ran all seven format checks. Both WARP and RTX 4060 Laptop passed the packed format draws. The composed main extracts FORMAT and token handling through the shared word3 decoder, and the updated gate check catches clearing that check or skipping the decoder call. The packed normalization and field-order controls continue to run.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069535112 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#pullrequestreview-6069535112). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T06:32:30Z. **Review:** APPROVED --- Rebuilt the Release renderer and ran all seven format checks. Both WARP and RTX 4060 Laptop passed the packed format draws. The composed main extracts FORMAT and token handling through the shared word3 decoder, and the updated gate check catches clearing that check or skipping the decoder call. The packed normalization and field-order controls continue to run.
MasterDomino commented 2026-11-26 07:00:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T06:44:25Z.

Review: APPROVED


Approving a2e70c73. My change request is resolved.

  • Cache revision: it moves to x2w-startup-shader-20 / 20cs. No 18 / 19 literal is left in src, tools or tests, apart from the fract check's historical seed comparison.
  • Source-built shim regression: startup_buffer_format_word3_check.cpp now covers DXGI_FORMAT_R10G10B10A2_UNORM. Dropping case 50 from formatted_buffer.h now fails it: FAIL DXGI format 24: code 50. Restored, it passes again.
  • Vertex preflight gate: R0Y00's 6e9917f3 fixed the gate, so the format-50 readback runs again on top of main.

Run at this head (Windows 11 build 26300, --preset dev; AMD Radeon RX 9070 XT, driver 32.0.32029.2010; WARP 10.0.26100.9818):

ctest --preset dev --no-tests=error -R 'buffer_format_word3|tbuffer|vertex_fetch_formats|shader_cache_key|compute_request_offline'

10/10 passed, including startup_vertex_fetch_formats_warp and _hardware and startup_gfx2hlsl_tbuffer_2101010.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069636346 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#pullrequestreview-6069636346). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T06:44:25Z. **Review:** APPROVED --- Approving `a2e70c73`. My change request is resolved. - **Cache revision:** it moves to `x2w-startup-shader-20` / `20cs`. No `18` / `19` literal is left in `src`, `tools` or `tests`, apart from the fract check's historical seed comparison. - **Source-built shim regression:** `startup_buffer_format_word3_check.cpp` now covers `DXGI_FORMAT_R10G10B10A2_UNORM`. Dropping `case 50` from `formatted_buffer.h` now fails it: `FAIL DXGI format 24: code 50`. Restored, it passes again. - **Vertex preflight gate:** R0Y00's `6e9917f3` fixed the gate, so the format-50 readback runs again on top of `main`. Run at this head (Windows 11 build 26300, `--preset dev`; AMD Radeon RX 9070 XT, driver 32.0.32029.2010; WARP 10.0.26100.9818): ```powershell ctest --preset dev --no-tests=error -R 'buffer_format_word3|tbuffer|vertex_fetch_formats|shader_cache_key|compute_request_offline' ``` 10/10 passed, including `startup_vertex_fetch_formats_warp` and `_hardware` and `startup_gfx2hlsl_tbuffer_2101010`. AI-assisted; commands listed were executed locally.
MasterDomino commented 2026-11-26 07:00:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T06:34:13Z.


@R0Y00, thanks. 6e9917f3 also fixes the vertex-preflight gate I reported on #2596, so startup_vertex_fetch_formats_* can run on a merge again.

My change request at c2320749 is still open on two points:

  1. Cache revision. mubuf_format's run-time FORMAT switch gains case 50u in programs that already translate; 8 existing compute programs from the compute checks change. A shader cached at 19 / 19cs before this lands therefore keeps the old switch. With the shim now accepting code 50, it would return the 0x7fc0f0f0 sentinel instead of the decoded value. The head still keys 19 / 19cs. Do you want the bump to 20 / 20cs here, or do you consider the stale entry acceptable? If you're fine without it, I'll dismiss my request.
  2. Source-built shim regression. tests/startup_buffer_format_word3_check.cpp still doesn't list DXGI_FORMAT_R10G10B10A2_UNORM. Dropping case 50 from formatted_buffer.h passes that C++ check; only the text-parsing checks fail. One row in decoded[] would pin it. The docs line about no D3D12 draw is minor.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7184560623 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7184560623). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T06:34:13Z. --- @R0Y00, thanks. `6e9917f3` also fixes the vertex-preflight gate I reported on #2596, so `startup_vertex_fetch_formats_*` can run on a merge again. My change request at `c2320749` is still open on two points: 1. **Cache revision.** `mubuf_format`'s run-time FORMAT switch gains `case 50u` in programs that already translate; 8 existing compute programs from the compute checks change. A shader cached at `19` / `19cs` before this lands therefore keeps the old switch. With the shim now accepting code 50, it would return the 0x7fc0f0f0 sentinel instead of the decoded value. The head still keys `19` / `19cs`. Do you want the bump to `20` / `20cs` here, or do you consider the stale entry acceptable? If you're fine without it, I'll dismiss my request. 2. **Source-built shim regression.** `tests/startup_buffer_format_word3_check.cpp` still doesn't list `DXGI_FORMAT_R10G10B10A2_UNORM`. Dropping `case 50` from `formatted_buffer.h` passes that C++ check; only the text-parsing checks fail. One row in `decoded[]` would pin it. The docs line about no D3D12 draw is minor. AI-assisted.
tedin7 commented 2026-11-26 08:01:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T07:31:57Z.


@MasterDomino all three points are fixed at a2e70c73d2b16e42a1bb0adbb016a37507f916da (on top of 6e9917f3).

  1. Cache revision. x2w-startup-shader-19 / 19cs moved to 20 / 20cs in gfx2hlsl.py, d3d12_draw.inl and the tests that spell the revision. The known-answer keys changed with it (startup_shader_cache_key_check.py, startup_compute_request_offline_check.py), and docs/startup-runtime.md says why revision 20 exists.
  2. Runtime-shim regression. tests/startup_buffer_format_word3_check.cpp lists DXGI_FORMAT_R10G10B10A2_UNORM in decoded[] and checks view_word3 gives 50u << 12 | identity. Dropping case 50 or the table line now fails the source-built check.
  3. Docs and description. docs/experiments.md now says startup_vertex_fetch_formats_warp / _hardware read the format back; the PR description is refreshed.

Win2025 (Windows Server 2025 build 26100, D3D12 WARP), ctest --preset dev and --preset release with -R '^(startup_gfx2hlsl_tbuffer_2101010|startup_buffer_format_word3|startup_vertex_fetch_formats_controls|startup_vertex_fetch_formats_warp|startup_shader_cache_key|startup_compute_request_offline)' --no-tests=error: 8/8 passed on both, including startup_buffer_format_word3, startup_buffer_format_word3_mapping_control, startup_buffer_format_word3_table, startup_gfx2hlsl_tbuffer_2101010 and startup_vertex_fetch_formats_warp.

Re-requesting review.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7185558324 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2006#issuecomment-7185558324). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T07:31:57Z. --- @MasterDomino all three points are fixed at `a2e70c73d2b16e42a1bb0adbb016a37507f916da` (on top of `6e9917f3`). 1. **Cache revision.** `x2w-startup-shader-19` / `19cs` moved to `20` / `20cs` in `gfx2hlsl.py`, `d3d12_draw.inl` and the tests that spell the revision. The known-answer keys changed with it (`startup_shader_cache_key_check.py`, `startup_compute_request_offline_check.py`), and `docs/startup-runtime.md` says why revision 20 exists. 2. **Runtime-shim regression.** `tests/startup_buffer_format_word3_check.cpp` lists `DXGI_FORMAT_R10G10B10A2_UNORM` in `decoded[]` and checks `view_word3` gives `50u << 12 | identity`. Dropping `case 50` or the table line now fails the source-built check. 3. **Docs and description.** `docs/experiments.md` now says `startup_vertex_fetch_formats_warp` / `_hardware` read the format back; the PR description is refreshed. Win2025 (Windows Server 2025 build 26100, D3D12 WARP), `ctest --preset dev` and `--preset release` with `-R '^(startup_gfx2hlsl_tbuffer_2101010|startup_buffer_format_word3|startup_vertex_fetch_formats_controls|startup_vertex_fetch_formats_warp|startup_shader_cache_key|startup_compute_request_offline)' --no-tests=error`: 8/8 passed on both, including `startup_buffer_format_word3`, `startup_buffer_format_word3_mapping_control`, `startup_buffer_format_word3_table`, `startup_gfx2hlsl_tbuffer_2101010` and `startup_vertex_fetch_formats_warp`. Re-requesting review. AI-assisted; commands listed were executed locally.
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!1999
No description provided.