runtime: refresh large placed Mesh86 material SRVs #3725
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3725"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-01T11:12:27Z.
Problem
A native Mesh86 material view on a placed buffer was refused when the placed desktop backing did not alias title memory and no GPU copy had filled the range. The representative view is mesh
t0, root parameter 0, table byte offset0xAC0: a raw SRV over the whole 45,613,056-dword placed buffer. It passes the desktop raw-SRV limit, but the binder cannot use the committed default backing as it stands (it starts at zeros) and cannot copy the full view per draw.Change
X2W_D3D12_LINEAR_BUFFERSis not required.tests/cmakeand the PR preset: two raw SRVs at distinct offsets, one GPU dispatch reading both, a stale token, a UAV token, out-of-range and oversized records, sentinels outside the placed range, refresh-byte checks, a budget check, and askip-refreshmutant.Evidence
Build:
cmake --preset release;cmake --build --preset release(all targets).New tests:
The fixture prints, on WARP and hardware:
Existing focused checks:
The full linear-buffer WARP family and its 14 negative controls also passed (22/22).
startup_tools_lintpassed, andtests/docs_links_check.pychecked 208 Markdown files and 803 links.Hardware: AMD Radeon RX 9060 XT (vendor
0x1002, device0x7590), driver32.0.32029.2010, Windows 11 build26300(26H2), debug layer off. The WARP run used the software adapter.Chain and remaining refusal
The fixture's correlated chain is: material table record resolved through the production
indirect_table_buffer(..., InputBufferUse::mesh86_material)path, backing adopted, list recorded, list closed and submitted through the queue wrapper, refresh fence waited, then the two-SRV GPU dispatch read back. The adoption log isx2w-d3d12 linear buffer <resource>: adopted its existing placed backing for material refresh, <bytes> bytes.No local title scene or package was run in this worktree, so the next title refusal is not reported here. On a native run,
X2W_D3D12_TRACE_DIRECT_MESH=1reports the first remaining material refusal with stage, register, root parameter, table offset and reason; the adoption line above identifies whether this view bound.Limits
linear_buffer_backing.h.Refs #3640, #3638, #3545.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-01T11:22:19Z.
Review: CHANGES_REQUESTED
The first adoption can overwrite GPU-produced data. The lookup adopts a non-aliased placement when the current recording has no covering copy and written_by_gpu is false, but written_by_gpu only has evidence for an already tracked backing. With tracking off, a copy or UAV submission before the first material bind can leave valid bytes only in its desktop resource. The first refresh then overwrites that resource from stale title memory. Please preserve producer provenance before adoption or fail closed when earlier use is unknown. Add a control that submits a GPU write while tracking is off, then resolves the first Mesh86 material view and verifies the GPU bytes survive.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-01T11:50:02Z.
Addressed the provenance review in
715b84f0.A submitted GPU write on a backing that was not tracked yet is now remembered by
note_gpu_write;adoptfails closed with the existinga placed material buffer has no coherent desktop backingrefusal instead of refreshing the GPU bytes from stale title memory. The newstartup_mesh86_material_backing_provenance_{warp,hardware}control seeds a real GPU copy while linear tracking is off, resolves the first material view (refused) and reads the injected word back intact while the untouched word stays zero.The title scene is still not claimed; #3641/#3727 covers the source-built presentation proof. Ready for re-review.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T18:12:30Z.
Result from one local 900 s run of the application with this PR (
715b84f0) merged ontomain959306d4, native Mesh86 enabled,X2W_D3D12_TRACE_DIRECT_MESHon.Without the PR, the same configuration reported every material refusal with the placed-buffer reason (an input in a placed buffer that does not alias guest memory). With the PR that reason no longer appears. The four Mesh86 pipelines are still created and selected (24 selections), and the material binding now stops on three other reasons. The trace reports each shape once and each attempt stops at its first failure, so these are 5 distinct shapes, not a count of refused binds:
0x80, SRVst4andt7. Each is a raw view (format 39, flags 1, stride 0) of 16 elements, so 64 bytes, against a minimum read of 128 bytes. The 64 bytes are the descriptor's own size, so the open point is the 128-byte minimum or which record these registers read.t6, table offset0xc0, minimum read 16 bytes.t3, table offset0x40, minimum read 8 bytes.None of this is in the scope of this PR; it is only what the path reaches next. The minimum-read check predates this PR (#3638); I'll look at it separately and link it here. If it helps, I can rerun with another trace option you name.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-02T14:47:06Z.
Review: COMMENTED
Re-reviewed
715b84f0after the provenance fix. Read the delta, not built here.Verdict: approve. The submitted-GPU-write case is now remembered even when linear tracking is off:
note_gpu_writerecords a resource with no tracked backing, adoption fails closed, and the provenance control verifies the GPU bytes survive the refused adoption. The overflow flag makes the failure conservative rather than unbounded.retireanderaseremove the untracked entry; the set is bounded to 65,536 resources;adoptchecks the untracked set before any title refresh; the normal tracked path is unchanged; the new fixture seeds a copy while tracking is off, resolves the first material view (refused) and reads the desktop bytes back.E_INVALIDARGfor a GPU-provenance conflict. A dedicated HRESULT or a named reason-flag would make the diagnostic distinguish "not supported" from "refused because the GPU owns the bytes"; the current text does distinguish it.The PR remains
DIRTYagainst main; rebase before merge.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T19:05:20Z.
Review: APPROVED
Re-reviewed
459fe3aa. Existing GPU writes are tracked before a backing is adopted, and the provenance case verifies that a pre-existing GPU write survives refusal of adoption. The newmesh86_materialuse keeps the truncation, provenance checks and adoption out of the Mesh57 caller. Independent MSVC Debugctest --preset dev --no-tests=error -V -j 1 -R '^startup_mesh86_material_backing_'passed 6/6 on Windows 11 build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the fixture's debug layer off. This includes the two stale-refresh mutation checks and the two provenance checks. #3810 overlaps this code, so please carry any distinct fixture coverage there as a follow-up.