Resolve translated graphics root tables across a capped view heap #1248

Merged
R0Y00 merged 3 commits from upstream-pr/1255 into main 2026-11-24 06:23:23 +00:00
R0Y00 commented 2026-11-24 05:37:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T05:37:55Z.


Refs #874. Stacked on @triggered02's #1240 at c74485f5. Please land #1240 first. Review this change independently at f9aa4380. The sampler path remains owned by #1237.

A translated draw now resolves a graphics root table through the capped CBV/SRV/UAV heap actually bound to the list. The draw checks the complete view record against the guest extent before publishing it into its own desktop shader-visible heap. Switching away clears the old tables. Native descriptor writes and copies past the prefix have a real CPU-only destination. A copy spanning the two desktop heaps splits at their boundary. A copy extending beyond the logical range leaves the destination intact.

The source-built fixture creates two oversized heaps, gives the same slot different values, and draws eight strips across 32 RGBA pixels. It exercises simple and ranged CPU copies across the boundary, the last logical record, an overrun, a stale table after a switch, a handle from the wrong heap, and rebinding. The pixel shader is a fixture-owned buffer load; this test isolates descriptor publication from shader instruction translation.

Windows Release verification at f9aa4380, Windows 11 build 26200, debug layer off.

ctest --test-dir out/bin --no-tests=error --output-on-failure -R '^startup_(logical_view|view_heap|stream_draw)_'
  • RTX 4060 Laptop, driver 32.0.16.1656. All three tests passed. The physical boundary was 1,000,000 of 1,245,184 descriptors. All 32 pixels matched.
  • Microsoft WARP 10.0.26100.9818. The ordinary stream draw passed. Both capacity-dependent tests skipped (77) because this backend directly creates the full request.
  • Overall 4 passed, 2 capability skips, 0 failed.

The validated scope is translated graphics draws. The existing probe supplies the per-driver capacity; its implementation and evidence remain in #1240.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6575421833 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1255). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T05:37:55Z. --- Refs #874. Stacked on @triggered02's #1240 at c74485f5. Please land #1240 first. Review this change independently at [f9aa4380](https://github.com/R0Y00/Xbox2Windows/commit/f9aa4380e77d624ef26b528474830ea4b878ac50). The sampler path remains owned by #1237. A translated draw now resolves a graphics root table through the capped CBV/SRV/UAV heap actually bound to the list. The draw checks the complete view record against the guest extent before publishing it into its own desktop shader-visible heap. Switching away clears the old tables. Native descriptor writes and copies past the prefix have a real CPU-only destination. A copy spanning the two desktop heaps splits at their boundary. A copy extending beyond the logical range leaves the destination intact. The source-built fixture creates two oversized heaps, gives the same slot different values, and draws eight strips across 32 RGBA pixels. It exercises simple and ranged CPU copies across the boundary, the last logical record, an overrun, a stale table after a switch, a handle from the wrong heap, and rebinding. The pixel shader is a fixture-owned buffer load; this test isolates descriptor publication from shader instruction translation. **Windows Release verification** at f9aa4380, Windows 11 build 26200, debug layer off. ```powershell ctest --test-dir out/bin --no-tests=error --output-on-failure -R '^startup_(logical_view|view_heap|stream_draw)_' ``` - RTX 4060 Laptop, driver 32.0.16.1656. All three tests passed. The physical boundary was 1,000,000 of 1,245,184 descriptors. All 32 pixels matched. - Microsoft WARP 10.0.26100.9818. The ordinary stream draw passed. Both capacity-dependent tests skipped (77) because this backend directly creates the full request. - Overall 4 passed, 2 capability skips, 0 failed. The validated scope is translated graphics draws. The existing probe supplies the per-driver capacity; its implementation and evidence remain in #1240.
tedin7 commented 2026-11-24 05:58:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:58:28Z.

Review: COMMENTED


Dual-platform review of 3b2032bbf5c96b18a271c9258c5598f131eba071 (Resolve translated graphics root tables across a capped view heap).

Linux Checks

  • git diff --check origin/main...HEAD: PASS
  • docs_links_check.py: PASS (16 Markdown files, 282 links)
  • bidi_controls_check.py: PASS (1058 tracked files, no bidirectional controls)

Windows Server 2025 (Build 26100, MSVC 14.44, D3D12 WARP)

Command: C:\OEM\run_pr_test.ps1 -Pr 1255 -Targets 'startup_view_heap_check,startup_stream_consumer' -Regex '^startup_(view_heap|logical_view|stream_draw)_' -Jobs 6 -Parallel 4

  • dev (Debug): build succeeded (7 ninja targets); ctest 2/6 Passed (startup_stream_draw_warp 1.96s, startup_stream_draw_hardware 1.87s), 4/6 Skipped (77: startup_view_heap_hardware, startup_view_heap_warp, startup_logical_view_warp, startup_logical_view_hardware).
  • release (/O2): build succeeded (7 ninja targets); ctest 2/6 Passed (startup_stream_draw_warp 1.69s, startup_stream_draw_hardware 1.54s), 4/6 Skipped (77: same 4 tests).
  • Note on skips: WARP on Windows Server 2025 Build 26100 accepts 1,245,184 shader-visible CBV/SRV/UAV descriptors directly, and no physical GPU is attached in the VM, so the oversized-heap clamp path (startup_view_heap_*, startup_logical_view_*) is not exercised on this host and reports capability skip (77) rather than a pass.

Code Review Notes

  • src/startup_stubs/logical_view_table.h: resolve_view_table() and ViewTable::record() guard against null handles, zero stride, UINT64_MAX wrap-around, unaligned offsets, and out-of-range reads without integer overflow.
  • src/startup_stubs/d3d12_xs_device.cpp: accepted_view_heap_descriptors() probes once per process with a spin wait for concurrent callers and bisects down from 1,048,576 to view_heap_probe_floor (65,536). desktop_cpu_handle() and copy_descriptor_run() / device_copy_descriptors() validate full logical ranges before copying and split runs across the physical/tail boundary; tail lifetime is tied to heap via SetPrivateDataInterface.
  • src/startup_stubs/d3d12_draw.inl: list_set_descriptor_heaps() invalidates pass.view_tables whenever source_view_heap changes (including switching between an oversized heap and a non-oversized heap), and list_table() restricts lookup to the bound oversized heap when source_view_heap is set.
  • tests/startup_view_heap_check.cpp & tests/startup_logical_view_check.py: cover single-log-once reporting, straddling CopyDescriptorsSimple/CopyDescriptors, out-of-bounds copy rejection, boundary/logical-end/past-end reads, and wrong-heap / invalidated-table behavior on adapters that refuse 1,245,184 descriptors.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034403185 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1255#pullrequestreview-6034403185). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T05:58:28Z. **Review:** COMMENTED --- Dual-platform review of `3b2032bbf5c96b18a271c9258c5598f131eba071` (*Resolve translated graphics root tables across a capped view heap*). ### Linux Checks - `git diff --check origin/main...HEAD`: **PASS** - `docs_links_check.py`: **PASS** (16 Markdown files, 282 links) - `bidi_controls_check.py`: **PASS** (1058 tracked files, no bidirectional controls) ### Windows Server 2025 (Build 26100, MSVC 14.44, D3D12 WARP) Command: `C:\OEM\run_pr_test.ps1 -Pr 1255 -Targets 'startup_view_heap_check,startup_stream_consumer' -Regex '^startup_(view_heap|logical_view|stream_draw)_' -Jobs 6 -Parallel 4` - **`dev` (Debug)**: build succeeded (7 ninja targets); `ctest` 2/6 Passed (`startup_stream_draw_warp` 1.96s, `startup_stream_draw_hardware` 1.87s), 4/6 Skipped (77: `startup_view_heap_hardware`, `startup_view_heap_warp`, `startup_logical_view_warp`, `startup_logical_view_hardware`). - **`release` (`/O2`)**: build succeeded (7 ninja targets); `ctest` 2/6 Passed (`startup_stream_draw_warp` 1.69s, `startup_stream_draw_hardware` 1.54s), 4/6 Skipped (77: same 4 tests). - Note on skips: WARP on Windows Server 2025 Build 26100 accepts `1,245,184` shader-visible CBV/SRV/UAV descriptors directly, and no physical GPU is attached in the VM, so the oversized-heap clamp path (`startup_view_heap_*`, `startup_logical_view_*`) is not exercised on this host and reports capability skip (77) rather than a pass. ### Code Review Notes - `src/startup_stubs/logical_view_table.h`: `resolve_view_table()` and `ViewTable::record()` guard against null handles, zero stride, `UINT64_MAX` wrap-around, unaligned offsets, and out-of-range reads without integer overflow. - `src/startup_stubs/d3d12_xs_device.cpp`: `accepted_view_heap_descriptors()` probes once per process with a spin wait for concurrent callers and bisects down from 1,048,576 to `view_heap_probe_floor` (65,536). `desktop_cpu_handle()` and `copy_descriptor_run()` / `device_copy_descriptors()` validate full logical ranges before copying and split runs across the physical/tail boundary; `tail` lifetime is tied to `heap` via `SetPrivateDataInterface`. - `src/startup_stubs/d3d12_draw.inl`: `list_set_descriptor_heaps()` invalidates `pass.view_tables` whenever `source_view_heap` changes (including switching between an oversized heap and a non-oversized heap), and `list_table()` restricts lookup to the bound oversized heap when `source_view_heap` is set. - `tests/startup_view_heap_check.cpp` & `tests/startup_logical_view_check.py`: cover single-log-once reporting, straddling `CopyDescriptorsSimple`/`CopyDescriptors`, out-of-bounds copy rejection, boundary/logical-end/past-end reads, and wrong-heap / invalidated-table behavior on adapters that refuse 1,245,184 descriptors.
upstream-sync closed this pull request 2026-11-24 06:47:21 +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!1248
No description provided.