runtime: bind slot 86 heap window views only in the shader's read type (Part of #3545) #3599

Merged
mumba17 merged 1 commit from upstream-pr/3599 into main 2026-11-30 15:41:52 +00:00
mumba17 commented 2026-11-30 12:29:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-30T12:29:03Z.


Part of #3545. Follow-up to #3593. Target main.

Problem

#3593 bound any typed buffer format in a heap-buffer window. A desktop stage that reads Buffer<float4> could therefore be given an R32G32B32A32_UINT view, which D3D12 leaves undefined. @timbot103's prototype on #3545 refuses this wrong-format case.

Change

Publisher (mesh86_cache.py):

  • Takes each heap read's component type from the low byte of its annotateHandle properties: F32, SNormF32 and UNormF32 count as f32, U32 as u32, I32 as i32.
  • Refuses other types, such as F16, and refuses windows whose reads mix types.
  • Writes the type into the profile 3 marker: heap-buffer <first> <count> <type>.

Runtime (mesh86_cache.inl):

  • At creation, a window marker without a type is refused.
  • At ExecuteIndirect, a slot is bound as a typed null if its view format reads as a different type: FLOAT, UNORM and SNORM read as f32, UINT as u32, SINT as i32.
  • Every null view, including the slots below the window, uses an R32G32B32A32 format of the window's type.

The profile 3 marker format changes. #3593 merged at 12:19Z today, and no published markers exist outside the fixtures.

Tests

  • startup_indirect_mesh_cache_heap_*:
    • new case: slot 5 holds an R32G32B32A32_UINT view of the same bytes in an f32 window. It reads as null, red on the left half, and the log row slot format does not match the window's read type appears;
    • new case: a marker with an untyped window is refused, and the targets stay clear;
    • the views, swapped, empty and raw cases are unchanged.
  • runtime_mesh86_cache_cli_check: three new window cases (a u32 window, an F16 read refused, and a mixed f32/u32 window refused), on top of the seven from #3593.

Windows 11 build 26300, MSVC 19.44, Release, debug layer enabled. On an RTX 3090 (driver 32.0.16.1664) and WARP 10.0.26100.9818, all 23 slot 86, cached mesh and mesh lease tests passed with no D3D12 errors.

ctest --preset release --no-tests=error -j1 -R '^(startup_indirect_mesh_cache_heap_|runtime_mesh86_cache_cli_check$)' -V

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5565296990 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3599). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-30T12:29:03Z. --- Part of #3545. Follow-up to #3593. Target `main`. ## Problem #3593 bound any typed buffer format in a heap-buffer window. A desktop stage that reads `Buffer<float4>` could therefore be given an `R32G32B32A32_UINT` view, which D3D12 leaves undefined. @timbot103's prototype on #3545 refuses this wrong-format case. ## Change **Publisher** (`mesh86_cache.py`): - Takes each heap read's component type from the low byte of its `annotateHandle` properties: F32, SNormF32 and UNormF32 count as `f32`, U32 as `u32`, I32 as `i32`. - Refuses other types, such as F16, and refuses windows whose reads mix types. - Writes the type into the profile 3 marker: `heap-buffer <first> <count> <type>`. **Runtime** (`mesh86_cache.inl`): - At creation, a window marker without a type is refused. - At `ExecuteIndirect`, a slot is bound as a typed null if its view format reads as a different type: FLOAT, UNORM and SNORM read as `f32`, UINT as `u32`, SINT as `i32`. - Every null view, including the slots below the window, uses an `R32G32B32A32` format of the window's type. The profile 3 marker format changes. #3593 merged at 12:19Z today, and no published markers exist outside the fixtures. ## Tests - `startup_indirect_mesh_cache_heap_*`: - new case: slot 5 holds an `R32G32B32A32_UINT` view of the same bytes in an `f32` window. It reads as null, red on the left half, and the log row `slot format does not match the window's read type` appears; - new case: a marker with an untyped window is refused, and the targets stay clear; - the views, swapped, empty and raw cases are unchanged. - `runtime_mesh86_cache_cli_check`: three new window cases (a `u32` window, an F16 read refused, and a mixed f32/u32 window refused), on top of the seven from #3593. Windows 11 build 26300, MSVC 19.44, Release, debug layer enabled. On an RTX 3090 (driver 32.0.16.1664) and WARP 10.0.26100.9818, all 23 slot 86, cached mesh and mesh lease tests passed with no D3D12 errors. ```powershell ctest --preset release --no-tests=error -j1 -R '^(startup_indirect_mesh_cache_heap_|runtime_mesh86_cache_cli_check$)' -V ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timbot103 commented 2026-11-30 12:44:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-11-30T12:44:36Z.


Independent Release retest of 3f9af963bd1a on RTX 5080 and WARP. I adapted the source-built fixture to use this PR’s publisher and runtime. The publisher proved heap-buffer 4 2 f32 for 4 + min(group.x, 1u). The typed buffer load is in the mesh stage, and the draw runs through wrapped slot 86 and ExecuteIndirect.

Both adapters matched all eight pixels in each case. The two live views drew red and green. An explicit typed null, an R32G32B32A32_UINT view in the f32 window, and an empty slot each drew black on the left and green on the right. The wrong-type case logged slot format does not match the window's read type. The indirect argument guards stayed intact. The pending-profile control left the target clear.

Five CTest entries passed with the local fixture overlay, including both adapted mesh-stage cases, both existing heap-window cases, and the cache CLI check.

cmake --build --preset release --target startup_indirect_draw_indexed
ctest --preset release --no-tests=error -j 1 -R '^(startup_(mesh86_selected_buffer|indirect_mesh_cache_heap)_(warp|hardware)|runtime_mesh86_cache_cli_check)$' -V

Windows 11 build 26200, RTX 5080 driver 32.0.16.2140, in-box WARP 10.0.26100.9818, MSVC 19.44.35230, and DXC from Windows SDK 10.0.26100.0. The D3D12 debug layer was unavailable.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7278860449 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3599#issuecomment-7278860449). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-30T12:44:36Z. --- Independent Release retest of `3f9af963bd1a` on RTX 5080 and WARP. I adapted the source-built fixture to use this PR’s publisher and runtime. The publisher proved `heap-buffer 4 2 f32` for `4 + min(group.x, 1u)`. The typed buffer load is in the mesh stage, and the draw runs through wrapped slot 86 and `ExecuteIndirect`. Both adapters matched all eight pixels in each case. The two live views drew red and green. An explicit typed null, an `R32G32B32A32_UINT` view in the `f32` window, and an empty slot each drew black on the left and green on the right. The wrong-type case logged `slot format does not match the window's read type`. The indirect argument guards stayed intact. The pending-profile control left the target clear. Five CTest entries passed with the local fixture overlay, including both adapted mesh-stage cases, both existing heap-window cases, and the cache CLI check. ```powershell cmake --build --preset release --target startup_indirect_draw_indexed ctest --preset release --no-tests=error -j 1 -R '^(startup_(mesh86_selected_buffer|indirect_mesh_cache_heap)_(warp|hardware)|runtime_mesh86_cache_cli_check)$' -V ``` Windows 11 build 26200, RTX 5080 driver 32.0.16.2140, in-box WARP 10.0.26100.9818, MSVC 19.44.35230, and DXC from Windows SDK 10.0.26100.0. The D3D12 debug layer was unavailable. AI-assisted.
lukaslw-lab commented 2026-11-30 12:48:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T12:48:05Z.

Review: APPROVED


Reviewed 3f9af963 by reading the diff; not built or run.

Verdict: approve. The read type is proven once in the publisher, carried through the marker, and enforced per slot at bind time; every path that cannot be matched ends in a typed null of the window's type or a creation refusal. No MUST, no SHOULD.

  • Publisher: the low byte of the second ResourceProperties word is the DXIL component type. 9/13/14 → f32, 5 → u32, 4 → i32 is correct, and F16/64-bit and mixed windows are refused (tools/startup/mesh86_cache.py:137, :206).
  • Runtime classes: mesh86_read_class (mesh86_cache.inl:14) covers every format typed_buffer_format_bytes accepts (memory_srv_buffer.h), so the wrong-type branch at :382 is reached only after the format is known to be a typed buffer format. A recognised but unclassified format cannot occur.
  • Marker parse: %3s into char[4] plus the exact expected compare at :307 rejects trailing text and untyped windows.
  • Page reuse (:420): Mesh86HeapEntry::operator== compares Format, and every null entry now carries the window's type. So a u32 window and an f32 window with the same first cannot share a page, and the slots below first keep the right null type.
  • NIT A real shader that reads float and uint buffers through the heap is now refused as a whole (mix read types). Per-slot types in the marker would cover that later.

Tests: the uint_second draw reaches :382 and checks both the pixel and the log row. The untyped-marker loop reaches the :291 refusal. The CLI uint/half/mixed cases reach the publisher's new branches. CI did not run them: runtime_mesh86_cache_cli_check and startup_indirect_mesh_cache_heap_* are outside the pr preset filter, and no workflow calls the Python checks. They ran locally: the author on RTX 3090 + WARP with the debug layer, and timbot103 on RTX 5080 + WARP at this head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6112426859 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3599#pullrequestreview-6112426859). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-30T12:48:05Z. **Review:** APPROVED --- Reviewed `3f9af963` by reading the diff; not built or run. **Verdict: approve.** The read type is proven once in the publisher, carried through the marker, and enforced per slot at bind time; every path that cannot be matched ends in a typed null of the window's type or a creation refusal. No MUST, no SHOULD. - Publisher: the low byte of the second `ResourceProperties` word is the DXIL component type. 9/13/14 → `f32`, 5 → `u32`, 4 → `i32` is correct, and F16/64-bit and mixed windows are refused (`tools/startup/mesh86_cache.py:137`, `:206`). - Runtime classes: `mesh86_read_class` (`mesh86_cache.inl:14`) covers every format `typed_buffer_format_bytes` accepts (`memory_srv_buffer.h`), so the wrong-type branch at `:382` is reached only after the format is known to be a typed buffer format. A recognised but unclassified format cannot occur. - Marker parse: `%3s` into `char[4]` plus the exact `expected` compare at `:307` rejects trailing text and untyped windows. - Page reuse (`:420`): `Mesh86HeapEntry::operator==` compares `Format`, and every null entry now carries the window's type. So a `u32` window and an `f32` window with the same `first` cannot share a page, and the slots below `first` keep the right null type. - **NIT** A real shader that reads float and uint buffers through the heap is now refused as a whole (`mix read types`). Per-slot types in the marker would cover that later. Tests: the `uint_second` draw reaches `:382` and checks both the pixel and the log row. The untyped-marker loop reaches the `:291` refusal. The CLI `uint`/`half`/`mixed` cases reach the publisher's new branches. CI did not run them: `runtime_mesh86_cache_cli_check` and `startup_indirect_mesh_cache_heap_*` are outside the `pr` preset filter, and no workflow calls the Python checks. They ran locally: the author on RTX 3090 + WARP with the debug layer, and timbot103 on RTX 5080 + WARP at this head.
mumba17 commented 2026-11-30 13:10:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-30T13:10:39Z.


Thanks @timbot103 for the independent retest on RTX 5080 and WARP (https://github.com/R0Y00/Xbox2Windows/pull/3599#issuecomment-7278860449). It covers the mesh-stage read path, which my pixel-stage fixture doesn't. Thanks @lukaslw-lab for the review.

On the nit: agreed. A window with both float and uint heap reads is refused as a whole for now. If a real title pass needs mixed types, the marker can carry one type per slot range. That would be its own PR, with a fixture that reads both types.

On CI coverage: good catch. runtime_mesh86_cache_cli_check and startup_indirect_mesh_cache_heap_warp are not in the pr preset filter, so CI never runs them. I'll open a separate small PR that adds them, next to the startup_indirect_mesh_lease_warp_dual entries already there, which use the same driver script and DXC. #3603 will add its heap_wide_warp test the same way.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7279464956 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3599#issuecomment-7279464956). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-30T13:10:39Z. --- Thanks @timbot103 for the independent retest on RTX 5080 and WARP (https://github.com/R0Y00/Xbox2Windows/pull/3599#issuecomment-7278860449). It covers the mesh-stage read path, which my pixel-stage fixture doesn't. Thanks @lukaslw-lab for the review. On the nit: agreed. A window with both float and uint heap reads is refused as a whole for now. If a real title pass needs mixed types, the marker can carry one type per slot range. That would be its own PR, with a fixture that reads both types. On CI coverage: good catch. `runtime_mesh86_cache_cli_check` and `startup_indirect_mesh_cache_heap_warp` are not in the `pr` preset filter, so CI never runs them. I'll open a separate small PR that adds them, next to the `startup_indirect_mesh_lease_warp_dual` entries already there, which use the same driver script and DXC. #3603 will add its `heap_wide_warp` test the same way.
Asimmimx commented 2026-11-30 13:41:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-30T13:41:44Z.


Independent AMD RDNA2 + WARP retest of 3f9af963:

  • Host: Windows 11 build 10.0.26300.0
  • Adapter: AMD Radeon RX 6600 (driver 32.0.21045.29003) and Microsoft WARP
  • Build: dev preset (MSVC Debug), D3D12 debug layer present (d3d12SDKLayers.dll), DXC 10.0.26100.0
  • Command: ctest --preset dev --no-tests=error -j1 -R '^(startup_indirect_mesh_cache_heap_|runtime_mesh86_cache_cli_check$)' -V
  • Result: 3/3 Passed (0 failed, 0 skipped) — runtime_mesh86_cache_cli_check, startup_indirect_mesh_cache_heap_warp, and startup_indirect_mesh_cache_heap_hardware all passed, including the slot format does not match the window's read type null-binding path on AMD Radeon RX 6600.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7280219112 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3599#issuecomment-7280219112). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-30T13:41:44Z. --- Independent AMD RDNA2 + WARP retest of `3f9af963`: - **Host:** Windows 11 build `10.0.26300.0` - **Adapter:** AMD Radeon RX 6600 (driver `32.0.21045.29003`) and Microsoft WARP - **Build:** `dev` preset (MSVC Debug), D3D12 debug layer present (`d3d12SDKLayers.dll`), DXC `10.0.26100.0` - **Command:** `ctest --preset dev --no-tests=error -j1 -R '^(startup_indirect_mesh_cache_heap_|runtime_mesh86_cache_cli_check$)' -V` - **Result:** 3/3 Passed (0 failed, 0 skipped) — `runtime_mesh86_cache_cli_check`, `startup_indirect_mesh_cache_heap_warp`, and `startup_indirect_mesh_cache_heap_hardware` all passed, including the `slot format does not match the window's read type` null-binding path on AMD Radeon RX 6600.
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!3599
No description provided.