startup: census of direct draws not drawn and of clears #3482
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3482"
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-11-29T17:20:47Z.
Refs #3477 (items 1 and 3; items 2 and 4 are in #3480).
Counting and logging only. Every early return in
draw_translatedreturns the same value, the translated and untranslated counters move as before, and the clear calls are forwarded or refused exactly as before.Direct draws not drawn, per (pipeline key, reason) (item 1)
note_draw_refusalreturned at once unlessX2W_PIPELINE_COLOURwas on, so a direct draw that drew nothing left no key and no reason. It now always records the key and a fixed reason code; the prose text is still written only with the switch on.count_direct_drawreplaces the two identical counting blocks indraw_startup_directandlist_draw_indexed. For a draw that was not drawn it notes (key, code) in a thirdPerReasonRefusalCensus,direct-draw. When the refusal carries no key, the key of the bound pipeline is used if it is known.Reason codes:
no_recording_list,no_pipeline_bound,render_targets_not_bound,topology_not_translated,pipeline_not_decoded,no_target_translation,manifest_absent,manifest_refused,native_graphics_refused,d16_view_not_ready,formatted_buffer_not_ready,fixed_vertex_stream_refused,pipeline_state_unavailable,sampler_heap_unavailable,raw_uav_shape_unsupported,resource_binding_refused.PerReasonRefusalCensus::notetakes an optional frame number, stored on insertion only.first_seen_frameis printed only when a frame was given, so the two indirect census lines are unchanged.Clear census (item 3)
clear_census.haddsClearCensus, a table of 128 distinct clear shapes with a call count each. The key is:rtv,dsv,uav_uint,uav_float;A clear is noted only after the desktop
Clear*call, so refused clears (null target, no flags, read-only view, unreadable rectangles or values) are not in it. Once the table is full, a new shape adds tooverflow callsand to the total only.Both censuses are mutex-guarded and are printed with the other censuses: changed entries in the five-second report, everything in
x2w_d3d12_census_report.frame_numberis now written withInterlockedExchangeand read withInterlockedCompareExchange. The first-4 log inlist_clear_targetis untouched.Tests
Base
c4b8a41b, presetdev:startup_clear_uav_warp(extended: total, shape count, theuav_uintanduav_floatlines with their value words),startup_per_reason_refusal_census.SKIP: no debug layer message callback):startup_draw_clear_census_warp(new,startup_clear_depth_stencil warp census) andstartup_clear_depth_stencil_warp. The D3D12 debug layer is not installed on the machine used.Mutations, each rebuilt and run:
uav_floatclears not notedstartup_clear_uav_warpstartup_clear_uav_warpMerges cleanly with #3480 and #3481 (
git merge-tree).Not covered
The new assertions for the draw census, the RTV and DSV clears, the overflow count and
first_seen_framewere not run. They are all in thecensusbranch ofstartup_clear_depth_stencil.cpp, which skipped here. Could a reviewer with the debug layer run:No mutation was run against that branch for the same reason: the
X2W_PIPELINE_COLOURguard, a census bypass at either draw entry, afirst_seen_frameoverwrite, the value words left out of the key comparison, the overflow increment.Only direct draws are counted here; the indirect paths keep their own censuses.
The reason given to draws refused after pipeline creation (views, buffer copies, index data, default scissor) is still the single
resource_binding_refused.Imported from R0Y00/Xbox2Windows. Originally posted by Alexofbulgaria on 2026-11-30T05:21:09Z.
Both requested WARP tests passed
I ran the stock tests at clean PR head
2215b108c9c394b9f034ef6b3c061911b0ce3c68using thedevpreset, MSVC 19.44.35230 and Windows SDK 10.0.26100.0 on Windows build26300.10075.10.0.26100.10068startup_draw_clear_census_warp,startup_clear_depth_stencil_warp,startup_clear_uav_warp8086:56a0, driver32.0.101.9175startup_clear_depth_stencil_hardware,startup_clear_uav_hardwarestartup_per_reason_refusal_censusThe WARP depth/stencil and census tests went past the debug-message callback check. The census assertions covered the refusal count and first-seen frame, RTV/DSV clear shape counts, and 134 calls across 128 retained shapes with one overflow call. All five D3D12 runs recorded zero debug-layer errors and device removal reason
0x00000000. Zero skips. AI assisted with setup and reporting. The runs executed locally.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T06:52:04Z.
Review: APPROVED
Reviewed
2215b108by reading the diff; not built or run. For scale, our native-only run on main44a3ad5a+ #3506 #3516 #3464 #3521 #3097 (without this PR): 180 s, 3,499 frames,not drawn 143113,clears 41981.Verdict: approve. Acceptance is unchanged, and the census names exactly what we had to find by hand. Our stale-layer pass in #3560 (key
05dc00b8b79c1d4b, refused natively) would show here asnative_graphics_refusedwith its key on every frame. No MUST.per_reason_refusal_census.h:44says the scan "is the keyed sample, not the per-draw path".count_direct_draw(d3d12_draw.inl:3801-3809) now callsnote()on every undrawn direct draw: about 41 per frame (800/s) in the run above, each a mutex plus a scan of up to 128 entries withstrcmp. The cost is small at that rate, but the comment now says the opposite of what happens. Please update it, or make clear that per-draw use is intended. When the refusal has no key,known_pipeline_keyalso takesdraw_lockshared for a non-real pipeline (:1255-1256), on a lock that is already contended in native runs.only_if_changed, every shape that recurs each frame is reprinted every five seconds: about 12 clears per frame here, plus each recurring (key, reason). In long runs that is the bulk of the five-second report.note_draw_refusalsite gets a code matching its prose, andcodeis reset at entry. Draws refused before any note getunknownfromcopy_sanitized.first_seen_frameis printed only when given, so the indirect lines are unchanged.Tests:
startup_clear_uav_warppins the UAV shapes and value words. Thecensusbranch ofstartup_clear_depth_stencilpins the draw (key, reason, frame), RTV/DSV and overflow lines. CI ran none of them (not in theprfilter); Alexofbulgaria's local run at this head passed.