Repository navigation
Conversation
…ot shown A draw whose pipeline is still being made is dropped and leaves its targets as they were. When it is the draw that writes a presented image (Grand Theft Auto VI's final upscale, PS_TAA2_SpatialUpscaleWithDithering), that back buffer still holds the frame drawn into it two presents ago, and the window alternates between two old frames. On a cold driver cache the world's first frame wants ~1,900 new pipelines; the upscale's was made 41 s after its first use, and frames 1300-1346 alternated black and dim. Such a draw now puts its pipeline at the head of the workers' queue (make::hurry), and a present of an image it left unwritten is not shown: the window keeps the last frame shown (crate::shown), for at most 10 s (HOLD_LIMIT). Past that the frames are shown as they come, and the log names the pipelines waited for, so a pipeline that never arrives (a dead worker, a hung driver compile) cannot freeze the window. Refused pipelines do not count at all. VICTORY_SHOW_UNWRITTEN=1 shows those frames as before.
…olds and counts nothing
…ine queue With Marvisak#3353 a dropped draw into the presented image holds the frame and puts its pipeline first. A dropped pass further back still leaves the image wrong: in Grand Theft Auto VI's world on a cold driver cache the final upscale was made at once, but the world stayed black for ~50 s until the compute pass resolving the lighting (CS_RaytracingResolve) was made: it waited 47 s in the queue behind ~1,900 pipelines first used in the same frame, and took 6 s once a worker had it. While pipelines are queued, each frame now notes what each pass that runs reads and writes (the views its code uses through tables, its targets) and what the dropped ones would have written: their targets, and the unordered views their code names through tables, read from the container's own resource records (no translation needed). At the present, a walk back from the presented images through the passes that ran finds the dropped passes whose writes they read, and the nearest eight go to the head of the workers' queue (crate::feeds). Once a hurried pass runs, a later frame's walk goes on behind it. The walk must not take the world's content: reads are kept per pass, not per pipeline (a blit used by many passes would join all their inputs), and a resource with more than four dropped writers (depth, a geometry buffer, filled by hundreds of draws) is not followed to them. Without these a round put 666 mesh pipelines first, pushed back 103 that the queue would have made within 15 s, and the world went dark again. The first 64 pipelines a run hurries are listed in first-pipelines.txt beside the early list; the next run starts them ahead of the other early starts, during loading.
|
CI note: the one failing test, AI-assisted (Claude); no game data shared. |
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on RTX 5090 (Windows / D3D12) against origin/main (63bcca4).
- Prioritizing dropped feeder passes whose outputs feed the presented image (nearest-first, cycle-safe, and capped) works cleanly alongside
shownand the pipeline worker queue. cargo test -p victory-gpu --lib feeds:: -- --test-threads=1: 7 passed, 0 failed.cargo test -p victory-gpu --lib shown:: -- --test-threads=1: all passed.cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1: all passed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 193 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Stacked on #3353 (
fix/hold-unwritten-frames,df15a809); only the last commit (dba19ba2) is new here.What is wrong
#3353 fixes the flicker while pipelines are still being made: a dropped draw into the presented image holds the frame and its pipeline goes to the head of the workers' queue. A dropped pass further back still leaves the image wrong, because the image is then written from stale inputs.
Grand Theft Auto VI's world on a cold driver cache (
__GL_SHADER_DISK_CACHE=0 VKD3D_SHADER_CACHE_PATH=0, RTX 5090, Wine + vkd3d-proton) first binds ~1,900 pipelines in one frame. With #3353, the final upscale is made at once. But the world then stays black (brightest probed pixel 0–1 of 255) until the compute pass that resolves the lighting (structure_lod_wetness:CS_RaytracingResolve) is made. That pass waited 47–54 s in the queue in three runs, and then took 5.8–6.1 s to build. The image turns bright on the first frame after both pipelines exist, while ~1,000–1,700 others are still queued.What changes
While pipelines are queued, each frame notes:
At the present, a walk goes back from the presented images through passes that ran. It finds the dropped passes whose writes those passes read, and the nearest ones go to the head of the workers' queue (
crate::feeds). Once a hurried pass runs, a later frame's walk goes on behind it.The walk must not take the world's content. A first version did: one round put 666 mesh pipelines first and pushed back 103 pipelines the queue would have made within 15 s (a TAA resolve, a tiled-lighting clear, decal and particle compute). The world went dark again for about a minute. Hence three limits:
FAN_IN_MAX). One or a few passes (a resolve, lighting) leave a resource stale; hundreds of draws into depth or a geometry buffer leave objects missing. The walk still goes through such targets' passes that ran.HURRY_MAX), nearest first. Only pipelines that can still be hurried count toward the 8: queued, not taken by a worker, not hurried before.The first 64 pipelines a run hurries (
FIRST_MAX) are listed infirst-pipelines.txt, besideearly-pipelines.txt. The next run starts them ahead of the other early starts, during loading.The code names no shader.
Measured
All runs below use the same cold-cache setup, one 480 s run each, and the same diag build family. "+s" is the time since the scene's first frame.
made firstroundsfirst-pipelines.txtLimits
Cost
When nothing is queued (a warm run, or once the queue drains):
OnceLock::get. Refused pipelines stop there. A container's resource records are parsed only for pipelines being made, once per container.mem::takeof an empty graph, which allocates nothing.While pipelines are queued:
NOTES_MAX).first-pipelines.txtis capped at 64 keys.Tests
CPU only, under Wine; they create no D3D12 device.
feeds::tests:the_dropped_passes_a_presented_image_reads_are_found_nearest_first(including the second round once the resolve runs)nearer_feeders_come_firstthe_image_s_own_writer_and_writeless_passesa_cycle_endsa_target_many_dropped_draws_write_is_not_followeda_shared_pipeline_s_passes_are_followed_apartnotes_are_cappedpipeline::library::tests:the_first_list_keeps_this_run_first_under_its_capa_run_lists_its_first_hurries_onlyshown,pipeline::makeand early-list tests: 20 passed.cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings, with and without--all-features: clean.Related
make.rs: a pipeline is marked queued before it is counted as waiting, so a promotion in between can let a worker make it before the count.make::hurry(from GPU: a frame whose presented image a dropped draw left unwritten is not shown #3353, used here too) is another promotion through the same window. @andrewpozdnakov7-jpg's combined commit335eb7b(GPU: account for pending pipelines before promotion #2223 + GPU: a frame whose presented image a dropped draw left unwritten is not shown #3353 + GPU: graphics pipelines are made before compute ones, and compute never takes every worker #3025) waits for completed registration on both paths; whichever lands second needs a small rebase inmake.rs.AI-assisted (Claude); measured on my machine, no game data shared.