Repository navigation
startup: log the sampled presented colour when it changes - #3490
Merged
Merged
Conversation
lukaslw-lab
approved these changes
Nov 30, 2026
lukaslw-lab
left a comment
Contributor
There was a problem hiding this comment.
Reviewed 7684a835 by reading the diff; not built or run.
Verdict: approve. The colour log does what the body says and adds no GPU work. One SHOULD, which can follow later. No MUST.
- SHOULD: the line is logged on any exact RGBA change (
d3d12_xs_device.cpp:2155). On a title's moving picture, the centre texel differs at almost every sample, so the default mode logs about one line per 60 presents all run. The fill-to-black change from #3477 then sits among lines that carry no signal. A small per-channel tolerance would keep it to real changes, as the luma signature does with its 12-level threshold. Uniform clears in the test cannot show this. - Both sources sample the same texel: the sampler copies full-width rows (
present_signature_sampler.h:129), andread_back_presentedcopies the whole surface and returns early for formats other than 8-bit RGBA/BGRA (:2218). Both usesampled_row(cells_y / 2, Height)atWidth / 2. frame % 60 == 0is always a readback frame (readback every 6 or 60 presents,:7815).X2W_PRESENT_SIGNATURE_EVERY=0returns before anything runs. When it is set to n, the fallback is disabled.- Red producer: making
capture_centeralways true is inert there. TheR8G8B8A8_UNORMgate stays,sampled_rgbareturns the raw bytes forrgba8, and the test asserts nox2w-red sampleline. - Locks: the readback or signature mutex is taken first, then the colour mutex, never the reverse.
Tests: startup_present_colour_warp covers the signature path (BGRA8), the readback fallback (RGBA8) and the off switch, and both mutations fail it. CI did not run it: the pr preset's include list (CMakePresets.json:51) has neither it nor startup_present_producer_*, and /O2 was skipped on the PR. The body's local run is the only one at this head.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #3477 (item 5).
Default change: in render mode with
X2W_PRESENT_SIGNATURE_EVERYunset, the log now gets onex2w-present sampled colourline for the first sample and one per colour change.X2W_PRESENT_SIGNATURE_EVERY=0turns it off.Why
In one long local run of the application the picture went from a uniform fill to black, and no log line says so. The sampled RGBA was logged only under the red-producer diagnostic.
What changes
X2W_PRESENT_SIGNATURE_EVERY=<n>or a script picture wait), the colour comes from the signature sample.X2W_PRESENT_SIGNATURE_EVERY=<n>the bound is one line per sample.X2W_PRESENT_COMPOSITE=1) never log.published && red_producers().enabled() && last_format == R8G8B8A8_UNORM), and it gets the same four bytes as before for that format.Samplernow sets the last-sample fields only whenMapsucceeds and returns a pointer; a failedMappublishes nothing, as before.present_signatureis serialised by a mutex. Lock order is always the outer lock (signature mutex or the readback's), then the colour-log mutex.docs/startup-runtime.mddescribes the line.Tests
New
startup_present_colour_warp(tests/cmake/startup_present_colour.cmake), drivingstartup_present_producerthrough uniform clears:X2W_PRESENT_SIGNATURE_EVERYcolour(BGRA8)1colour-readback(RGBA8)colour-readback09 passed, 2 skipped, on
7684a835(base26df1826),X2W_WITH_OPUS=OFF. The two skips arestartup_present_signature_held_source_warpandstartup_present_signature_unheld_source_control_warp("SKIP: no D3D12 debug layer"); they were not run.Mutations, each rebuilt and run against
startup_present_colour_warp:Not covered
Merges cleanly with #3480 and #3482 (
git merge-tree --write-tree).