startup: upload luma and chroma from single-image NV12 textures #1170

Merged
R0Y00 merged 1 commit from upstream-pr/1177 into main 2026-11-24 04:20:10 +00:00
R0Y00 commented 2026-11-24 02:33:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T02:33:48Z.


Refs #1138. Depends on #1135. The temporary review base keeps this diff to one commit. Retarget to main after #1135 lands.

The source-built 8×4 reproduction against e658fe24 got a one-plane layout, S_OK for Y, and E_INVALIDARG for UV. The desktop draw uploader only copied the first plane. Both paths now use the same two desktop footprints for a single-mip, single-sample NV12 texture. A rejected array probe and short UV row return errors. The original video's texture format is still unknown.

The regression writes both planes via the startup XG interface and uses the draw uploader's copy helper. A source-built pixel shader reads R8 and R8G8 views, converts the two planes to RGBA, and checks every pixel against the CPU. The U/V-swapped control produces 32 distinct-from-baseline pixel values per run.

Verified commit 7dcdfdc, first Release configure with the default intake Python location, Windows 11 build 26200.9974, debug layer off. NVIDIA RTX 4060 Laptop 32.0.16.1656 and Microsoft WARP 10.0.26100.9818 each matched all 32 pixels in both cases.

python -m venv --without-pip out/pe-env
.\tools\dev.ps1
cmake --preset release -DCMAKE_TRY_COMPILE_CONFIGURATION=Release
cmake --build --preset release --target startup_nv12_draw d3d12_xs_shim startup_stub_consumer startup_stub_gameinput startup_stub_acphal startup_stub_xapu startup_stub_xcrdapi
ctest --preset release --no-tests=error -R '^startup_(nv12_draw_.*|stubs)$' -V

Result: 3/3 passed, 0 skips. The first-configure startup_stubs command used out/pe-env/Scripts/python.exe. The two NV12 tests invoke the compiled fixture directly.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6573317020 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1177). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T02:33:48Z. --- Refs #1138. Depends on #1135. The temporary review base keeps this diff to one commit. Retarget to `main` after #1135 lands. The source-built 8×4 reproduction against `e658fe24` got a one-plane layout, `S_OK` for Y, and `E_INVALIDARG` for UV. The desktop draw uploader only copied the first plane. Both paths now use the same two desktop footprints for a single-mip, single-sample NV12 texture. A rejected array probe and short UV row return errors. The original video's texture format is still unknown. The regression writes both planes via the startup XG interface and uses the draw uploader's copy helper. A source-built pixel shader reads R8 and R8G8 views, converts the two planes to RGBA, and checks every pixel against the CPU. The U/V-swapped control produces 32 distinct-from-baseline pixel values per run. Verified commit `7dcdfdc`, first Release configure with the default intake Python location, Windows 11 build 26200.9974, debug layer off. NVIDIA RTX 4060 Laptop 32.0.16.1656 and Microsoft WARP 10.0.26100.9818 each matched all 32 pixels in both cases. ```powershell python -m venv --without-pip out/pe-env .\tools\dev.ps1 cmake --preset release -DCMAKE_TRY_COMPILE_CONFIGURATION=Release cmake --build --preset release --target startup_nv12_draw d3d12_xs_shim startup_stub_consumer startup_stub_gameinput startup_stub_acphal startup_stub_xapu startup_stub_xcrdapi ctest --preset release --no-tests=error -R '^startup_(nv12_draw_.*|stubs)$' -V ``` Result: 3/3 passed, 0 skips. The first-configure `startup_stubs` command used `out/pe-env/Scripts/python.exe`. The two NV12 tests invoke the compiled fixture directly.
tedin7 commented 2026-11-24 02:40:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:40:24Z.

Review: COMMENTED


Reviewed at commit 7dcdfdcd71c8747d4fe52089f5680f1cc6933350.

  • Code notes: src/startup_stubs/slice_footprints.h shares single-image even-dimension 2D NV12 footprint calculation and D3D12 subresource indexing (m + slice * mips + p * slices * mips) between xg_xs.cpp and d3d12_draw.inl, with upload_texture deferring state.done = true until all planes copy and XGCreateTextureComputer returning E_NOTIMPL for unsupported NV12 shapes (arrays/mips/odd sizes). tests/startup_nv12_draw.cpp verifies both UV and VU-swapped controls against CPU YCbCr math.
  • Linux checks passed:
    • python3 tests/docs_links_check.py (253 links across 16 Markdown files)
    • python3 tests/bidi_controls_check.py (967 files)
    • python3 tests/gpu_report_format_check.py (10 tests)
    • python3 tests/xgameruntime_table_check.py
  • Not run on Linux: Windows MSVC build and startup_nv12_draw_{warp,hardware} CTest runs (no CI checks reported on this branch yet; those rely on Windows/CI).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032872047 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1177#pullrequestreview-6032872047). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:40:24Z. **Review:** COMMENTED --- Reviewed at commit `7dcdfdcd71c8747d4fe52089f5680f1cc6933350`. - **Code notes**: `src/startup_stubs/slice_footprints.h` shares single-image even-dimension 2D NV12 footprint calculation and D3D12 subresource indexing (`m + slice * mips + p * slices * mips`) between `xg_xs.cpp` and `d3d12_draw.inl`, with `upload_texture` deferring `state.done = true` until all planes copy and `XGCreateTextureComputer` returning `E_NOTIMPL` for unsupported NV12 shapes (arrays/mips/odd sizes). `tests/startup_nv12_draw.cpp` verifies both `UV` and `VU`-swapped controls against CPU YCbCr math. - **Linux checks passed**: - `python3 tests/docs_links_check.py` (253 links across 16 Markdown files) - `python3 tests/bidi_controls_check.py` (967 files) - `python3 tests/gpu_report_format_check.py` (10 tests) - `python3 tests/xgameruntime_table_check.py` - **Not run on Linux**: Windows MSVC build and `startup_nv12_draw_{warp,hardware}` CTest runs (no CI checks reported on this branch yet; those rely on Windows/CI).
upstream-sync closed this pull request 2026-11-24 06:46:43 +00:00
denn0x commented 2026-11-24 06:50:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-24T03:30:32Z.


Test report for 7dcdfdcd: Windows 11 Pro 26300, MSVC 14.50 (VS 18 Build Tools), Ninja, Release, debug layer off.

  • cmake --build out/build/release: built with no errors or failures.
  • ctest --no-tests=error -R startup: 7/7 passed, 0 failed, no skips.

Not tested yet: a run with the console executable. Runs on this machine currently run out of system commit before the menus (#1199). I will add the executable result here once that is resolved.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121164007 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1177#issuecomment-7121164007). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-24T03:30:32Z. --- Test report for `7dcdfdcd`: Windows 11 Pro 26300, MSVC 14.50 (VS 18 Build Tools), Ninja, Release, debug layer off. - `cmake --build out/build/release`: built with no errors or failures. - `ctest --no-tests=error -R startup`: 7/7 passed, 0 failed, no skips. Not tested yet: a run with the console executable. Runs on this machine currently run out of system commit before the menus (#1199). I will add the executable result here once that is resolved. AI-assisted (Claude Code).
lambirou commented 2026-11-24 06:50:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T04:23:33Z.


Independent retarget check: the #1177 diff applies cleanly to main at b5cb8800 in a fresh worktree. The worktree builds in Release with Windows 10.0.26300.10075 and MSVC 19.44.35228.0.

ctest --preset release --no-tests=error -R '^startup_(nv12_draw_.*|stubs)$' -V

  • startup_nv12_draw_warp: passed on WARP (Microsoft Basic Render Driver). UV and VU both matched all 32 pixels, 0 mismatches.
  • startup_nv12_draw_hardware: passed on AMD Radeon RX 9060 XT 32.0.32029.2010. UV and VU both matched all 32 pixels, 0 mismatches.
  • startup_stubs: passed.
  • 3/3 passed, 0 failed, 0 skips.

The PR still targets codex/pr1135-review-base (5691fe81), so it has no CI against main. Please retarget/rebase it to main; the local apply was clean. Note that #1174 touches the same four files (CMakeLists.txt, docs/startup-runtime.md, d3d12_draw.inl, d3d12_xs_device.cpp), so merge one and rebase the other.

No game files, dumps or private logs were used. AI-assisted (Codex).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121976078 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1177#issuecomment-7121976078). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T04:23:33Z. --- Independent retarget check: the #1177 diff applies cleanly to `main` at `b5cb8800` in a fresh worktree. The worktree builds in Release with Windows 10.0.26300.10075 and MSVC 19.44.35228.0. `ctest --preset release --no-tests=error -R '^startup_(nv12_draw_.*|stubs)$' -V` - `startup_nv12_draw_warp`: passed on WARP (Microsoft Basic Render Driver). UV and VU both matched all 32 pixels, 0 mismatches. - `startup_nv12_draw_hardware`: passed on AMD Radeon RX 9060 XT 32.0.32029.2010. UV and VU both matched all 32 pixels, 0 mismatches. - `startup_stubs`: passed. - 3/3 passed, 0 failed, 0 skips. The PR still targets `codex/pr1135-review-base` (`5691fe81`), so it has no CI against `main`. Please retarget/rebase it to `main`; the local apply was clean. Note that #1174 touches the same four files (`CMakeLists.txt`, `docs/startup-runtime.md`, `d3d12_draw.inl`, `d3d12_xs_device.cpp`), so merge one and rebase the other. No game files, dumps or private logs were used. AI-assisted (Codex).
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!1170
No description provided.