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).
fuzeofficlal
left a comment
There was a problem hiding this comment.
The pass-level feeder graph (feeds.rs), FAN_IN_MAX/HURRY_MAX bounds, lock-free warm fast path, and first-pipelines.txt persistence are cleanly designed and well-tested (all 62 feeds/shown/pipeline/draw tests and strict clippy checks pass on both RTX 5090 and WARP with VICTORY_D3D12_DEBUG=1).
However, auditing the new hooks turned up one live crash bug and two graph-tracking bugs that should be fixed before merge:
1. Blocking: State::not_made dereferences unchecked descriptor table pointers without self.heap_of (crates/victory-gpu/src/draw.rs:628-633)
for u in uavs {
if let Some(&Root::Table(table)) = self.roots_ref(compute).get(usize::from(u.slot))
&& let Some(View::Unordered(resource, _, _)) =
crate::descriptor::view(table + u64::from(u.table_offset_dwords) * 4)
{
writes.push(resource);
}
}Unlike State::table_entry (draw.rs:1236) and State::tables (draw.rs:1270, 1297), which always verify self.heap_of(handle) before reading title descriptor memory, State::not_made computes table + u64::from(u.table_offset_dwords) * 4 directly and passes it to descriptor::view(handle). Inside descriptor::view (descriptor.rs:558-563), any non-zero handle is immediately dereferenced via (handle as *const [u32; 3]).read_unaligned().
If a title binds a null root table (Root::Table(0)), has no bound view heap, or leaves a stale root table handle from an earlier released/unmapped heap, and u.table_offset_dwords > 0, table + offset produces a non-zero invalid address (e.g. 0x20) and immediately crashes with an access violation. (Unchecked table + offset can also overflow u64.)
- Reproduced live on Windows: calling
state.not_made(true)on a pending compute pipeline (being_made == true) with one table UAV attable_offset_dwords = 8andstate.set_table(true, 0, 0)crashed the child process with0xC0000005(STATUS_ACCESS_VIOLATION). - Fix: validate with
checked_addandself.heap_of(handle):if let Some(&Root::Table(table)) = self.roots_ref(compute).get(usize::from(u.slot)) && let Some(handle) = table.checked_add(u64::from(u.table_offset_dwords) * 4) && self.heap_of(handle).is_some() && let Some(View::Unordered(resource, _, _)) = crate::descriptor::view(handle) && resource != 0 { writes.push(resource); }
2. Null SRVs / UAVs (resource == 0) create a phantom hub node in feeds::Graph (crates/victory-gpu/src/draw.rs:632, 1928-1936, crates/victory-gpu/src/feeds.rs:81-105, 166-195)
descriptor::create_srv(NULL, ...) and create_uav(NULL, ...) record View::Shader(0, _) and View::Unordered(0, _, _). While feeds::ran and not_made carefully skip depth == 0, neither readable, not_made, nor feeds filters out resource == 0 (nor 0 in targets/writes).
Because Graph::ran[0] has no FAN_IN_MAX cap, any pass feeding a presented image that binds a null SRV (0) walks through Graph::ran[0] into every unrelated ran pass that bound a null UAV (0), pulling unrelated dropped pipelines into the priority queue.
- Reproduced in
feeds::tests:g.dropped(99, || "unrelated_dropped", &[unrelated_tex]); g.ran(&[unrelated_tex], &[0]); g.ran(&[0], &[image]);returnsfeeders = ["unrelated_dropped"]. - Fix: ignore
0resources infeeds::view,feeds::ran(targets), andfeeds::dropped(writes) (or insideGraph::ran/Graph::dropped).
3. Graph::ran bypasses NOTES_MAX when writes.is_empty() (crates/victory-gpu/src/feeds.rs:81-91)
When a pass runs with writes.is_empty() (e.g., a bindless/root-view-only compute dispatch), its index is never inserted into self.ran, so self.reads.push(...) stores an unreachable entry; when reads.is_empty() as well, self.notes += 0 never increments, letting self.reads grow past NOTES_MAX unboundedly if presenting pauses while pipelines are queued (10_000 calls -> notes = 0, reads.len() = 10_000).
- Fix: early-return in
Graph::ranwithif writes.is_empty() || self.notes >= NOTES_MAX { return; }(mirroringGraph::droppedat line 96).
Review of Marvisak#3378 (fuzeofficlal): three bugs in the hooks that note what a frame's passes read and write. State::not_made read a table UAV with `table + offset * 4` computed directly and handed to crate::descriptor::view, unlike table_entry and tables, which check self.heap_of first: a title binding a null root table (Root::Table(0)) with a non-zero table offset dereferenced a bogus address and crashed the child with 0xC0000005. The handle is now a checked_add that a bound heap must hold, so a null, stale or out-of-heap table names nothing. A null descriptor names nothing either. A null view (resource 0) made a phantom hub: a pass that bound a null SRV joined every pass that bound a null UAV, so an unrelated dropped pass whose writes nothing presented reads was pulled to the head of the queue. `feeds` now ignores 0 in reads, writes and targets, at the pass and in the graph. Graph::ran noted a pass that wrote nothing, which no walk can reach: its reads grew past NOTES_MAX while notes stayed put (10,000 writeless passes, notes 0), for a title that stops presenting while pipelines are queued. It now returns at once, as Graph::dropped did, and excludes null descriptors from its counts.
|
@fuzeofficlal thank you for the audit and the live repro; all three are fixed in
Tested under Wine (CPU-only): AI-assisted (Claude); no game data shared. |
fuzeofficlal
left a comment
There was a problem hiding this comment.
All three issues from the previous review are cleanly resolved in d6c32b03:
State::would_write(crates/victory-gpu/src/draw.rs:634-667) now validates descriptor table handles withtable.checked_add(u64::from(u.table_offset_dwords) * 4)andself.heap_of(handle).is_some()before callingdescriptor::view(handle), and filters out null targets (0) and null UAV resources (resource == 0), backed bydraw::tests::a_dropped_pass_reads_no_descriptor_it_cannot_name(draw.rs:2126).feeds::view(crates/victory-gpu/src/feeds.rs:176),Graph::ran(feeds.rs:87), andGraph::dropped(feeds.rs:105) consistently ignoreresource == 0in reads, writes, and targets, backed byfeeds::tests::a_null_view_feeds_nothing(feeds.rs:321).Graph::ran(feeds.rs:88) early-returns when a pass has no non-null writes and only counts retained entries towardNOTES_MAX, backed byfeeds::tests::a_pass_that_wrote_nothing_is_not_noted(feeds.rs:336).
Verification on origin/main (63bcca43):
cargo xtask policy: ok (193 files ok)cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics): cleancargo test --locked -p victory-gpu --features diagnostics -- feeds:: shown:: pipeline:: draw:: --test-threads=1withVICTORY_D3D12_DEBUG=1: 65/65 passed on RTX 5090 and 65/65 passed on WARP- Re-ran the prior crash/null-hub/
NOTES_MAXprobes (Root::Table(0)+ 8-dword offset,u64::MAX - 16overflow, null target filtering, and 10,000 empty/null-write passes): all passed cleanly.
|
I ran a two-frame Windows CPU probe on head
The probe uses synthetic pipeline identities and covers scheduling without GPU execution. AI-assisted with Codex. |
|
@passerbyyhx thank you, that's a valuable check. It goes through the real present-time path and a paused worker, which my unit tests don't. Head promoting 8 feeders nearest-first per frame, keeping the ordinary FIFO order, and claiming every item once, while the parent lets resource 0 promote an unrelated candidate: that's exactly the null-resource hub fixed in If you'd like, I can add your fixture ( AI-assisted (Claude); no game data shared. |
|
Verified
This uses our disclosed diagnostic relaxed-vtable vkd3d build Coverage gap relevant to our black-scene investigation: our title path calls the native FidelityFX provider through Suggested owner extension: a bounded, success-only external-pass attribution API. Capture original title resource identities before the FFX copy is rewritten to host COM pointers; on native For local integration I will preserve #3025's compute cap and the published #2223 registration-order fix from Our separate mixed-stack evidence is linked in #841:183/184 HDR-targeting keys observed available after selective prewarm, but two end-of-frame HDR snapshots still zero and the actual170s client black. At-dispatch input versus later overwrite remains unmeasured; screenshots/assets stay local. |
|
@pickles976 thanks for the independent run on a 4060 under Wine, and for the coverage note. You're right that The extension you describe (success-only, title identities captured before the bridge rewrites them to host pointers, inputs 0..5 → output 6, nothing on a refused/failed call) fits the graph as it is. I'd rather keep this PR to what I can measure, but I'm glad to do it as a follow-up on top of #3378 with CPU tests for the edge cases you list (failure, null slot, aliased input/output), if someone with the native FidelityFX path can run the end-to-end check. AI-assisted (Claude); no game data shared. |
|
Follow-up on the actual Wine/RTX 4060 Laptop title path: I integrated owner #3378 The native FFX bridge is outside ordinary State draw/dispatch tracking. I added a local success-only external-pass edge using the original title resource identities, recorded only after native dispatch and bridge output write are recorded. Failed dispatches create no edge. I used Focused Windows-target Wine checks: scheduler10/10, feeder graph10/10 (including the new native edge), shown6/6, pipeline library13/13, builder2/2, actual placed-UAV GPU readback1/1, actual native FFX direct-FP16/RGB9E5 bridge1/1: 43 checks passed, not the full suite. Important fixture caveat: the first placed-UAV test returned zero pixels because its default emitter had Fresh diagnostics release43.37s, same128-key selected early-start list, reported1920x1080/window1280x720, copy-only file-backed title memory, unchanged9GiB/512MiB scope and6000MiB GPU/2048MiB available-RAM/10GiB disk guards. The180s run time-stopped, exit137; no resource stop, no kernel entries during the interval. MaxGPU5025MiB, minimum availableRAM4498.8MiB, maxscope8504.8MiB, minimum availabledisk11.075GiB. Wine11/NVIDIA590.48.1, diagnostic-relaxed vkd3d Observed: loading illustration45s, dark transition90s, black window120/150/170s. The scheduler logged both direct-image and feeder promotions. Native FFX original resource IDs were logged; immediately-before input and immediately-after output at accepted dispatches1 and8 were raw RGB allzero, nonfinite0. Thus these samples remain black upstream of the native upscaler. New exact status: an HDR-target graphics writer key The separate all-or-none BVH gate reports53 pipelines,51 made,2 refused,0 dropped. New named refusal diagnostics establish the two members: Local evidence: Next useful check: follow the exact queued HDR writer’s input/view identities through the dependency graph, and separately verify an owner translation correction for the two named BVH members. I will not repeat this unchanged180s trial or treat pipeline availability alone as rendered-world proof. |
|
@pickles976 one data point on the two BVH members, in case it helps separate that blocker: on my RTX 5090 stack both translate and get a host pipeline in the current best build ( Thanks for adding the external-pass edge and the all-zero samples before and after the native upscaler: that puts the black upstream of FFX, as you say. AI-assisted (Claude); measured on my machine, no game data shared. |
|
Follow-up with a bounded, diagnostic-only trace on the same mixed Linux/Wine11 + RTX 4060 Laptop 8 GiB / 16 GiB system-RAM stack (not an exact-head #3378 verdict): fresh 31.59 s release, 128 early keys, unchanged resource guards, 180 s title ceiling. Loading at 45 s, black at 120/150/170 s; no recognizable scene. Native FFX calls 1 and 8 read back RGB exactly zero on both input and output. At the last frame 914 pipelines were still being made, so this is not a fully compiled scene verdict. Concrete feeder-policy observation: the watched graphics key Important limit: the diagnostic walk hit its independent 256-pass/edge cap. This establishes an excluded depth route, not exclusion through every colour route or proof this policy causes the black screen. An earlier run had the watched key ready and still black. No fan-in limit was raised or shader refusal bypassed. Additional attribution: all six terminally refused compute programs sampled UAV buffers, not HDR textures. Offline effect metadata identifies four as InstanceCulling prop/tree passes and two as VFX relocation passes. Buffer-to-geometry/indirect-consumer causality is not yet established; exact-program owner-fix verification is next. Local evidence: |
A resource with more than FAN_IN_MAX dropped writers was not followed to them, so a target a frame dropped 81 draws into stayed out of the walk even once most of those pipelines had been made: the cap counted drops the frame could no longer hurry. The cap now counts the writers whose pipelines have no answer yet (not made, not refused), and the walk takes only those: made (or refused) writers leave the resource as it is, and the few still pending leave it stale and go first. Many pending writers still skip the resource, as the 666-pipeline round requires: pending draws into depth or a geometry buffer are what the cap is for. `pipeline::pending` asks `make::being_made`; `Graph::feeding` is given the predicate (the tests' graphs have no pipelines). Added tests: 81 recorded writers with 78 made give the three pending ones; refused writers neither fill the cap nor are taken; the many-pending case still gives none.
|
@pickles976 You're right, the cap was counting drops rather than writers that could still be hurried: 81 recorded drops stayed 81 after 78 of those pipelines had been made, so the resource was skipped with only three writers left that could still leave it stale.
Tests are CPU-only under wine on the Windows target ( I can't verify your black scene here — that needs a run of the title with your build — so this is only checked at the walk's bookkeeping level. If you can re-run the scene with the branch and the AI-assisted (Claude); no game data shared. |
|
@neonbyte1 Yes, please take the two-frame worker fixture with the original commit author. Thank you for offering. I also applied it unchanged to The worker gate is process-wide, so the fixture is marked ignored and runs as a standalone test: cargo test --locked -p victory-gpu --lib pipeline::make::two_frame_probe::presents_promote_at_most_eight_available_feeders_nearest_first -- --ignored --exact --test-threads=1This fixture exercises the per-frame promotion cap. Your separate pending-writer fan-in test covers the change in the latest commit. AI-assisted with Codex. |
|
@passerbyyhx thank you, taken unchanged as One small follow-up of mine on top, Run here under Wine (CPU only, display-less) on the RTX 5090 machine: AI-assisted (Claude); no game data shared. |
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.