Repository navigation
feat(d3d11): DXR_WEAVE_GPU_TIMING per-stage weave timing (2D-under-the-lens P0) - #302
Merged
Merged
Conversation
…e-lens P0) Under DXR_WEAVE_GPU_TIMING=1 (the runtime service's knob; alias DXR_LEIA_DP_WEAVE_TIMING=1), the D3D11 DP logs one WARN line every 5 s: - GPU time (non-blocking D3D11 timestamp queries, 8-slot ring, read back frames late) of the pre-weave pass (bg compose / chroma-key fill), the SR weave call (incl. the 2D-layer hand-off and SR's in-weave compose), and the post-weave alpha gate (has_overlay=2 subset counted) or chroma-key strip, separately; - CPU wall time of leiasr_d3d11_weave; - process_atlas counts (3D weave / 2D blit / not-ready), 2D layer offered / composed / declared-unchanged (v14), and the v15 filter strength (last/min/max) on composed frames. Off by default; state is allocated only when the knob is on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the CRT getenv On the panel box the plug-in's timing line never armed although the runtime's read of the same knob in the same service process did. Read it with GetEnvironmentVariableA, as env_present_opaque() already does, and log the off state once at INFO so a missing line is diagnosable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
P0 of the "near-zero-cost 2D under the lens" plan: instrumentation only, in the D3D11 DP (
leia_display_processor_d3d11.cpp). The runtime PR (DisplayXR/displayxr-runtime#1824) extends the service-sideDXR_WEAVE_GPU_TIMING=1diagnostic. Itsweavestage covers the wholeprocess_atlascall. This PR splits that stage inside the DP.Knob
The knob is
DXR_WEAVE_GPU_TIMING=1, the same one the runtime's D3D11 service reads. The DP runs in the service process, so one env var arms both lines.DXR_LEIA_DP_WEAVE_TIMING=1is accepted as a plug-in-only alias.Both are read with
std::getenvand cached, like the plug-in's other knobs. The default is off. When off, the only per-call cost is one cached-bool check; no state is allocated and nothing is logged.What is measured
GPU. Each 3D
process_atlasgets four D3D11 timestamps plus a disjoint query, on the caller's immediate context. They are read back non-blocking from an 8-slot ring, a few frames late. A set still in flight when the ring wraps is dropped, never waited on.pre_weavesr_weaveset_compose_filter_strength+set_compose_layer) +leiasr_d3d11_weave, i.e. the SR weave including SR's in-weave composealpha_gatehas_overlay=2when the layer was composited)with 2D layer=counts thehas_overlay=2subsetck_stripCPU.
sr_weave: wall time of theleiasr_d3d11_weavecall itself, via QPC.Per-window counts:
process_atlascalls: 3D weaves, 2D passthrough blits, and not-ready/absent flat blits;offered: the runtime calledset_overlay_2dwith a layer;composed: SR accepted it for this weave, i.e. compose was active;unchanged: offered and declared unchanged by the client (v14);<0= SR default);bg-compose: WGC compose-under frames.SR's own refilter count is already in the SR log, so it is not duplicated here.
How to read the log line
One WARN line per DP every 5 s, never per frame:
weavestage ≈ this line'spre_weave + sr_weave + alpha_gate/ck_strip, plus the DP's state-setting overhead.composedvsoffered: whencomposed < offered, SR refused the layer at weave time (it is also logged once as an error).unchanged/offeredis how often the client let SR reuse its prefilter. Compare it with SR's refilter count in the SR log.CPU sr_weaveandGPU sr_weavemeans SR's CPU-side work (predictor, state), not GPU work.Build
Built with
scripts\build-windows.bat buildfrom a worktree, against the local../displayxr-runtimeheaders (ABI 5): green (DisplayXR-LeiaSR.dlllinked and staged to_package/bin/plugins/). No runtime header changes are needed; this PR is independent of the runtime PR at compile time.Testing
Not panel-tested yet; the hub session runs the panel A/B. Deploy by rename-swapping the dev DLL into
C:\Program Files\DisplayXR\Plugins\LeiaSR\, then start the service withDXR_WEAVE_GPU_TIMING=1in its environment.🤖 Generated with Claude Code