startup: draw a pipeline without depth state without the bound depth view #3818
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3818"
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 Leyukaka on 2026-12-02T02:52:23Z.
Problem
Since #3535, a translated pipeline that carries no depth-stencil state (no stream
DEPTH_STENCILsubobject and no decoded registers) declaresDSVFormat = DXGI_FORMAT_UNKNOWN. Declaring the bound view's format there is debug-layer message 1477, so that part is correct and stays.The guest's depth view, however, stays bound on the desktop command list while such a pipeline draws. D3D12 compares the bound DSV with the pipeline's
DSVFormatwhen the draw is issued, and the mismatch is message 615:The result of that draw is undefined: it can be accepted and still leave its render targets unchanged.
Change
For those draws only,
draw_translatedrecords the draw with the same render targets and no depth view, then restores the guest's bind right after the draw, so later draws see the depth view again.depth_target_unbindapplies when a depth view is bound, the bind has at least one render target, andpipeline_fordeclaresDXGI_FORMAT_UNKNOWNfor the pipeline. It uses the same condition aspipeline_for, so the two cannot disagree.Passnow keeps the desktop descriptor handles of the last accepted bind (desktop_targets,desktop_depth), filled inlist_targets, so the draw can bind the same targets again.The render target formats already come from the bound views, so they cannot mismatch in the same way.
Refs #3535.
Validation
Windows, MSVC.
startup_stream_depthgains two cases. The fixture runs with the D3D12 debug layer on and rejects messages of severity 0 to 2, so message 615 fails it.drawn without the bound depth view.startup_stream_depth_warpandstartup_stream_depth_hardwarepass, on WARP and on a physical adapter.A 300 s run of a guest application on this branch showed no device loss. The new log line appeared 8 times, which is its limit (it is written for the first 8 such draws only), so the path is exercised in a real run and the count is a lower bound. The frame rate was unchanged, at about 12 fps.
On this exact head, with MSVC: startup_stream_depth, startup_frame_copy and startup_packed_target_draw pass on WARP and on hardware. The full suite will run in
Build and test on Windows.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T03:05:06Z.
There is a descriptor lifetime gap in the new unbind/rebind path.
OMSetRenderTargetsconsumes CPU RTV/DSV descriptors when recorded; an application can reuse those slots before its next draw.Pass::desktop_targetsanddesktop_depthretain only the handles, so the later calls can load overwritten views while the pass still tracks the original resources and formats. Please preserve the original accepted views (or use recording-owned descriptor copies) and test rewriting both a bound RTV slot and the DSV slot after OMSetRenderTargets, before the no-depth draw and the subsequent depth-tested draw.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T15:41:18Z.
Review: CHANGES_REQUESTED
list_targetssaves raw RTV and DSV CPU handles, then the translated draw dereferences them in both extra OM binds. D3D12 consumes those descriptors during the originalOMSetRenderTargetscall, so their slots can be overwritten or their heap released immediately afterwards (Microsoft descriptor lifetime documentation). If a guest binds RTV A, overwrites that CPU slot with RTV B, and draws without another OM bind, the translated path binds B whilepass.bound_targetsand tracked resource states still describe A. The same applies to the restored DSV. Please use bind-time descriptor snapshots with a lifetime that covers the extra binds, and add a regression that overwrites the original slot after binding and verifies the original target and depth view are still used.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T17:48:56Z.
Thanks, fixed in
45b45bd4f.list_targetsnow copies the bound RTVs and DSV into list-owned CPU-only heaps at bind time, and both extra binds use those copies.startup_stream_depthgains a case that overwrites both slots after the bind; it passes on WARP and hardware.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T18:05:01Z.
Review: APPROVED
Re-reviewed
45b45bd4. The list copies both descriptors at the original bind, and the extra draws read the list-owned views. The new case overwrites both guest slots with decoys before any draw and still reads back the original target with the original depth result. Independent Windows 11 build 26300/MSVC Debugctest --preset dev --no-tests=error -j 1 -R '^startup_stream_depth'passed 2/2 on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, debug layer enabled.