runtime: bind empty Mesh86 input views as zeros #3812

Open
lambirou wants to merge 11 commits from upstream-pr/3812 into main
lambirou commented 2026-12-02 01:43:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-02T01:43:49Z.


What changes

The Mesh86 input path now treats a zero-record buffer descriptor as an empty
view: every element is out of bounds, so the hardware reads zero. The resolver
binds a 16-byte zero view and records the guest table, record and descriptor
once. The ordinary compute input path is unchanged and still refuses zero
records.

Request 062d66b9e013f28e reaches bind_native_mesh86 with:

stage=mesh srv=t0 root=1 table_offset=0x40 root_type=0
descriptor=00013920,00000000,00000000,00000000
reason=an input buffer descriptor has zero records

0x40 is descriptor record 2. The guest root signature parameter 1 table
declares t12 space1, t69 space1, t20 space1, t6 space1 and b0 space1, so the
empty record is SRV t20 space1. The captured mesh shader has an empty input
signature and only emits SV_Position; its guest code loads that V# with
s_load_dwordx4 s[32:35], s[10:11], 0x40 and reads from it on one branch.
NUM_RECORDS is zero, which is an empty view rather than a missing backing.

Tests

tests/startup_indirect_mesh_input_stream.hlsl is a source-built PS-less mesh
stage with a descriptor-table ByteAddressBuffer at t0 that reads two DWORDs and
emits one triangle. tests/startup_mesh86_input_stream_check.py publishes the
desktop profile and runs three cases:

  • a nonzero raw V# naming a placed 16-byte buffer writes depth 0.5;
  • a zero-record V# with a nonzero base binds 16 zero bytes and leaves depth at
    1.0;
  • a V# whose base is not backed by a placed or committed buffer keeps the
    named "an input is in title memory outside any placed buffer" refusal.

Exact commands from the worktree:

. .\tools\dev.ps1
cmake --preset release -DINTAKE_PYTHON=C:\Users\rolandedi\dev\labs\xbox-recomp\_wt\agent-mesh-scalar\out\pe-env\Scripts\python.exe
cmake --build --preset release --target compile_dxil d3d12_xs_shim startup_indirect_draw_indexed
ctest --preset release --no-tests=error -R "startup_mesh86_input_stream_hardware" --output-on-failure -V

Hardware RX 9060 XT: passed. The fixture printed its nonzero V# and the shader
wrote depth 0.5; the zero-record and unmapped controls also passed.

WARP: startup_mesh86_input_stream_warp returns 77 only when the dispatch
removes the WARP device with 0x887a0005. The existing
startup_mesh86_psless_warp fixture has the same device removal on this driver,
so the skip is a documented adapter limitation, not a silent pass. Any other
WARP failure still fails the check.

Title replay: the isolated 420 s run was stopped when the integration run took
over the title proof. Its earlier 360 s attempt did not reach the prologue mesh
bind; its compute census showed 0 translated dispatches and refusals with
"an input is in a placed buffer that does not alias title memory" before the
mesh path. The key 062d66b9e013f28e therefore has not yet been observed after
this change in a title run.

Stack

Stacked on #3803 and #3725; the branch starts at de12a89d.

Refs #3763
Refs #3641

Follow-up verification (acd0b64f)

  • python -B tests/standin_exports_check.py: 471 cases, six mutations caught.
  • CMake Release build of d3d12_xs_shim with X2W_HAVE_DXCAPI=0: passed; native-shader Release build also passed.
  • Release CTest startup_mesh86_input_stream_hardware and startup_mesh86_psless_hardware: passed on RX 9060 XT.
  • startup_mesh86_input_stream_warp: skipped after device removal; startup_mesh86_psless_warp: failed with the same 0x887a0005 device removal.
  • The PS-less fixture diagnostic was restored; the new input-stream fixture retains its separate diagnostic.
  • This branch remains stacked on #3803 and #3725 and has conflicts with current main. Title replay remains unverified.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5598104282 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3812). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-02T01:43:49Z. --- ## What changes The Mesh86 input path now treats a zero-record buffer descriptor as an empty view: every element is out of bounds, so the hardware reads zero. The resolver binds a 16-byte zero view and records the guest table, record and descriptor once. The ordinary compute input path is unchanged and still refuses zero records. Request 062d66b9e013f28e reaches bind_native_mesh86 with: ``` stage=mesh srv=t0 root=1 table_offset=0x40 root_type=0 descriptor=00013920,00000000,00000000,00000000 reason=an input buffer descriptor has zero records ``` 0x40 is descriptor record 2. The guest root signature parameter 1 table declares t12 space1, t69 space1, t20 space1, t6 space1 and b0 space1, so the empty record is SRV t20 space1. The captured mesh shader has an empty input signature and only emits SV_Position; its guest code loads that V# with s_load_dwordx4 s[32:35], s[10:11], 0x40 and reads from it on one branch. NUM_RECORDS is zero, which is an empty view rather than a missing backing. ## Tests tests/startup_indirect_mesh_input_stream.hlsl is a source-built PS-less mesh stage with a descriptor-table ByteAddressBuffer at t0 that reads two DWORDs and emits one triangle. tests/startup_mesh86_input_stream_check.py publishes the desktop profile and runs three cases: - a nonzero raw V# naming a placed 16-byte buffer writes depth 0.5; - a zero-record V# with a nonzero base binds 16 zero bytes and leaves depth at 1.0; - a V# whose base is not backed by a placed or committed buffer keeps the named "an input is in title memory outside any placed buffer" refusal. Exact commands from the worktree: ```powershell . .\tools\dev.ps1 cmake --preset release -DINTAKE_PYTHON=C:\Users\rolandedi\dev\labs\xbox-recomp\_wt\agent-mesh-scalar\out\pe-env\Scripts\python.exe cmake --build --preset release --target compile_dxil d3d12_xs_shim startup_indirect_draw_indexed ctest --preset release --no-tests=error -R "startup_mesh86_input_stream_hardware" --output-on-failure -V ``` Hardware RX 9060 XT: passed. The fixture printed its nonzero V# and the shader wrote depth 0.5; the zero-record and unmapped controls also passed. WARP: startup_mesh86_input_stream_warp returns 77 only when the dispatch removes the WARP device with 0x887a0005. The existing startup_mesh86_psless_warp fixture has the same device removal on this driver, so the skip is a documented adapter limitation, not a silent pass. Any other WARP failure still fails the check. Title replay: the isolated 420 s run was stopped when the integration run took over the title proof. Its earlier 360 s attempt did not reach the prologue mesh bind; its compute census showed 0 translated dispatches and refusals with "an input is in a placed buffer that does not alias title memory" before the mesh path. The key 062d66b9e013f28e therefore has not yet been observed after this change in a title run. ## Stack Stacked on #3803 and #3725; the branch starts at de12a89d. Refs #3763 Refs #3641 ## Follow-up verification (acd0b64f) - python -B tests/standin_exports_check.py: 471 cases, six mutations caught. - CMake Release build of d3d12_xs_shim with X2W_HAVE_DXCAPI=0: passed; native-shader Release build also passed. - Release CTest startup_mesh86_input_stream_hardware and startup_mesh86_psless_hardware: passed on RX 9060 XT. - startup_mesh86_input_stream_warp: skipped after device removal; startup_mesh86_psless_warp: failed with the same 0x887a0005 device removal. - The PS-less fixture diagnostic was restored; the new input-stream fixture retains its separate diagnostic. - This branch remains stacked on #3803 and #3725 and has conflicts with current main. Title replay remains unverified.
lambirou commented 2026-12-02 14:44:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-02T14:44:38Z.

Review: COMMENTED


Reviewed acd0b64f against #3803; read the Mesh86 input delta and fixture, not built here.

Verdict: approve. The zero-record descriptor is now treated as an empty view only for the Mesh86 material/input path: the resolver allocates a 16-byte zero upload, records the table, record and descriptor once, and leaves the ordinary compute input path refusing zero records. The unmapped control still refuses by name.

  • NIT The log path indexes pass.view_tables[source.root_parameter] without a local bounds check. The source view is already validated before this point, so this is safe today; a guard or a comment would make the invariant explicit.
  • NIT The WARP skip is correctly limited to the documented 0x887a0005 device removal; keep that condition narrow so a future WARP failure is not silently converted to 77.
  • Checked, no finding: a nonzero V# still binds its placed buffer and writes depth 0.5; a zero-record V# binds zeros and leaves the depth clear; an unmapped base keeps the named refusal. The new enum value does not change the compute path.

The PR is stacked on #3803 and #3725; merge order and rebase remain the constraint.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6153051559 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3812#pullrequestreview-6153051559). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-02T14:44:38Z. **Review:** COMMENTED --- Reviewed `acd0b64f` against #3803; read the Mesh86 input delta and fixture, not built here. **Verdict: approve.** The zero-record descriptor is now treated as an empty view only for the Mesh86 material/input path: the resolver allocates a 16-byte zero upload, records the table, record and descriptor once, and leaves the ordinary compute input path refusing zero records. The unmapped control still refuses by name. - **NIT** The log path indexes `pass.view_tables[source.root_parameter]` without a local bounds check. The source view is already validated before this point, so this is safe today; a guard or a comment would make the invariant explicit. - **NIT** The WARP skip is correctly limited to the documented `0x887a0005` device removal; keep that condition narrow so a future WARP failure is not silently converted to 77. - Checked, no finding: a nonzero V# still binds its placed buffer and writes depth 0.5; a zero-record V# binds zeros and leaves the depth clear; an unmapped base keeps the named refusal. The new enum value does not change the compute path. The PR is stacked on #3803 and #3725; merge order and rebase remain the constraint.
timbot103 commented 2026-12-03 10:34:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-03T10:34:01Z.


Independent RTX 5080 + WARP run, in case a second NVIDIA data point helps (the reviewer runs here are on an RTX 4060 Laptop). Two of these findings repeat on all three of #3803, #3812 and #3813, so they probably do not come from this PR's own change, and I have not bisected them: (1) native_direct_mesh fails its uniform-load-offen refusal assertion, and (2) in-box WARP removes the device (0x887a0005) after the PS-less dispatch. The RTX 5080 depth readback of 0x7fff where the new fixtures expect 0x8000 looks NVIDIA-specific. It might need a one-ULP tolerance, or a depth value that is exactly representable. Full details below.


Independent verification of head acd0b64f7fc743611ff8e6bf056280611fa58bf4 against pinned main d2e6a4ed9fd7377ea5a01d9384a845c26ed7b5e5.
The merge stopped with 13 conflicts, including src/startup_stubs/mesh86_cache.inl and tests/startup_indirect_draw_indexed.cpp. These runs used the published head.

Windows 11 build 26200.9974. RTX 5080 driver 32.0.16.2140 (621.40). Microsoft Basic Render Driver with in-box WARP 10.0.26100.9818. DXC 1.9.2602.17 (21d28f727). The startup fixture reported the debug layer unavailable.

Commands run with $cfg set to dev and release, $python set to the project venv interpreter and XBOX2WINDOWS_ADAPTER set to NVIDIA GeForce RTX 5080.

. .\tools\dev.ps1
cmake --preset $cfg "-DINTAKE_PYTHON=$python"
cmake --build out/build/$cfg --target compile_dxil startup_indirect_draw_indexed startup_mesh86_material_backing -- -j 6
ctest --preset $cfg --no-tests=error -j 1 -R '^(startup_mesh86_|runtime_mesh86_cache_cli_check$|startup_indirect_mesh(_console|_request|_create_result)?_(warp|hardware)$|startup_indirect_mesh_(cache|lease)_|native_direct_(mesh|container)$|native_mesh_).*$' -V
& $python -B tests/standin_exports_check.py
cmake --preset release -B out/build/release-no-dxc -DX2W_HAVE_DXCAPI=0 "-DINTAKE_PYTHON=$python"
cmake --build out/build/release-no-dxc --target d3d12_xs_shim -- -j 6

Counts are pass/fail/skip. The totals include the adapter-independent tests.

Config WARP RTX 5080 Other Total
Debug 27/1/1 26/2/0 3/1/0 56/4/1
Release 27/1/1 26/2/0 3/1/0 56/4/1
  • Debug startup_mesh86_input_stream_warp skipped after WARP device removal at the positive dispatch.
  • Debug startup_mesh86_input_stream_hardware stopped at the positive depth comparison before the zero-record and unmapped controls.
  • Debug standin_exports_check.py. standin_exports: 471 cases, 6/6 mutations killed PASS
  • Release startup_mesh86_input_stream_warp skipped after WARP device removal at the positive dispatch.
  • Release startup_mesh86_input_stream_hardware stopped at the positive depth comparison before the zero-record and unmapped controls.
  • Release standin_exports_check.py. standin_exports: 471 cases, 6/6 mutations killed PASS
  • The separate Release build of d3d12_xs_shim with X2W_HAVE_DXCAPI=0 passed.
  • Separate Debug warp replay of checks after the positive readback. zero skip, unmapped pass. map argument readback failed (HRESULT 0x887a0005).
  • Separate Debug hardware replay of checks after the positive readback. zero pass, unmapped pass.
  • Separate Release warp replay of checks after the positive readback. zero skip, unmapped pass. map argument readback failed (HRESULT 0x887a0005).
  • Separate Release hardware replay of checks after the positive readback. zero pass, unmapped pass.

Failure diagnostics

Debug native_direct_mesh

AssertionError: ('compiler_init_ms=18.3839\ncold_compile_and_publish_ms=5.657 bytes=4580\n', '')

Debug/Release startup_mesh86_input_stream_hardware

Mesh86 input stream: pixel (0,0): got 0x00007fff, expected 0x00008000

Debug/Release startup_mesh86_psless_warp

map argument readback failed (HRESULT 0x887a0005)

Debug/Release startup_mesh86_psless_hardware

PS-less root SRV: pixel (0,0): got 0x00007fff, expected 0x00008000

Release native_direct_mesh

AssertionError: ('compiler_init_ms=16.1737\ncold_compile_and_publish_ms=4.3803 bytes=4580\n', '')

native_direct_mesh failed its uniform-load-offen refusal assertion. The compiler published a shader where the fixture expected a refusal.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7375423803 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3812#issuecomment-7375423803). Originally posted by [timbot103](https://github.com/timbot103) on 2026-12-03T10:34:01Z. --- Independent RTX 5080 + WARP run, in case a second NVIDIA data point helps (the reviewer runs here are on an RTX 4060 Laptop). Two of these findings repeat on all three of #3803, #3812 and #3813, so they probably do not come from this PR's own change, and I have not bisected them: (1) `native_direct_mesh` fails its `uniform-load-offen` refusal assertion, and (2) in-box WARP removes the device (`0x887a0005`) after the PS-less dispatch. The RTX 5080 depth readback of `0x7fff` where the new fixtures expect `0x8000` looks NVIDIA-specific. It might need a one-ULP tolerance, or a depth value that is exactly representable. Full details below. --- Independent verification of head `acd0b64f7fc743611ff8e6bf056280611fa58bf4` against pinned main `d2e6a4ed9fd7377ea5a01d9384a845c26ed7b5e5`. The merge stopped with 13 conflicts, including `src/startup_stubs/mesh86_cache.inl` and `tests/startup_indirect_draw_indexed.cpp`. These runs used the published head. Windows 11 build 26200.9974. RTX 5080 driver 32.0.16.2140 (621.40). Microsoft Basic Render Driver with in-box WARP 10.0.26100.9818. DXC 1.9.2602.17 (21d28f727). The startup fixture reported the debug layer unavailable. Commands run with `$cfg` set to `dev` and `release`, `$python` set to the project venv interpreter and `XBOX2WINDOWS_ADAPTER` set to `NVIDIA GeForce RTX 5080`. ```powershell . .\tools\dev.ps1 cmake --preset $cfg "-DINTAKE_PYTHON=$python" cmake --build out/build/$cfg --target compile_dxil startup_indirect_draw_indexed startup_mesh86_material_backing -- -j 6 ctest --preset $cfg --no-tests=error -j 1 -R '^(startup_mesh86_|runtime_mesh86_cache_cli_check$|startup_indirect_mesh(_console|_request|_create_result)?_(warp|hardware)$|startup_indirect_mesh_(cache|lease)_|native_direct_(mesh|container)$|native_mesh_).*$' -V & $python -B tests/standin_exports_check.py cmake --preset release -B out/build/release-no-dxc -DX2W_HAVE_DXCAPI=0 "-DINTAKE_PYTHON=$python" cmake --build out/build/release-no-dxc --target d3d12_xs_shim -- -j 6 ``` Counts are pass/fail/skip. The totals include the adapter-independent tests. | Config | WARP | RTX 5080 | Other | Total | |---|---:|---:|---:|---:| | Debug | 27/1/1 | 26/2/0 | 3/1/0 | 56/4/1 | | Release | 27/1/1 | 26/2/0 | 3/1/0 | 56/4/1 | - Debug `startup_mesh86_input_stream_warp` skipped after WARP device removal at the positive dispatch. - Debug `startup_mesh86_input_stream_hardware` stopped at the positive depth comparison before the zero-record and unmapped controls. - Debug `standin_exports_check.py`. standin_exports: 471 cases, 6/6 mutations killed PASS - Release `startup_mesh86_input_stream_warp` skipped after WARP device removal at the positive dispatch. - Release `startup_mesh86_input_stream_hardware` stopped at the positive depth comparison before the zero-record and unmapped controls. - Release `standin_exports_check.py`. standin_exports: 471 cases, 6/6 mutations killed PASS - The separate Release build of `d3d12_xs_shim` with `X2W_HAVE_DXCAPI=0` passed. - Separate Debug warp replay of checks after the positive readback. zero skip, unmapped pass. `map argument readback failed (HRESULT 0x887a0005)`. - Separate Debug hardware replay of checks after the positive readback. zero pass, unmapped pass. - Separate Release warp replay of checks after the positive readback. zero skip, unmapped pass. `map argument readback failed (HRESULT 0x887a0005)`. - Separate Release hardware replay of checks after the positive readback. zero pass, unmapped pass. Failure diagnostics Debug `native_direct_mesh` ```text AssertionError: ('compiler_init_ms=18.3839\ncold_compile_and_publish_ms=5.657 bytes=4580\n', '') ``` Debug/Release `startup_mesh86_input_stream_hardware` ```text Mesh86 input stream: pixel (0,0): got 0x00007fff, expected 0x00008000 ``` Debug/Release `startup_mesh86_psless_warp` ```text map argument readback failed (HRESULT 0x887a0005) ``` Debug/Release `startup_mesh86_psless_hardware` ```text PS-less root SRV: pixel (0,0): got 0x00007fff, expected 0x00008000 ``` Release `native_direct_mesh` ```text AssertionError: ('compiler_init_ms=16.1737\ncold_compile_and_publish_ms=4.3803 bytes=4580\n', '') ``` `native_direct_mesh` failed its `uniform-load-offen` refusal assertion. The compiler published a shader where the fixture expected a refusal.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3812:upstream-pr/3812'
git switch 'upstream-pr/3812'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3812'
git switch 'upstream-pr/3812'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3812'
git switch 'upstream-pr/3812'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3812'
git switch 'main'
git merge --squash 'upstream-pr/3812'
git switch 'main'
git merge --ff-only 'upstream-pr/3812'
git switch 'main'
git merge 'upstream-pr/3812'
git push origin 'main'
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!3812
No description provided.