gpu: preserve raw BC64 console layout words #2218

Merged
chadhyatt merged 1 commit from upstream-pr/2226 into main 2026-11-25 06:30:35 +00:00
chadhyatt commented 2026-11-25 06:16:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chadhyatt on 2026-11-25T06:16:08Z.


The BC64 source-built fixture fails to compile with Clang because constexpr static_cast<D3D12_TEXTURE_LAYOUT>(0x109) evaluates a value outside the enum range [0,3]. Treat the guest ABI field as a raw UINT on both the fixture construction and BC64 predicate read. Accepted shapes and negative controls are unchanged; other layout readers are outside this narrow correction.

Base: 7a1824d4. Tested head: 452dc48a (Apple Silicon macOS, Homebrew LLVM and MinGW-w64). Before: clang++ --target=x86_64-w64-windows-gnu --sysroot=/opt/homebrew/opt/mingw-w64/toolchain-x86_64 -std=c++17 -fsyntax-only -Isrc tests/startup_bc64_supports_check.cpp fails at line 19 with integer value 265 outside [0,3]. After: same target/sysroot with -std=c++17 -O2 -Wall -Wextra -Isrc -c tests/startup_bc64_supports_check.cpp -o out/backport-fixture/bc64-clang.o succeeds; x86_64-w64-mingw32-g++ -std=c++17 -O2 -Wall -Wextra -Isrc tests/startup_bc64_supports_check.cpp -o out/backport-fixture/bc64-gcc.exe succeeds. Windows CTest execution not available locally; expected checks ctest --preset release --no-tests=error -R "^startup_bc64_supports" -V including existing layout mutation. Related #1557 and #1690.

AI-assisted backport patch from x2w-microlift.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6598476525 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2226). Originally posted by [chadhyatt](https://github.com/chadhyatt) on 2026-11-25T06:16:08Z. --- The BC64 source-built fixture fails to compile with Clang because `constexpr static_cast<D3D12_TEXTURE_LAYOUT>(0x109)` evaluates a value outside the enum range [0,3]. Treat the guest ABI field as a raw UINT on both the fixture construction and BC64 predicate read. Accepted shapes and negative controls are unchanged; other layout readers are outside this narrow correction. Base: 7a1824d4. Tested head: 452dc48a (Apple Silicon macOS, Homebrew LLVM and MinGW-w64). Before: `clang++ --target=x86_64-w64-windows-gnu --sysroot=/opt/homebrew/opt/mingw-w64/toolchain-x86_64 -std=c++17 -fsyntax-only -Isrc tests/startup_bc64_supports_check.cpp` fails at line 19 with integer value 265 outside [0,3]. After: same target/sysroot with `-std=c++17 -O2 -Wall -Wextra -Isrc -c tests/startup_bc64_supports_check.cpp -o out/backport-fixture/bc64-clang.o` succeeds; `x86_64-w64-mingw32-g++ -std=c++17 -O2 -Wall -Wextra -Isrc tests/startup_bc64_supports_check.cpp -o out/backport-fixture/bc64-gcc.exe` succeeds. Windows CTest execution not available locally; expected checks `ctest --preset release --no-tests=error -R "^startup_bc64_supports" -V` including existing layout mutation. Related #1557 and #1690. AI-assisted backport patch from x2w-microlift.
upstream-sync closed this pull request 2026-11-25 07:01:06 +00:00
tedin7 commented 2026-11-25 07:01:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T06:17:55Z.

Review: COMMENTED


Review of head 452dc48a2ede6424333da237b80a58a19236c560 (comment only).

Summary: The change is small and correct. It reads and writes the guest layout field as a raw 32-bit word (memcpy) instead of casting an out-of-range value into the enum. That removes the Clang constexpr error and keeps the accepted shapes and negative controls the same.

Findings

  • P1: none.
  • P2: none.
  • nit: guest_layout_word is only used in bc64_chain.h. single_element_srv.h and gfx10_layout.h read the layout the same way (0x109 family), so they could share it later. The PR says that is out of scope, which is fine.
  • nit: the PR body says Windows CTest was not run. Please wait for the CI "Build and test on Windows" job (pending when I checked) before merging.

Checks run locally (Linux worktree at the head SHA)

  • git diff --check origin/main...HEAD -> clean
  • python3 tests/docs_links_check.py -> pass (18 files, 412 links)
  • python3 tests/bidi_controls_check.py -> pass (no bidi controls)
  • x86_64-w64-mingw32-g++ -std=c++17 -O2 -Wall -Wextra -Isrc tests/startup_bc64_supports_check.cpp -> builds with no warnings
  • Run under wine: "bc64 supports: 10 of 26 descriptions accepted, the rest rejected" (pass)
  • Mutation: changed guest_layout_word(d) == 0x109 to 0x10A in bc64_chain.h, rebuilt, ran. The test fails ("FAIL nine BC7 ...: rejected, expected accepted"), so the check catches a wrong layout word. Reverted with git checkout -- ..
  • Not run: Win2025 WARP. This is a host-side predicate and fixture change with no shader or GPU effect, so it is not needed.

Other: the PR is MERGEABLE, the title is neutral, and I saw nothing clean-room related in the diff. At review time the Linux Python check had passed and the Windows jobs were pending.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052734950 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2226#pullrequestreview-6052734950). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T06:17:55Z. **Review:** COMMENTED --- Review of head `452dc48a2ede6424333da237b80a58a19236c560` (comment only). Summary: The change is small and correct. It reads and writes the guest layout field as a raw 32-bit word (`memcpy`) instead of casting an out-of-range value into the enum. That removes the Clang constexpr error and keeps the accepted shapes and negative controls the same. Findings - P1: none. - P2: none. - nit: `guest_layout_word` is only used in `bc64_chain.h`. `single_element_srv.h` and `gfx10_layout.h` read the layout the same way (`0x109` family), so they could share it later. The PR says that is out of scope, which is fine. - nit: the PR body says Windows CTest was not run. Please wait for the CI "Build and test on Windows" job (pending when I checked) before merging. Checks run locally (Linux worktree at the head SHA) - `git diff --check origin/main...HEAD` -> clean - `python3 tests/docs_links_check.py` -> pass (18 files, 412 links) - `python3 tests/bidi_controls_check.py` -> pass (no bidi controls) - `x86_64-w64-mingw32-g++ -std=c++17 -O2 -Wall -Wextra -Isrc tests/startup_bc64_supports_check.cpp` -> builds with no warnings - Run under wine: "bc64 supports: 10 of 26 descriptions accepted, the rest rejected" (pass) - Mutation: changed `guest_layout_word(d) == 0x109` to `0x10A` in `bc64_chain.h`, rebuilt, ran. The test fails ("FAIL nine BC7 ...: rejected, expected accepted"), so the check catches a wrong layout word. Reverted with `git checkout -- .`. - Not run: Win2025 WARP. This is a host-side predicate and fixture change with no shader or GPU effect, so it is not needed. Other: the PR is MERGEABLE, the title is neutral, and I saw nothing clean-room related in the diff. At review time the Linux Python check had passed and the Windows jobs were pending. 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!2218
No description provided.