Probe (diagnostic) build: capture and copy problems with lifetime-0 inputs
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- cpp
- Bereich
- computer-graphics, tooling
Rechercherichtung
Start in probe.cpp at the lifetime-0 tag handling (around lines 502-526) and in RrProbe::capture (around 1155-1175), then probe_gpu_d3d12.cpp where capture calls QueryInterface and GetDesc. The first fix is item A: skip lifetime-0 sources that were never copied and log "lifetime-0, not copied". Done means test_probe_dll on WARP passes with depth released before a capture evaluate, showing no crash and a skip line. Items B-D change the design of copies and need maintainer agreement first.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
This was found by reading the code. It has not been reproduced.
Release builds are not affected. Everything below is in the probe (diagnostic) build only (WG_RR_PROBE=1): probe.cpp and probe_gpu_d3d12.cpp are built only there. Item A also needs the capture option switched on. The release plugin does not contain this code. All paths are under clean/rr_f/proxy/src/.
What happens
A. Capture reads lifetime-0 inputs that were never copied.
The probe copies a lifetime-0 tag only for colour (type 3), normals (5) and normal-roughness (14) (probe.cpp:513-516). Every other lifetime-0 tag keeps the game's own pointer (probe.cpp:502). Capture collects every tagged type of the viewport, skips only outputs, and takes the resource with no lifetime check (probe.cpp:1155-1175). It then calls QueryInterface and GetDesc and records barriers and copies on that pointer (probe_gpu_d3d12.cpp:437, 452, 511-528, 644-649). If the game freed the resource after tagging, that is a call on a dead object (crash) or a capture of the wrong content.
- Reachable: a game that tags depth, motion, albedo and similar with lifetime 0 (some engines tag transient-pool targets this way) while a tester has capture on.
- Effect: a crash, or silently wrong captures.
B. Barriers and copies cover all subresources with one declared state.
transition() always uses D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES (probe_gpu_d3d12.cpp:132-139). copy_input accepts any single-sample 2D texture, keeps its mip and array count and uses CopyResource (probe_gpu_d3d12.cpp:365-417). Capture copies subresource 0 only but transitions the whole resource (probe_gpu_d3d12.cpp:511-528). This is wrong only for an input with more than one mip whose mips are in different states. The interface cannot express that (one state per tagged resource). RR inputs are almost always single-mip render targets. If all mips share the declared state, the code is valid.
- Effect: a debug-layer error, and possibly a wrong mip on real hardware.
C. Retired copy textures accumulate until a device change.
On a shape mismatch the old lifetime-0 copy goes to retired_ (probe_gpu_d3d12.cpp:382-388). retired_ is released only in reset(), called from the destructor and on device change (probe_gpu_d3d12.cpp:290, 301, 623-641). Finished capture readback buffers also go there (probe_gpu_d3d12.cpp:603-604). Growth is one texture per shape change, for at most the three copy keys. Dynamic resolution normally keeps a fixed texture with a changing extent, so it does not grow. Capture readbacks are bounded by the capture budget.
D. Lifetime-0 copies keyed only by buffer type alias across frames and viewports.
The copy key is the buffer type only (probe.cpp:526; probe_gpu_d3d12.cpp:377). probe.h:113-114 documents the copy as "valid until the next copy for key". Frame-scoped records (probe.cpp:567-572) and per-viewport records (probe.h:234) can hold the same copy pointer. This is harmful only if a second lifetime-0 copy of the same type is recorded before the evaluate of the first frame runs: for example tag frame B and then evaluate frame A on the same list, or two viewports with equal-size colour evaluated after both tags. The normal tag-then-evaluate order per frame is correct.
- Effect: the probe upscales or captures another frame's input. Wrong diagnostics, no crash.
When it can happen
Only when a tester runs the probe build. For players on the release build, none of this applies. For the capture tool, A can give wrong captures without any sign, so it matters before the next capture run on a new game. B, C and D need an atypical input or a particular call order.
To do
- A: in
RrProbe::capture, skip any source whose stored tag haslifetime == WG_LIFE_ONLY_DURING_TAGand was not copied. Log "lifetime-0, not copied". Track acopiedbool inStoredTag, or compareresource != res.native. Copying every lifetime-0 input when capture is on is the fuller fix, but costs VRAM and widens C and D. Captures of such games will lose those inputs (logged). - B: in
copy_inputand in capture, refuse and log inputs withMipLevels > 1 || DepthOrArraySize > 1. Or transition subresource 0 only and copy withCopyTextureRegioninto a one-mip texture. A refused input shows as missing in the probe. - C: record an evaluate counter with each retired texture and free entries older than a fixed number of evaluates, above the maximum frames in flight. A fence signalled after use is exact; a counter is heuristic and can free too early if it is not tied to GPU completion.
- D: key copies by (viewport id, buffer type, frame-scoped or viewport) and keep a small ring of copies per key, handed out round-robin and recycled once the consuming evaluate is past the frames in flight. This costs more VRAM per key. The ring size must exceed the pipelining depth.
Test
CPU-only.
- A:
test_probe_dll(WARP). Tag depth with lifetime 0, release the depth texture, run a capture evaluate. Assert no crash, a "not copied" skip line, and depth absent fromframe.json. - B:
test_probe_dllon WARP with the debug layer. Tag a 2-mip colour texture with mip 1 left in a different state. Assert no debug-layer error after the fix, or that the input is refused with a log line. - C:
test_probe_dllon WARP. Alternate two sizes many times and assert the retired count (add a test hook) stays bounded.test_probe_corewith the fake GPU is not enough, since it has no D3D12 objects. - D:
test_probe_corewith the fake GPU. Tag-for-frame colour (lifetime 0) for frames A and B, then evaluate A. Assert A's upscale source differs from B's copy.
- Vorherrschende Sprache
- C++
- Sterne
- 12
- Forks
- 2
- Ø Merge
- 3 Std. 10 Min.
- Gemergte PRs (30 T.)
- 171
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus phantoslayer21/wronggpu
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
phantoslayer21/wronggpu#275 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
phantoslayer21/wronggpu#274 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
phantoslayer21/wronggpu#241 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug build
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
phantoslayer21/wronggpu#234 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug build
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
phantoslayer21/wronggpu#233 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in phantoslayer21/wronggpu
Ähnliche Issues
-
ai_p2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
ClickHouse/ClickHouse#132519 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug]: VST3 getMidiControllerAssignment reads past midiControllerToParameter for program changeOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
juce-framework/JUCE#1810 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
petercorke/robotics-toolbox-python#952 ·
Maintainer antworten meist innerhalb von 1 Tag
-
NatronRenderer: a Python error in the script (-t / project script) doesn't change the exit statusOffenfunc:engine type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
NatronGitHub/Natron#1276 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 77/100
Maintainer antworten meist innerhalb von 1 Tag