gpu: emulate a shader-visible view heap larger than the driver accepts #1240

Manually merged
github merged 3 commits from gh-pr/1240/head into gh-pr/1240/base 2026-11-26 22:51:33 +00:00
Owner

@⁠triggered02 on GitHub · 2026-11-24 04:59 UTC · original
triggered02:gpu/emulated-view-heap → main · +282 −2 · 4 files · 3 commits · merged 2026-11-24 06:06 UTC

The title asks for one shader-visible CBV/SRV/UAV heap of 1,245,184 descriptors, which the console accepts. Desktop D3D12 documents a 1,048,576 ceiling, but drivers may accept less — this GTX 1660 SUPER rejects 1,048,576 as well and stops at exactly 1,000,000, so the limit is measured once and cached instead of assumed.

The stand-in now creates the desktop heap at the accepted maximum, keeps the title's own full-size descriptor memory (the extra[1] == bytes handshake still uses the requested byte count, so GetCPUDescriptorHandleForHeapStart keeps returning the title's arena base), and records the desktop capacity beside the title extent. A handle the title addresses past the desktop heap is logged once with its descriptor index rather than silently translated out of the allocation.

Measured with the offline stand-ins (tools/startup/run.ps1 -Render -FakeUser -GpuMirror -ContinueAsserts 1000 -InputScript 4@70), GTX 1660 SUPER, driver 32.0.16.1074, Windows 11 build 26200, G:\ package mount:

before after
stop point 2.02 s, NULL+0x30 in the title's arena allocator 130.95 s, later in the render path
frames presented 0 3,218 at 29.2 fps
x2w-d3d12 measured the shader-visible view heap limit: 1000000 descriptors
x2w-d3d12 Device::CreateDescriptorHeap: shortcut - title asked for 1245184 shader-visible view descriptors, this driver accepts 1000000; the rest stay in title memory
x2w-d3d12 heartbeat: 3218 frames presented in 110.0 s (29.2 fps overall)

The clamp is a logged shortcut, not a claim that the console contract is emulated: descriptors past the driver's heap stay in title memory and any use of them is reported. docs/startup-runtime.md calls these stand-ins experimental and opt-in, which suits this.

**@⁠triggered02** on GitHub · 2026-11-24 04:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240) `triggered02:gpu/emulated-view-heap` → `main` · +282 −2 · 4 files · 3 commits · merged 2026-11-24 06:06 UTC The title asks for one shader-visible CBV/SRV/UAV heap of **1,245,184** descriptors, which the console accepts. Desktop D3D12 documents a 1,048,576 ceiling, but drivers may accept less — this GTX 1660 SUPER rejects 1,048,576 as well and stops at exactly **1,000,000**, so the limit is measured once and cached instead of assumed. The stand-in now creates the desktop heap at the accepted maximum, keeps the title's own full-size descriptor memory (the `extra[1] == bytes` handshake still uses the **requested** byte count, so `GetCPUDescriptorHandleForHeapStart` keeps returning the title's arena base), and records the desktop capacity beside the title extent. A handle the title addresses past the desktop heap is logged once with its descriptor index rather than silently translated out of the allocation. Measured with the offline stand-ins (`tools/startup/run.ps1 -Render -FakeUser -GpuMirror -ContinueAsserts 1000 -InputScript 4@70`), GTX 1660 SUPER, driver 32.0.16.1074, Windows 11 build 26200, `G:\` package mount: | | before | after | |---|---|---| | stop point | 2.02 s, `NULL+0x30` in the title's arena allocator | 130.95 s, later in the render path | | frames presented | 0 | **3,218 at 29.2 fps** | ``` x2w-d3d12 measured the shader-visible view heap limit: 1000000 descriptors x2w-d3d12 Device::CreateDescriptorHeap: shortcut - title asked for 1245184 shader-visible view descriptors, this driver accepts 1000000; the rest stay in title memory x2w-d3d12 heartbeat: 3218 frames presented in 110.0 s (29.2 fps overall) ``` The clamp is a logged shortcut, not a claim that the console contract is emulated: descriptors past the driver's heap stay in title memory and any use of them is reported. `docs/startup-runtime.md` calls these stand-ins experimental and opt-in, which suits this.
The title creates one shader-visible CBV/SRV/UAV heap of 1,245,184 descriptors, which the console
accepts. Desktop D3D12 documents a 1,048,576 ceiling, but this driver rejects that too and stops at
exactly 1,000,000, so the accepted maximum is measured once and cached rather than assumed. The
stand-in then creates the desktop heap at that maximum and keeps the title's own full-size descriptor
memory, so the handshake on the heap's byte size still matches the requested count.

The measurement halves from the documented ceiling and bisects upward, and it tests the 65,536
floor explicitly: a driver whose maximum is below the floor is recorded as declining the shortcut
instead of caching a size it will reject again. Each probe heap is released before the next.

A handle the title addresses past the desktop heap is logged once with its descriptor index instead
of being translated out of the allocation.

Measured with the offline stand-ins, GTX 1660 SUPER (driver 32.0.16.1074), Windows 11 build 26200:
before, the heap create fails and the run stops at 2.02 s on a NULL descriptor arena; after, the run
proceeds and presents 3,218 frames at 29.2 fps.
Addresses the acceptance criteria in #1159.

- Any failure of an oversized shader-visible CBV/SRV/UAV heap takes the shortcut path. Drivers
  report different codes for the same condition: E_INVALIDARG on a GTX 1660 SUPER, E_OUTOFMEMORY on
  an RTX 3060, so matching only E_INVALIDARG would have missed the 3060.
- The shortcut is logged once per process rather than once per heap.
- New `startup_view_heap_check` requests 1,245,184 descriptors through the stand-in, checks that the
  call succeeds and that exactly one shortcut line was logged, and skips (77) on an adapter that
  accepts the full request (WARP here). Registered as `startup_view_heap_{hardware,warp}`.
- The limit is listed under the known shortcuts in `docs/startup-runtime.md`.

Measured, GTX 1660 SUPER (driver 32.0.16.1074), Windows 11 build 26200:
`startup_view_heap_hardware` passed (shortcut logged once, 1,000,000 descriptors accepted);
`startup_view_heap_warp` skipped because WARP accepts the full request.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:51:30 +00:00
github manually merged commit ab1ea74a08 into gh-pr/1240/base 2026-11-26 22:51:33 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 04:59 UTC · original · edited 2026-11-24 05:02 UTC

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-24T05:02:20.875101Z 16761ee 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.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 04:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#issuecomment-7122526430) · edited 2026-11-24 05:02 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"16761eed7b8a614a8de9087b360d301503fb7c1f","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-24T05:02:20.875101Z">2026-11-24T05:02:20.875101Z</relative-time> | `16761ee` | 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>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 05:02 UTC · original

P2 Badge Probe before treating the floor as accepted

If a driver's largest accepted shader-visible view heap is below 65,536 descriptors, this loop reaches the floor without testing it. The following bisection initializes low to that unverified value and only tests larger sizes, so it caches 65,536 and retries the title heap at a size the driver rejects; the fallback still fails instead of finding a smaller usable heap or declining the shortcut.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 05:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#discussion_r4675725748) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Probe before treating the floor as accepted** If a driver's largest accepted shader-visible view heap is below 65,536 descriptors, this loop reaches the floor without testing it. The following bisection initializes `low` to that unverified value and only tests larger sizes, so it caches 65,536 and retries the title heap at a size the driver rejects; the fallback still fails instead of finding a smaller usable heap or declining the shortcut. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠triggered02 on GitHub · 2026-11-24 05:15 UTC · original

Fixed in 692aa6ca, and the branch is rebased onto current main (it had gone conflicted after the descriptor-stride work landed; the clamp is now applied to that shape, with the range record carrying how many title descriptors the desktop heap covers).

On the P2: the floor is now probed. The measurement halves from the documented ceiling and tests every candidate including 65,536; if no candidate at or above the floor is accepted the shortcut is declined (returns 0, logs it) instead of caching 65,536 and retrying at a size the driver rejects. So a driver with a maximum below the floor falls back to the original failed create rather than failing the same way twice.

Re-verified on the rebased branch, GTX 1660 SUPER (driver 32.0.16.1074), Windows 11 build 26200, offline stand-ins:

x2w-d3d12 measured the shader-visible view heap limit: 1000000 descriptors
x2w-d3d12 Device::CreateDescriptorHeap: shortcut - title asked for 1245184 shader-visible view descriptors, this driver accepts 1000000; the rest stay in title memory
x2w-d3d12 heartbeat: 518 frames presented in 20.0 s (25.9 fps overall)
**@⁠triggered02** on GitHub · 2026-11-24 05:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#issuecomment-7122772631) Fixed in `692aa6ca`, and the branch is rebased onto current `main` (it had gone conflicted after the descriptor-stride work landed; the clamp is now applied to that shape, with the range record carrying how many title descriptors the desktop heap covers). On the P2: the floor is now probed. The measurement halves from the documented ceiling and tests every candidate **including** 65,536; if no candidate at or above the floor is accepted the shortcut is **declined** (returns 0, logs it) instead of caching 65,536 and retrying at a size the driver rejects. So a driver with a maximum below the floor falls back to the original failed create rather than failing the same way twice. Re-verified on the rebased branch, GTX 1660 SUPER (driver 32.0.16.1074), Windows 11 build 26200, offline stand-ins: ``` x2w-d3d12 measured the shader-visible view heap limit: 1000000 descriptors x2w-d3d12 Device::CreateDescriptorHeap: shortcut - title asked for 1245184 shader-visible view descriptors, this driver accepts 1000000; the rest stay in title memory x2w-d3d12 heartbeat: 518 frames presented in 20.0 s (25.9 fps overall) ```
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 05:23 UTC · original

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

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_shim_check d3d12_xs_shim -- -j 6): 22.94s (configure 2.04s)
    • Test (ctest --preset dev -R '^d3d12_xs_shim_.*$' --parallel 4 --no-tests=error --output-on-failure): 5/5 passed (0.23s: d3d12_xs_shim_exports, d3d12_xs_shim_serialize, d3d12_xs_shim_deserialize, d3d12_xs_shim_iids, d3d12_xs_shim_warp_root)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_shim_check d3d12_xs_shim -- -j 6): 43.64s (configure 1.82s)
    • Test (ctest --preset release -R '^d3d12_xs_shim_.*$' --parallel 4 --no-tests=error --output-on-failure): 5/5 passed (0.22s: d3d12_xs_shim_exports, d3d12_xs_shim_serialize, d3d12_xs_shim_deserialize, d3d12_xs_shim_iids, d3d12_xs_shim_warp_root)
**@⁠tedin7** on GitHub · 2026-11-24 05:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#issuecomment-7122899608) Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `692aa6caf620fcb34432c4c81324e6f2c7f75a67`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target d3d12_xs_shim_check d3d12_xs_shim -- -j 6`): `22.94s` (configure `2.04s`) - Test (`ctest --preset dev -R '^d3d12_xs_shim_.*$' --parallel 4 --no-tests=error --output-on-failure`): **5/5 passed** (`0.23s`: `d3d12_xs_shim_exports`, `d3d12_xs_shim_serialize`, `d3d12_xs_shim_deserialize`, `d3d12_xs_shim_iids`, `d3d12_xs_shim_warp_root`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target d3d12_xs_shim_check d3d12_xs_shim -- -j 6`): `43.64s` (configure `1.82s`) - Test (`ctest --preset release -R '^d3d12_xs_shim_.*$' --parallel 4 --no-tests=error --output-on-failure`): **5/5 passed** (`0.22s`: `d3d12_xs_shim_exports`, `d3d12_xs_shim_serialize`, `d3d12_xs_shim_deserialize`, `d3d12_xs_shim_iids`, `d3d12_xs_shim_warp_root`)
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 05:29 UTC · original

@⁠triggered02, I am using your c74485f5 as the upstream for the translated root-table follow-up. It will use the per-driver capacity your PR already probes. The scope is command-list slot 32 heap identity, slot 36 table resolution through the logical end, and safe descriptor creation/copy across the measured physical boundary. I am testing two heaps with independent sentinels via a translated draw on WARP and NVIDIA. No duplicate capacity probe is being submitted. Please flag any overlapping runtime changes in your branch. Refs #874.

**@⁠R0Y00** on GitHub · 2026-11-24 05:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#issuecomment-7122994595) @⁠triggered02, I am using your `c74485f5` as the upstream for the translated root-table follow-up. It will use the per-driver capacity your PR already probes. The scope is command-list slot 32 heap identity, slot 36 table resolution through the logical end, and safe descriptor creation/copy across the measured physical boundary. I am testing two heaps with independent sentinels via a translated draw on WARP and NVIDIA. No duplicate capacity probe is being submitted. Please flag any overlapping runtime changes in your branch. Refs #874.
Author
Owner

@⁠triggered02 on GitHub · 2026-11-24 05:39 UTC · original

@⁠R0Y00 — here is exactly what c74485f5 changes in the runtime, and the two places it will meet your follow-up.

Surface: src/startup_stubs/d3d12_xs_device.cpp only (+115 lines; plus tests/startup_view_heap_check.cpp, a CMake entry and a docs entry). I do not touch command-list slots 32 or 36, root-table resolution, note_heap, or any command-list handler, so your slot 32 heap identity and slot 36 table resolution work should not collide with mine.

What the boundary is, in code. A DescriptorRange gains desktop_descriptors: how many title descriptors the desktop heap actually covers. It is stored under descriptor_lock alongside title / bytes / desktop. bytes deliberately stays the title's full extent (1,245,184 descriptors), while desktop is the clamped heap's start — so read desktop_descriptors, not bytes, when you decide where the physical boundary is.

The probe you are reusing. accepted_view_heap_descriptors(device, node_mask) — halves from 1,048,576, bisects up, releases each probe, declines (returns 0) if nothing at or above the 65,536 floor is accepted. It takes any failure of an oversized shader-visible CBV/SRV/UAV heap, because the codes differ by driver: E_INVALIDARG on my GTX 1660 SUPER, E_OUTOFMEMORY on the RTX 3060 you measured.

Two things you should know before you build on it, both mine to fix if you want:

  1. The probe cache is process-wide, not per adapter. cached / state are function-level statics, so a WARP device and an NVIDIA device in the same process would share one measurement. Your two-heap sentinel test is the first thing that would hit this. If you want, I will key the cache per adapter LUID and push it to this branch rather than have you work around it.

  2. The overrun is detected but not enforced — that is your scope, not mine. desktop_cpu_handle() sets past_limit, logs at most four times, and returns the untranslated title handle, so the device currently receives an address past the heap. I deliberately did not invent a sentinel there because three call sites share it and a wrong sentinel would silently corrupt them: the view-slot handlers (args[D] = desktop_cpu_handle(args[D])), device_copy_descriptors, and device_copy_descriptors_simple. Your safe creation/copy layer is the right place to skip the call instead. Tell me whether you want my log path removed or kept as a counter once yours lands — I would rather have one authority reporting the boundary than two.

One mismatched expectation to be aware of: the shortcut line is guarded by first_calls(shortcuts, 1), so only the first clamped heap in a process logs. Two oversized heaps with independent sentinels will produce one log line, not two. If your fixture asserts a line per heap, it will fail against this branch — say so and I will make it per heap.

If it is easier, I can put the LUID-keyed cache and the per-heap logging in one small commit on this branch today so your work starts from a probe that is correct across adapters.

**@⁠triggered02** on GitHub · 2026-11-24 05:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#issuecomment-7123157737) @⁠R0Y00 — here is exactly what `c74485f5` changes in the runtime, and the two places it will meet your follow-up. **Surface: `src/startup_stubs/d3d12_xs_device.cpp` only** (+115 lines; plus `tests/startup_view_heap_check.cpp`, a CMake entry and a docs entry). I do not touch command-list slots 32 or 36, root-table resolution, `note_heap`, or any command-list handler, so your slot 32 heap identity and slot 36 table resolution work should not collide with mine. **What the boundary is, in code.** A `DescriptorRange` gains `desktop_descriptors`: how many title descriptors the desktop heap actually covers. It is stored under `descriptor_lock` alongside `title` / `bytes` / `desktop`. `bytes` deliberately stays the **title's** full extent (1,245,184 descriptors), while `desktop` is the clamped heap's start — so read `desktop_descriptors`, not `bytes`, when you decide where the physical boundary is. **The probe you are reusing.** `accepted_view_heap_descriptors(device, node_mask)` — halves from 1,048,576, bisects up, releases each probe, declines (returns 0) if nothing at or above the 65,536 floor is accepted. It takes **any** failure of an oversized shader-visible CBV/SRV/UAV heap, because the codes differ by driver: `E_INVALIDARG` on my GTX 1660 SUPER, `E_OUTOFMEMORY` on the RTX 3060 you measured. **Two things you should know before you build on it, both mine to fix if you want:** 1. **The probe cache is process-wide, not per adapter.** `cached` / `state` are function-level statics, so a WARP device and an NVIDIA device in the *same process* would share one measurement. Your two-heap sentinel test is the first thing that would hit this. If you want, I will key the cache per adapter LUID and push it to this branch rather than have you work around it. 2. **The overrun is detected but not enforced — that is your scope, not mine.** `desktop_cpu_handle()` sets `past_limit`, logs at most four times, and returns the **untranslated title handle**, so the device currently receives an address past the heap. I deliberately did not invent a sentinel there because three call sites share it and a wrong sentinel would silently corrupt them: the view-slot handlers (`args[D] = desktop_cpu_handle(args[D])`), `device_copy_descriptors`, and `device_copy_descriptors_simple`. Your safe creation/copy layer is the right place to skip the call instead. Tell me whether you want my log path removed or kept as a counter once yours lands — I would rather have one authority reporting the boundary than two. **One mismatched expectation to be aware of:** the shortcut line is guarded by `first_calls(shortcuts, 1)`, so only the *first* clamped heap in a process logs. Two oversized heaps with independent sentinels will produce one log line, not two. If your fixture asserts a line per heap, it will fail against this branch — say so and I will make it per heap. If it is easier, I can put the LUID-keyed cache and the per-heap logging in one small commit on this branch today so your work starts from a probe that is correct across adapters.
Author
Owner

@⁠triggered02 on GitHub · 2026-11-24 06:06 UTC · original

Reviewed ab1ea74a and verified it locally — it is the right correction to what I wrote, and it closes two gaps I had left in the test.

The narrowing is correct. My "any failure takes the clamp path" was over-corrected: it was right that E_OUTOFMEMORY had to be included alongside E_INVALIDARG, but FAILED(hr) also swallowed unrelated failures such as E_NOINTERFACE and E_POINTER and turned them into a capacity retry. Matching exactly the two capacity codes is what the situation actually calls for. Removing the redundant cached = 0 there is right too — the static is already zero at that point and the state move is what publishes the result.

Both test additions close real holes I left:

  • The E_NOINTERFACE negative control is the test that would have caught my over-correction. I had no case that asserted an unrelated failure is preserved, which is why the bug got through.
  • guest_cpu_base() restores the logical CPU-descriptor-base assertion I dropped. I had given up on it because calling GetCPUDescriptorHandleForHeapStart through the COM vtable returned 0, and I concluded the title never queries it — which was the wrong conclusion. Reading slot 9 directly with the one-word console ABI is the right way to ask, and the fixture is stronger for it.

Local verification (GTX 1660 SUPER, driver 32.0.16.1074, Windows 11 build 26200, release preset, at ab1ea74a):

x2w-d3d12 measured the shader-visible view heap limit: 1000000 descriptors
x2w-d3d12 Device::CreateDescriptorHeap: shortcut - title asked for 1245184 shader-visible view descriptors, this driver accepts 1000000; the rest stay in title memory
oversized heap accepted; shortcut logged once; 1245184 requested
startup_view_heap_hardware ....... Passed   0.60 sec
startup_view_heap_warp ........... Skipped  (WARP accepts the full request)

One thing still unanswered from my earlier note, which matters for your two-adapter sentinel test: the capacity measurement is cached in function-level statics, so it is process-wide, not per adapter. A WARP device and an NVIDIA device in the same process would share one measurement. I can key it per adapter LUID if you want it before your follow-up lands; otherwise your test will be measuring the first adapter's limit for both.

**@⁠triggered02** on GitHub · 2026-11-24 06:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#issuecomment-7123594777) Reviewed `ab1ea74a` and verified it locally — it is the right correction to what I wrote, and it closes two gaps I had left in the test. **The narrowing is correct.** My "any failure takes the clamp path" was over-corrected: it was right that `E_OUTOFMEMORY` had to be included alongside `E_INVALIDARG`, but `FAILED(hr)` also swallowed unrelated failures such as `E_NOINTERFACE` and `E_POINTER` and turned them into a capacity retry. Matching exactly the two capacity codes is what the situation actually calls for. Removing the redundant `cached = 0` there is right too — the static is already zero at that point and the state move is what publishes the result. **Both test additions close real holes I left:** - The `E_NOINTERFACE` negative control is the test that would have caught my over-correction. I had no case that asserted an unrelated failure is *preserved*, which is why the bug got through. - `guest_cpu_base()` restores the logical CPU-descriptor-base assertion I dropped. I had given up on it because calling `GetCPUDescriptorHandleForHeapStart` through the COM vtable returned 0, and I concluded the title never queries it — which was the wrong conclusion. Reading slot 9 directly with the one-word console ABI is the right way to ask, and the fixture is stronger for it. **Local verification** (GTX 1660 SUPER, driver 32.0.16.1074, Windows 11 build 26200, `release` preset, at `ab1ea74a`): ``` x2w-d3d12 measured the shader-visible view heap limit: 1000000 descriptors x2w-d3d12 Device::CreateDescriptorHeap: shortcut - title asked for 1245184 shader-visible view descriptors, this driver accepts 1000000; the rest stay in title memory oversized heap accepted; shortcut logged once; 1245184 requested startup_view_heap_hardware ....... Passed 0.60 sec startup_view_heap_warp ........... Skipped (WARP accepts the full request) ``` One thing still unanswered from my earlier note, which matters for your two-adapter sentinel test: the capacity measurement is cached in function-level statics, so it is **process-wide, not per adapter**. A WARP device and an NVIDIA device in the same process would share one measurement. I can key it per adapter LUID if you want it before your follow-up lands; otherwise your test will be measuring the first adapter's limit for both.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 05:02 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16761eed7b

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

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 05:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#pullrequestreview-6033941362) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `16761eed7b` <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>
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 05:03 UTC · original · reviewed

Reviewed commit 16761eed (Linux host; Windows build and runtime tests were not executed locally).

Code & Edge-Case Audit

  • src/startup_stubs/d3d12_xs_device.cpp:
    • accepted_view_heap_descriptors: probes once per process (guarded by InterlockedCompareExchange state 0 -> 1 -> 2) for shader-visible CBV_SRV_UAV heaps when CreateDescriptorHeap returns E_INVALIDARG and NumDescriptors > view_heap_probe_floor (65536), halving from 1,048,576 and bisecting upward.
    • device_create_descriptor_heap: clamps only the desktop CreateDescriptorHeap request while keeping bytes (std::uint64_t arithmetic), title_memory handshake (extra[1] == bytes), and note_heap at the requested NumDescriptors.
    • desktop_cpu_handle: checks offset < r.desktop_bytes || r.desktop_bytes == r.bytes and releases descriptor_lock before calling log(...) (up to 4 times via first_calls(reported, 4)).
    • Edge cases noted:
      1. If CreateDescriptorHeap were to fail even at view_heap_probe_floor (65536), the halving loop stops at ceiling == 65536 without confirming 65536 succeeds (unlikely on D3D12 drivers, but low would remain unverified).
      2. Out-of-range handles (offset >= r.desktop_bytes when r.desktop_bytes < r.bytes) leave result = handle (title memory); any D3D12 call passing that handle to the driver will still fail/fault, consistent with the PR's stated logged-shortcut scope.
      3. Concurrent threads spin up to 2000 * Sleep(1) (~2 s) and return 0 if probing has not finished, skipping clamping for that call.
  • Title-neutrality (AGENTS.md): compliant.

Checks Run (Linux / Python)

  • git diff --check origin/main...HEAD: pass (0 issues)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 280 links)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1046 files)
  • Windows build and runtime tests: not run locally.
**@⁠tedin7** on GitHub · 2026-11-24 05:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1240#pullrequestreview-6033963460) · **reviewed** Reviewed commit `16761eed` (Linux host; Windows build and runtime tests were not executed locally). ### Code & Edge-Case Audit - `src/startup_stubs/d3d12_xs_device.cpp`: - `accepted_view_heap_descriptors`: probes once per process (guarded by `InterlockedCompareExchange` state `0 -> 1 -> 2`) for shader-visible `CBV_SRV_UAV` heaps when `CreateDescriptorHeap` returns `E_INVALIDARG` and `NumDescriptors > view_heap_probe_floor` (`65536`), halving from `1,048,576` and bisecting upward. - `device_create_descriptor_heap`: clamps only the desktop `CreateDescriptorHeap` request while keeping `bytes` (`std::uint64_t` arithmetic), `title_memory` handshake (`extra[1] == bytes`), and `note_heap` at the requested `NumDescriptors`. - `desktop_cpu_handle`: checks `offset < r.desktop_bytes || r.desktop_bytes == r.bytes` and releases `descriptor_lock` before calling `log(...)` (up to 4 times via `first_calls(reported, 4)`). - Edge cases noted: 1. If `CreateDescriptorHeap` were to fail even at `view_heap_probe_floor` (`65536`), the halving loop stops at `ceiling == 65536` without confirming `65536` succeeds (unlikely on D3D12 drivers, but `low` would remain unverified). 2. Out-of-range handles (`offset >= r.desktop_bytes` when `r.desktop_bytes < r.bytes`) leave `result = handle` (title memory); any D3D12 call passing that handle to the driver will still fail/fault, consistent with the PR's stated logged-shortcut scope. 3. Concurrent threads spin up to `2000 * Sleep(1)` (~2 s) and return `0` if probing has not finished, skipping clamping for that call. - Title-neutrality (`AGENTS.md`): compliant. ### Checks Run (Linux / Python) - `git diff --check origin/main...HEAD`: pass (0 issues) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: pass (16 Markdown files, 280 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: pass (1046 files) - Windows build and runtime tests: not run locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.