gpu: integrate fence-safe sampling of by-address console textures #2206

Merged
R0Y00 merged 5 commits from upstream-pr/2214 into main 2026-11-25 05:33:54 +00:00
R0Y00 commented 2026-11-25 05:27:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T05:27:44Z.


Refs #2015, #870. The original console-layout support landed separately in b9da095a. This follow-up validates storage and typed views, checks overlapping live resources, and retries dedicated uploads after an abandoned recording or a staging failure. The shared-ring control now selects that mode explicitly.

The source-built gate records payload 0, closes and resets its command list without submitting, then draws the same bytes again. Eighteen 16 MiB submissions wait behind one fence. After it opens, the first and last payloads must survive and all eighteen submissions must retire. Reusing the 256 MiB ring must corrupt only the left half of the target. An initial fixture set the environment variable to an empty string; on Windows this selected the ring control in both runs. The ordinary run now removes the variable.

Windows 11 build 26200, NVIDIA RTX 4060 Laptop (32.0.16.1656) and WARP, Release, draw-fixture debug layer disabled. On f1b854c7: 20/20 passed, no skips, including ordinary and mutation on each backend. The local offline saved-profile replay of the candidate before synchronization displayed a loading illustration, then stopped at a second-chance C++ exception after a slot-148 no-op; that subsequent stage is tracked separately in #1758. No private artifacts are included.

cmake --build --preset release --target startup_stream_consumer startup_gfx10_layout_check startup_bc64_supports_check startup_single_element_srv_check
ctest --preset release --no-tests=error --output-on-failure -R '^startup_(address_|gfx10_layout|single_element_srv|bc64_supports)'
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6597877353 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2214). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T05:27:44Z. --- Refs #2015, #870. The original console-layout support landed separately in b9da095a. This follow-up validates storage and typed views, checks overlapping live resources, and retries dedicated uploads after an abandoned recording or a staging failure. The shared-ring control now selects that mode explicitly. The source-built gate records payload 0, closes and resets its command list without submitting, then draws the same bytes again. Eighteen 16 MiB submissions wait behind one fence. After it opens, the first and last payloads must survive and all eighteen submissions must retire. Reusing the 256 MiB ring must corrupt only the left half of the target. An initial fixture set the environment variable to an empty string; on Windows this selected the ring control in both runs. The ordinary run now removes the variable. Windows 11 build 26200, NVIDIA RTX 4060 Laptop (32.0.16.1656) and WARP, Release, draw-fixture debug layer disabled. On f1b854c7: 20/20 passed, no skips, including ordinary and mutation on each backend. The local offline saved-profile replay of the candidate before synchronization displayed a loading illustration, then stopped at a second-chance C++ exception after a slot-148 no-op; that subsequent stage is tracked separately in #1758. No private artifacts are included. ```powershell cmake --build --preset release --target startup_stream_consumer startup_gfx10_layout_check startup_bc64_supports_check startup_single_element_srv_check ctest --preset release --no-tests=error --output-on-failure -R '^startup_(address_|gfx10_layout|single_element_srv|bc64_supports)' ```
tedin7 commented 2026-11-25 05:30:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:30:53Z.

Review: COMMENTED


Review of head f1b854c72d8018442b3ee639cc63f05545713c43 (comment only).

Status notes

  • GitHub reports this PR as MERGEABLE against current main, and a local git merge-tree --write-tree origin/main HEAD gave a clean tree, so I could not reproduce a conflict. If a conflict shows up on your side, please rebase onto main before Ready.
  • CI checks were still pending when I looked (Linux Python checks, Windows build/test, gfx1013 fixtures).
  • Title is neutral, and I saw nothing in the diff that breaks the clean-room rule.

What I checked

  • The tighter console_address_texture / address_view_fits rules in address_texture.h. They are a clear improvement: depth formats are refused, a typed UNORM store no longer accepts an sRGB view, the component mapping is validated, ResourceMinLODClamp must be 0, and a plain 2D view needs DepthOrArraySize == 1.
  • The new per-list upload bookkeeping in d3d12_draw.inl: a discarded list resets done/pending_list, a retired list sets done only if the cached revision matches, and the bad_alloc path pins the buffer and texture instead of freeing them early. The logic reads correctly.

Findings

  • P1: none.
  • P2: none.
  • nit: struct AddressUpload in d3d12_draw.inl now has u64 revision; with no default initializer, while its neighbours are initialized. Writing u64 revision = 0; would make a partial aggregate init safe.
  • nit: in retire_address_uploads the first loop (revision/done update) runs outside the new try, and the second loop looks the lists up again. Folding them into one pass would be easier to follow. This is not a bug.
  • nit: the bad_alloc pin path is a deliberate leak with a log line. It would be good to have a test that forces it, if that is cheap. I did not find one.

Commands executed locally

  • python3 tests/docs_links_check.py -> Self-test passed. Checked 18 Markdown files and 409 links.
  • python3 tests/bidi_controls_check.py -> no bidirectional controls in 1493 files.
  • git diff --check origin/main...HEAD -> clean.
  • python3 tests/startup_address_console_check.py -> prints usage only on Linux (it needs the Windows backend), so it gave no signal.
  • x86_64-w64-mingw32-g++ -std=c++17 -Isrc -static tests/startup_gfx10_layout_check.cpp then run under wine -> startup_gfx10_layout: PASS (30 equations, ... 19 address descriptions, 21 views).
  • Mutation: I removed r.DepthOrArraySize == 1 && from the Texture2D branch of address_view_fits. The layout check failed with FAIL address view: non-array view of an array, so the test kills it. I reverted the change with git checkout -- ..

Not verified

  • No Win2025 WARP run. This change touches the D3D12 upload and fence lifetime paths, so the gate/gate-ring fixtures in startup_address_console_check.py are what really prove it. They need a real Windows run before Ready.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052317968 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2214#pullrequestreview-6052317968). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:30:53Z. **Review:** COMMENTED --- Review of head `f1b854c72d8018442b3ee639cc63f05545713c43` (comment only). **Status notes** - GitHub reports this PR as MERGEABLE against current main, and a local `git merge-tree --write-tree origin/main HEAD` gave a clean tree, so I could not reproduce a conflict. If a conflict shows up on your side, please rebase onto main before Ready. - CI checks were still pending when I looked (Linux Python checks, Windows build/test, gfx1013 fixtures). - Title is neutral, and I saw nothing in the diff that breaks the clean-room rule. **What I checked** - The tighter `console_address_texture` / `address_view_fits` rules in `address_texture.h`. They are a clear improvement: depth formats are refused, a typed UNORM store no longer accepts an sRGB view, the component mapping is validated, `ResourceMinLODClamp` must be 0, and a plain 2D view needs `DepthOrArraySize == 1`. - The new per-list upload bookkeeping in `d3d12_draw.inl`: a discarded list resets `done`/`pending_list`, a retired list sets `done` only if the cached revision matches, and the `bad_alloc` path pins the buffer and texture instead of freeing them early. The logic reads correctly. **Findings** - P1: none. - P2: none. - nit: `struct AddressUpload` in `d3d12_draw.inl` now has `u64 revision;` with no default initializer, while its neighbours are initialized. Writing `u64 revision = 0;` would make a partial aggregate init safe. - nit: in `retire_address_uploads` the first loop (revision/`done` update) runs outside the new `try`, and the second loop looks the lists up again. Folding them into one pass would be easier to follow. This is not a bug. - nit: the `bad_alloc` pin path is a deliberate leak with a log line. It would be good to have a test that forces it, if that is cheap. I did not find one. **Commands executed locally** - `python3 tests/docs_links_check.py` -> Self-test passed. Checked 18 Markdown files and 409 links. - `python3 tests/bidi_controls_check.py` -> no bidirectional controls in 1493 files. - `git diff --check origin/main...HEAD` -> clean. - `python3 tests/startup_address_console_check.py` -> prints usage only on Linux (it needs the Windows backend), so it gave no signal. - `x86_64-w64-mingw32-g++ -std=c++17 -Isrc -static tests/startup_gfx10_layout_check.cpp` then run under wine -> `startup_gfx10_layout: PASS (30 equations, ... 19 address descriptions, 21 views)`. - Mutation: I removed `r.DepthOrArraySize == 1 &&` from the Texture2D branch of `address_view_fits`. The layout check failed with `FAIL address view: non-array view of an array`, so the test kills it. I reverted the change with `git checkout -- .`. **Not verified** - No Win2025 WARP run. This change touches the D3D12 upload and fence lifetime paths, so the gate/gate-ring fixtures in `startup_address_console_check.py` are what really prove it. They need a real Windows run before Ready. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 06:01:30 +00:00
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!2206
No description provided.