tests: cover byte Mesh86 material descriptors #3812

Manually merged
github merged 3 commits from github-bot/gh-3810 into gh-pr/3810/base 2026-12-03 02:02:14 +00:00 AGit
Owner

@⁠lambirou on GitHub · 2026-12-02 01:22 UTC · original
lambirou:codex/mesh86-material-dwords → main · +25 −0 · 1 files · 3 commits · merged 2026-12-03 01:54 UTC

Scope\n\nThe shared runtime change now lives on main through #3727 (mesh86_material with byte-descriptor truncation and placed-backing adoption). This PR keeps only the fixture coverage that was unique to it.\n\n## Coverage\n\n ests/startup_mesh86_material_backing.cpp now exercises byte-format material descriptors (stride 1):\n\n- an 18-byte descriptor resolves to the four whole dwords (ytes == 16, offset 0) of the placed backing;\n- a three-byte descriptor is refused with material buffer range has no whole dwords.\n\nThe 18-byte case crosses the rounded-down tail (bytes 16-17 are not addressable through the dword SRV). The shader minimum-read comparison happens later in

ative_mesh86.inl and remains covered by the draw path, not by this resolver fixture.\n\n## Validation\n\n- Branch rebuilt directly on main (2f2901cb); no runtime files are changed.\n- Build and test on Windows runs startup_mesh86_material_backing_warp and its mutants.

**@⁠lambirou** on GitHub · 2026-12-02 01:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3810) `lambirou:codex/mesh86-material-dwords` → `main` · +25 −0 · 1 files · 3 commits · merged 2026-12-03 01:54 UTC ## Scope\n\nThe shared runtime change now lives on main through #3727 (mesh86_material with byte-descriptor truncation and placed-backing adoption). This PR keeps only the fixture coverage that was unique to it.\n\n## Coverage\n\n ests/startup_mesh86_material_backing.cpp now exercises byte-format material descriptors (stride 1):\n\n- an 18-byte descriptor resolves to the four whole dwords (ytes == 16, offset 0) of the placed backing;\n- a three-byte descriptor is refused with material buffer range has no whole dwords.\n\nThe 18-byte case crosses the rounded-down tail (bytes 16-17 are not addressable through the dword SRV). The shader minimum-read comparison happens later in ative_mesh86.inl and remains covered by the draw path, not by this resolver fixture.\n\n## Validation\n\n- Branch rebuilt directly on main (2f2901cb); no runtime files are changed.\n- Build and test on Windows runs startup_mesh86_material_backing_warp and its mutants.
The shared scalar ALU already lowers all three, SCC included. The mesh
frontend refused them with "unsupported mesh instruction or EXEC state".
They now join s_bfe_u32 and s_min_u32 on the shared path, with the same
EXEC and VCC destination refusals.

On a native Mesh86 capture (1,569 distinct slot 86 programs), these were
the first refusal for 555 of them, and 122 more now translate fully.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-up on #3708. After s_cmp_eq_u32 s20, 0, an s_cselect_b32
behind s_brev_b32 still selects on the compare's SCC, and behind s_not_b32
on (result != 0). Both selects reach the exported X.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adopt the existing committed desktop backing for a placed material view, refresh it from title memory at submit, and copy only changed runs. Keep the existing backing and its fences; a submitted GPU write stops refreshes. Add a source-built two-SRV fixture with range, token, stale, budget and mutant controls.

Refs #3640, #3638, #3545.
Both are already lowered by the shared ALU (the reciprocal as v_rcp_f32,
the shift as an arithmetic right shift by src0 & 31). The mesh lane ALU
list now admits them, so the full_exec || exec_skip rule and the
partial-write merge apply unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-up on #3709: v-rcp-iflag-f32 now checks that the reciprocal's
bits reach the exported X, as v-ashrrev-i32 already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mesh frontend narrowed EXEC only for v_cmpx_eq_u32, ne_u32 and lt_u32,
and for v_cmpx_gt_u32 only in the lane-linear count form. Mesh86 programs
also use v_cmpx_lg_f32, v_cmpx_gt_f32 and a per-lane v_cmpx_gt_u32.

They now get the same EXEC-only narrowing through the shared compare: lg is
an ordered fcmp one and gt_f32 an ordered ogt, so a NaN lane leaves EXEC,
and gt_u32 is icmp ugt. The count form of v_cmpx_gt_u32 is still matched
first. Float abs/neg, SDWA, DPP, clamp and omod stay refused.

Part of #3703.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inside the vertex skip, skinned mesh programs save EXEC, narrow it with
one v_cmpx_ne_u32 and no EXECZ, run straight-line VALU work and restore
the saved vertex mask. The restore was refused as "mesh EXEC write inside
a lane-skip block".

When the CMPX runs, every register is exact for the skip's guard lanes.
A write under the narrowed mask whose old value is still that exact value
(unchanged since the CMPX, or itself merged) is now merged per lane with
it, so it stays exact for the guard. A restore of the guard's saved mask
keeps every register that is unchanged since the CMPX or merged, and
clears the rest, such as a register first written under the narrowed
mask. A second narrowing, or a restore of a mask saved under the narrowed
EXEC, stays refused.

Part of #3703.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The #3671 lane-limit proof tags partial VGPRs with the vertex skip's lane
count when the skip closes, so an export under the same count may read them
after full EXEC returns. It required the closing skip's guard to be the
current lane mask. When a nested CMPX skip inside the vertex skip exits to
the same EXEC restore, the nested mask is still current at the outer close,
so the proof was skipped and the restore erased the position VGPRs
("graphics register undefined on an incoming path").

A nested per-lane skip now records the parent guard when it opens directly
after a single CMPX that narrowed it. Nothing ran under the narrowed mask
outside that skip, and the skip branches per thread, so after it closes
every register is exact for each of the parent's lanes. If the parent then
closes at the same instruction, its lane limit applies as before. Any other
narrowing, a write between the CMPX and the EXECZ, or another path arriving
at the restore keeps the previous behavior.

Part of #3703 (item 6).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A chain of per-lane skips, each opened straight after a CMPX that narrows
the skip around it, merges every register per lane when it closes. #3710
carried that fact from one nested skip to its parent only, and only when
the parent closed at the same instruction. Skinned mesh programs nest
three such skips inside the vertex skip and close all of them at a restore
of the vertex mask, after which the vertex skip goes on. The restore then
treated every register written since the mask was saved as stale and
cleared it, so the next read refused with "graphics register undefined on
an incoming path".

The carried lane set now passes through any depth of skips closing at one
pc, and an EXEC restore at that pc keeps the register file when the
restored mask is the carried guard of the enclosing skip. The set is tied
to its pc so it never describes a later instruction. A write between the
innermost CMPX and its EXECZ, or a narrowing that is not a CMPX, still
breaks the chain.

Part of #3703.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mesh frontend accepted buffer_load_format_x only from a resource heap
slot. Skinned slot 86 programs read the V# whole from a bound descriptor
table instead and were refused with "formatted mesh load lacks an
R32_UINT resource heap contract".

Translator: a format load whose V# comes from a bound table goes through
the shared typed-buffer SRV path, as in vertex and pixel shaders, which
checks the table binding and all four descriptor words. The #3720
control that kept this route refused under heap tokens now checks that
it compiles without a token view.

Runtime: slot 86 accepts a one-dword typed_buffer_srv from a descriptor
table and binds it as an R32_UINT buffer view through the same checks as
a typed heap slot (R32_UINT token view, or a raw V# with the identity
component map and a 4-byte stride). A raw table V# must also name a
32-bit format (32_UINT, 32_SINT or 32_FLOAT), so the view returns the
dword the guest load would. Those word 3 checks live in
mesh86_typed_vsharp.h with unit tests and two mutation controls.

Part of #3703.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A merged value is exact for the guard's lanes only in the register it was
merged into. Keying the merges by value let a copy of a merged value into
another register pass the restore as exact. Record the merged value per
register instead, and add the copy fixture from review plus a second merge
into the same register.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A raw V# with SWIZZLE_ENABLE (word 1 bit 31) or ADD_TID_ENABLE (word 3
bit 23) set addresses elements differently from the linear R32_UINT view
slot 86 binds, so refuse it on both the heap and the table route. Add a
linear_addressing unit case with two header mutation controls, and run
the mesh86_typed_vsharp tests in the pr preset.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pr test filter runs mesh86_typed_vsharp_*, but the pr build preset
only builds its listed targets, so CI reported the tests as not run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inside a SAVEEXEC then arm the compiler often copies EXEC, runs some
vector work, narrows EXEC with one CMPX, skips with EXECZ and restores the
copy. Each lane runs the work and then the skipped instructions only if
the compare holds: the same if-only region s_and_saveexec_b64 would open
on the compare. The then-arm scan now registers it as a child region and
the mesh frontend lowers it as a nested diamond on the shared compare,
through the existing nested SAVEEXEC join and restore. The region needs
its own restore of the copied register inside the arm; anything else
stays an EXEC read of the then arm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The compiler also narrows the rest of an if-only SAVEEXEC then arm with a
CMPX whose EXECZ skips to the arm's end, leaving the EXEC copy unrestored.
The rest of the arm is then the region, and the SAVEEXEC restore ends
both. Accept that form when the enclosing arm has no else arm (its
inverse would read the narrowed EXEC), and visit the join address again
after the region closes so the enclosing arm ends there too. Regions
chain the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The then-arm scan recorded every scalar destination as a register pair,
so a 32-bit write such as s_lshl_b32 s7 also marked s8 as written. At
the join s8 was clobbered, and a lane mask kept there was lost; the
else arm also could not read the neighbour. Record the pair only for
64-bit SALU forms and for non-SALU writes (compare masks, readlane),
as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A buffer_load_dword, or a buffer_load_format_x from a descriptor-table
V#, without OFFEN, with a uniform IDXEN index if any and a constant or
uniform SOFFSET, reads the same address in every lane. Until the shader
stores to memory it returns the same dwords in every lane, so mark them
uniform under the same conditions as the heap typed load and let a
following v_readfirstlane read them. The address is checked before the
load, whose destination may be its own index register.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refs #2413, #3416
# Conflicts:
#	CMakePresets.json
#	docs/experiments/mesh86-pixel-execz.md
# Conflicts:
#	CMakePresets.json
# Conflicts:
#	CMakePresets.json
# Conflicts:
#	src/gfx1013_direct_mesh.inl
#	tests/native_direct_mesh_check.py
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 01:24:54 +00:00
github-bot force-pushed github-bot/gh-3810 from 6655a0aab4 to 617b5d1f4e 2026-12-02 01:36:59 +00:00 Compare
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 05:24 UTC · original · reviewed

I checked the merge against main 20def93d. The merge tree conflicts in CMakePresets.json and tests/standin_exports_check.py; the Mesh86 implementation files merge textually. Please carry forward both the existing main checks and the new Mesh86 material-backing registration/contract on the rebased head. Please then rerun the material-backing WARP and hardware cases and the stand-in source check.

**@⁠R0Y00** on GitHub · 2026-12-02 05:24 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3810#pullrequestreview-6145225876) · **reviewed** I checked the merge against main `20def93d`. The merge tree conflicts in `CMakePresets.json` and `tests/standin_exports_check.py`; the Mesh86 implementation files merge textually. Please carry forward both the existing main checks and the new Mesh86 material-backing registration/contract on the rebased head. Please then rerun the material-backing WARP and hardware cases and the stand-in source check.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 12:02 UTC · original · reviewed

I built startup_mesh86_material_backing from 0839ddcc and ran ctest --preset dev --no-tests=error -j 1 -V -R '^startup_mesh86_material_backing_'. All six tests passed with zero skips across Microsoft WARP and the RTX 4060 Laptop GPU, including the expected stale-refresh failure and GPU-write provenance controls. Host build 26300.9974, NVIDIA driver 32.0.16.1656, WARP 10.0.26100.9818, D3D12 debug layer off.

The new handling is keyed on InputBufferUse::mesh_material, which Mesh57 now passes too. That means Mesh57 also gets partial-dword truncation, the submitted-GPU-backing path and adoption of non-aliased placed resources. Could you keep the new behavior scoped to Mesh86, or document and cover the Mesh57 cases with a regression fixture if the shared behavior is intended? The current test resolves only the Mesh86 material path.

The required Windows job also failed in the inherited native_direct_mesh fixture (+0x34: unmapped graphics export). #3853 has the fixture fix.

**@⁠R0Y00** on GitHub · 2026-12-02 12:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3810#pullrequestreview-6150307236) · **reviewed** I built `startup_mesh86_material_backing` from `0839ddcc` and ran `ctest --preset dev --no-tests=error -j 1 -V -R '^startup_mesh86_material_backing_'`. All six tests passed with zero skips across Microsoft WARP and the RTX 4060 Laptop GPU, including the expected stale-refresh failure and GPU-write provenance controls. Host build 26300.9974, NVIDIA driver 32.0.16.1656, WARP 10.0.26100.9818, D3D12 debug layer off. The new handling is keyed on `InputBufferUse::mesh_material`, which Mesh57 now passes too. That means Mesh57 also gets partial-dword truncation, the submitted-GPU-backing path and adoption of non-aliased placed resources. Could you keep the new behavior scoped to Mesh86, or document and cover the Mesh57 cases with a regression fixture if the shared behavior is intended? The current test resolves only the Mesh86 material path. The required Windows job also failed in the inherited `native_direct_mesh` fixture (`+0x34: unmapped graphics export`). #3853 has the fixture fix.
Author
Owner

@⁠lambirou on GitHub · 2026-12-02 14:44 UTC · original · reviewed

Reviewed 3aeb40f7 against the maintainer's 0839ddcc test report; read the diff, not built here.

Verdict: changes requested. The new material-backing behavior is keyed on InputBufferUse::mesh_material, but Mesh57 passes that use too. Truncating to whole dwords, preferring a submitted GPU backing and adopting a non-aliased placed resource therefore also change the Mesh57 material path, while the new fixture covers only Mesh86.

  • MUST Keep the new behavior scoped to Mesh86 (a separate use/flag), or document and cover the Mesh57 cases with a regression fixture. The maintainer already asked for this on the integrated head; the current PR has no Mesh57 coverage for the changed path.
  • SHOULD The 18-byte descriptor floors to 16 bytes before the raw SRV. That is correct for the captured 8-byte read, but a shader whose minimum read reaches bytes 16–17 would now be refused only by the later view.bytes < required_bytes check. Add a control with a byte descriptor whose required read crosses the floored boundary, so the refusal is pinned rather than inferred.
  • Checked, no finding: the truncation is applied only to mesh86_material; the input-buffer zero-record path is unchanged; the GPU-write provenance check runs before the title snapshot; the adoption failure has a named reason. The PR is clean at this head, but the Mesh57 scope issue is a real behavioral change.

The Windows failure in the inherited native_direct_mesh fixture is not caused by this diff; #3853 is the tracking fix.

**@⁠lambirou** on GitHub · 2026-12-02 14:44 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3810#pullrequestreview-6153042652) · **reviewed** Reviewed `3aeb40f7` against the maintainer's `0839ddcc` test report; read the diff, not built here. **Verdict: changes requested.** The new material-backing behavior is keyed on `InputBufferUse::mesh_material`, but Mesh57 passes that use too. Truncating to whole dwords, preferring a submitted GPU backing and adopting a non-aliased placed resource therefore also change the Mesh57 material path, while the new fixture covers only Mesh86. - **MUST** Keep the new behavior scoped to Mesh86 (a separate use/flag), or document and cover the Mesh57 cases with a regression fixture. The maintainer already asked for this on the integrated head; the current PR has no Mesh57 coverage for the changed path. - **SHOULD** The 18-byte descriptor floors to 16 bytes before the raw SRV. That is correct for the captured 8-byte read, but a shader whose minimum read reaches bytes 16–17 would now be refused only by the later `view.bytes < required_bytes` check. Add a control with a byte descriptor whose required read crosses the floored boundary, so the refusal is pinned rather than inferred. - Checked, no finding: the truncation is applied only to `mesh86_material`; the input-buffer zero-record path is unchanged; the GPU-write provenance check runs before the title snapshot; the adoption failure has a named reason. The PR is clean at this head, but the Mesh57 scope issue is a real behavioral change. The Windows failure in the inherited `native_direct_mesh` fixture is not caused by this diff; #3853 is the tracking fix.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 19:04 UTC · original · reviewed

On 256bcded, native_mesh57.inl still passes InputBufferUse::mesh_material, and the common binder still uses that value for the new truncation and adoption. #3727 now has the separate mesh86_material use while leaving the Mesh57 caller on the original path. Let's use #3727 for the shared runtime change so we only land it once. Please identify any additional fixture coverage here that should carry over, especially a required read that crosses the rounded-down span.

**@⁠R0Y00** on GitHub · 2026-12-02 19:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3810#pullrequestreview-6157042560) · **reviewed** On `256bcded`, `native_mesh57.inl` still passes `InputBufferUse::mesh_material`, and the common binder still uses that value for the new truncation and adoption. #3727 now has the separate `mesh86_material` use while leaving the Mesh57 caller on the original path. Let's use #3727 for the shared runtime change so we only land it once. Please identify any additional fixture coverage here that should carry over, especially a required read that crosses the rounded-down span.
github-bot changed title from runtime: bind whole dwords for byte Mesh86 material descriptors to tests: cover byte Mesh86 material descriptors 2026-12-03 00:36:13 +00:00
github-bot force-pushed github-bot/gh-3810 from 256bcdeded to 3687c198e1 2026-12-03 00:36:17 +00:00 Compare
github-bot changed target branch from main to gh-pr/3810/base 2026-12-03 02:02:01 +00:00
github manually merged commit 01c85822cc into gh-pr/3810/base 2026-12-03 02:02:14 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 01:54 UTC · original · approved these changes

Independently verified 01c85822 with MSVC Debug on Windows 11 build 26300. This is now a test-only follow-up to #3727. ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^startup_mesh86_material_backing_' passed all six registered cases on WARP and RTX 4060 Laptop (616.56), zero skips. Removing only the dword truncation in the runtime failed both new WARP checks: 18 bytes did not bind as four dwords, and 3 bytes were accepted. With the original runtime restored, WARP passed again.

**@⁠R0Y00** on GitHub · 2026-12-03 01:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3810#pullrequestreview-6162364307) · **approved these changes** Independently verified 01c85822 with MSVC Debug on Windows 11 build 26300. This is now a test-only follow-up to #3727. `ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^startup_mesh86_material_backing_'` passed all six registered cases on WARP and RTX 4060 Laptop (616.56), zero skips. Removing only the dword truncation in the runtime failed both new WARP checks: 18 bytes did not bind as four dwords, and 3 bytes were accepted. With the original runtime restored, WARP passed again.
This discussion has been locked. Commenting is limited to contributors.
No description provided.