Skip to content

perf(agc): suppress redundant graphics pipeline and dynamic state commands - #16752

Merged
oneandonlydean merged 15 commits into
boykopovar:mainfrom
chitters2004:perf/agc-state-suppression-m2
Nov 14, 2026
Merged

oneandonlydean merged 15 commits into
boykopovar:mainfrom
chitters2004:perf/agc-state-suppression-m2

Conversation

@chitters2004

Copy link
Copy Markdown
Contributor

What

Every recorded graphics draw binds its pipeline and records every dynamic state command it uses, even when its command buffer already holds that pipeline and those values. In the GTA V (PPSA04263) standing scene measured below, main issues 18.6 dynamic state commands and 0.98 graphics pipeline binds per draw.

Each recorder batch now owns a CommandState (Recorder::GraphicsState()) that remembers the graphics pipeline bound in its command buffer and the value of each of the 19 dynamic state slots the draw path sets (viewport, scissor, depth bias, depth bounds, cull mode, front face, depth test, write and compare, depth bounds test, stencil test, and per face the stencil op, compare mask, write mask and reference). A bind or setter whose value the command buffer already holds is skipped.

  • Pipeline::Begin, Continue, the back-face and second-channel binds, the stencil replay reference, the sample order depth reorder and the first-sample copy in Recorder::RecordUncounted record through the batch's CommandState, so the draw after one of those passes records only what differs.
  • Nothing is known after vkBeginCommandBuffer, and a pipeline bind forgets every slot the new pipeline fixes statically. The state belongs to the batch, so a recycled command buffer handle and a batch reopened after a failed submit start with nothing known.
  • Context::Function, Context::Resolved and the device setup lookup take a consteval FunctionName that rejects a graphics pipeline bind, a tracked dynamic state command, vkCmdBindShadersEXT or vkCmdExecuteCommands at compile time. The device table holds those entry points as write-only TrackedFunction members that only CommandState and the new Context::BindComputePipeline read. Presentation, the performance overlay and tests, which record their own command buffers, use a local untracked CommandState. CommandState cannot be copied or moved.
  • Two routes stay open because the type system cannot see them, recorded in docs/dev/debt/libSceAgcDriver.md: a raw deviceProc lookup cast to the function type, and a second CommandState begun on a recorder batch's command buffer.
  • APS5_NO_STATE_SUPPRESSION records every bind and setter, as before (docs/dev/ENVIRONMENT.md).

Overlap, checked on 2026-11-07 against main 46552cb461 with tools/pr_overlap.py and by hand: the tool reports 13 open pull requests that change lines this branch changes and 98 more that conflict with main and share files with it (78 of the 111 have a commit since 2026-10-24; I read the hunks of 29 of them). None implements the same thing. #9503, #10351, #11551, #12840 and #12944 change the same functions (SampleOrders::Depth, recordPreparedDraw, recordStencilReplay, pushDrawConstants, VulkanDevice::recordDispatch), so whichever lands second needs a manual rebase; the others share only test, debt or ENVIRONMENT.md lines in other hunks. #10049, #12863, #15670, #15845 and #16286 are disjoint. Rechecked against 4977f64052: the tool now confirms #9503, #9712, #9897, #10141, #10351, #12944, #14032, #15570, #16373 and #16572. #16572 (set color write masks per draw through dynamic state) adds a dynamic state that this change's tracker must own: with this change, recording vkCmdSetColorWriteMaskEXT outside the tracker does not compile. If #16572 lands first, a rebase of this branch onto it that tracks the masks like the other dynamic states is ready (fork branch draft/src/refresh/r1-on-16572); it suppresses an identical mask set and records a changed or wider one, with a unit test that a mutant ignoring mask values turns red.

Open pull requests that record a graphics pipeline bind or a tracked dynamic state command must go through CommandState (or Context::BindComputePipeline for a compute bind) once both are in main, because a direct call through Context::Function or Context::Resolved no longer compiles; none is a prerequisite, so Depends on is none:

Tested

Head 1781488bcb on main 4977f64052.

Refreshed onto main 4977f64052. Head 1781488bcb; git range-diff against b0fe73c6dd shows the same code patches in all 8 commits; only the debt entry of commits 3 to 6 and 8 changed context, because main added two entries above it. Local RTX 3080 gate on both, same environment as below (ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation), built one after the other in one build tree, with the focused AGC set of all five pull requests of this series (242 tests on this head, 232 on main): both 100 % passed, no VUID- line in either log or in replay subprocess logs, and neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS. Fork CI on the rebased head against 4977f64052: run 42375092958: Linux 46 of 53 passed, 7 skipped; Windows 45 of 55 passed, 9 skipped, and agc_driver_recorder failed, as it does on main. The skips include the new agc_driver_pipeline_optimized_readback_color32_unsuppressed and _color64_unsuppressed, skipped on lavapipe like their existing forms; the RTX 3080 gate runs and passes them. No VUID- line on either side, conventions check passed. The measurements and full runs below were on the previous base 46552cb461; the code they measured is unchanged.

Vulkan validation. RTX 3080, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest --test-dir build -R 'agc|write_tracking|guest|indirect_draw|draw_finisher|depth_bias|draw_pipeline' -V on b0fe73c6dd (3209 tests) and on main 46552cb461 (3199 tests). Every test failing in either full run was then rerun alone on both builds, one build at a time with nothing else on the GPU, using ctest -R with the union of the 16 names and the same environment: on both, 15 of 16 passed and only agc_driver_direct_write_completion failed, which fails on main too (#15547); the other failures of the full runs were timeouts and 0xc0000409 exits under load from concurrent gates and did not reproduce alone. Both full logs hold the same 18 VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 lines and no other VUID-; neither contains was not found but was requested by env var VK_INSTANCE_LAYERS. The change adds no validation error.

Fork CI (GitHub runners, Mesa lavapipe with the Khronos validation layer, head against main): run 42329061255, rebased there onto 46552cb461. Linux and Windows each ran 39 tests: 31 passed, 0 failed, 8 skipped, no VUID- line on either side, conventions check passed. The eight skips are the same on main except for the two new _unsuppressed color readback variants, and all have the same lavapipe reasons: the masked pixel shader needs at least 32 subgroup lanes (the four color32/color64 readback tests and their two new variants), and the device has no 2x color and depth targets (two sample order tests); the RTX 3080 gate above runs them.

Tests.

  • agc_command_state drives the tracker through real objects: a pipeline bind, every tracked dynamic state, a D16 stencil target stored as D24 that caches and emits the converted depth bias for both faces with and without graphics pipeline libraries, Pipeline::Continue swapping from the fast-linked to the optimized handle within one tracker and suppressing afterwards, DynamicSlots rejecting a dynamic state the tracker does not follow, and a second render pass of a batch that records nothing for an identical draw.
  • agc_graphics_state_recorder (and _unsuppressed): a real Recorder reopened over a reused command buffer handle, and a batch reopened on a recycled handle after a failed submit, record the pipeline bind and every setter again; two interleaved recorders never suppress each other; a draw after RecordUncounted, also when it throws, or after RecordSampleOrder records only what differs.
  • agc_driver_depth_bias_per_face checks the recorded per-face pixels; recorded per-face draws set the viewport and scissor once and the synchronous path twice. The optimized readback, stencil replay and per-face depth bias tests also run with APS5_NO_STATE_SUPPRESSION (_unsuppressed) and the per-face test with APS5_DRAW_TRANSITIONS (_transitions).
  • Red proof, from the branch history on an earlier head (bf99218c1b, same tests): a diagnostic build that carries the previous batch's tracker state into the batch opened after an injected failed submit turns agc_graphics_state_recorder red at "the first draw after a failed submit on a recycled command buffer handle" (the draw is suppressed instead of recording all 16 commands); without the mutant it passes. The compile-time check is its own negative control: recording vkCmdSetViewport through Context::Function does not compile. agc_command_state first failed 8 of 40 runs because the sample-location mock ignored blockOptimizedLink; after that test fix it passed 150 of 150 runs and 100 of 100 on the then frozen commit.

Per-draw cost, replay. Identical frames, so the change is the only difference. A 3-frame capture of the scene below (APS5_FRAME_CAPTURE, 9,364 draws) is replayed with agc_frame_replay --repeat 5 through the real submit path, with the same pipelined-draw settings as the boots; passes 2 to 5 count. Base 46552cb461 and each build alternate run by run. Every pass of every run drew exactly 9,364 draws and every run matched the base pixels exactly (pixels_identical 1.0). The metric is committer wall time per commit, per draw; base is about 53.2 µs per draw. The replay tool is main's tools/FrameReplay.cpp with #12565, #12567, #12568, #11435 and #13984 merged and a local retire of resident images before each memory restore so --repeat works; it is local and not part of this pull request (per-build summaries and binary provenance attached).

build pairs commit µs per draw, change (95 % CI) relative timed ms per pass, change (95 % CI)
this change, b0fe73c6dd 5 -1.35 ± 1.04 -2.5 % -12.0 ± 9.4
all three merged on 46552cb461 5 -2.99 ± 0.44 -5.6 % -25.5 ± 7.7
calibration: +1.0 µs spin per draw 5 +0.92 ± 0.68 +1.7 % +6.3 ± 11.4
null control: import validity f62ea7bd08 5 -0.19 ± 0.64 -0.4 % -0.1 ± 11.1
null control: pushless offset 0e323b1bdc 5 -0.56 ± 1.00 -1.1 % -4.9 ± 9.5

The calibration build reads its injected 1.0 µs, so the replay resolves per-draw costs below 1 µs; base against base reads +0.10 ± 0.37. The two null controls stay within noise. The three changes add up: -1.35, -0.81 and -0.44 sum to -2.60, inside the merged build's -2.99 ± 0.44. Thread CPU columns are attached but not used: Windows thread times tick in 15.6 ms steps, too coarse for 1 µs per draw. The replay cannot show contention with the title's own threads, frame pacing, or GPU-bound time.

Frame time, stacked boots. main 46552cb461 against the three changes merged on it, one warm-up boot each, then two ABBA pairs in the scene below on the current host: mean ms/frame 147.0 to 136.0 (-7.5 %) and 136.7 to 131.3 (-4.0 %); p99 168.8 to 181.9 and 192.6 to 188.7. These are not attributed to the change: the merged build drew 13 % fewer draws per present in those boots (1,497 and 1,611 against 1,783 and 1,801), and draw count varies from boot to boot with the scene, which is why the per-draw figure above comes from the replay. The older per-pull-request pairs below were taken on this branch before its rebase and on the host state before the changes listed under Host; the counts are per pull request and stay.

Performance, older per-PR pairs. GTA V (PPSA04263, content 01.011.001), standing scene, 3840x2160, default in-game settings. Two interleaved pairs, main then this change, twice, after one warm-up boot of each build that is not a sample. Each capture is the 30 s trace window from 235 s after launch, about 30 s after the player stands still (202 to 206 s in every capture), with pipelined draws (APS5_DRAW_PIPELINE=1, APS5_PIPELINED_DRAWS=32, APS5_PIPELINE_DISPATCH=1). main was 7383be1a19; the change was 86104970d7, this branch before its rebase onto 46552cb461 (git range-diff shows the same patches; only the context lines of the debt entry differ).

capture commit presents in 30 s mean ms/frame p50 p90 p99 max GPU busy ms/present queue worker busy
main, pair 1 7383be1a19c7 224 134.3 133.0 138.4 158.0 202.1 33.8 94.8 %
change, pair 1 86104970d79d 220 136.8 133.6 145.4 200.9 238.8 34.0 95.2 %
main, pair 2 7383be1a19c7 216 138.9 138.5 145.6 162.1 194.2 33.8 95.2 %
change, pair 2 86104970d79d 227 132.6 131.0 137.3 168.8 195.5 34.1 94.8 %

Change minus main, mean ms/frame: pair 1 +2.50, pair 2 -6.31, mean -1.90 (-1.4 %); p50 +0.6 and -7.5; p99 +42.9 and +6.7.

Frame time is within noise. Twelve main captures of this scene across six blocks give a mean of 137.6 ms per frame with a standard deviation of 1.85 ms (1.35 %), and the two pair deltas have opposite signs; two pairs resolve about 3 % at best. The p99 rose in both pairs (+42.9 and +6.7 ms); in a 30 s capture of about 220 frames the p99 is set by the two or three longest frames, so a single pair's p99 moves with single long frames; in the stacked boots below it moved both ways (+13.1 and -3.9 ms).

Why frame time barely moves: the scene is CPU-bound and the draw committer is its critical path. In a 60 s stack sample of main in this scene (1 ms sampling, 3,843 samples per thread, digests attached), finishDraw/commitDraw is 79.8 % of the committer's samples inclusive, Graphics::Draw 76.1 %, prepareDraw 53.4 %, recordPreparedDraw 21.8 % and collectWrites 12.2 %; about half the sampled stacks are cut at 64 frames, so inclusive shares are lower bounds. The queue worker shows 95 % busy in every capture, but 53 % of its samples are DrawFinisher::Drain reading steady_clock::now while it waits, so that figure overstates its load. GPU busy is 33.8 ms of a 137 ms frame.

The work this change removes, counted in separate boots of the same scene (75 s after the player stands still, APS5_PROFILE_DRAW=1, so counts only, never timing) with a local counter patch that counts the vkCmdBindPipeline (graphics) and vkCmd Set* calls the draw code requests and those actually recorded; the patch is applied identically to both sides and is not part of this PR (diag-base.patch, diag-r1.patch):

per draw main boot 1 main boot 2 spread this change change
graphics pipeline binds recorded 0.98 0.98 0.5 % 0.42 -57.6 %
dynamic state commands recorded 18.63 18.54 0.5 % 0.63 -96.6 %
graphics pipeline binds requested 0.98 0.98 0.5 % 1.00 +1.9 %
dynamic state commands requested 18.63 18.54 0.5 % 14.96 -19.5 %

Per frame that is about 51,000 fewer dynamic state commands (52,794 to 1,785) and 1,600 fewer pipeline binds (2,783 to 1,175). The boots drew 2,827 to 2,853 draws per present; the per-draw rows carry the comparison. Requests fall too because the draw path no longer asks for state a recorded pass already set.

The same boots print the draw committer's cost per commit ([draw] pipelined (10 s, depth 32): N commits at X us each, one line per 10 s; a commit is one draw or other operation the committer runs from its queue). Over the seven 10 s blocks of the window, main averaged 35.4 and 34.4 us per commit (blocks 34.2 to 36.6 us) and this change 33.6 us (blocks 33.2 to 34.2 us), about 1.3 us (3.8 %) less. At about 3,660 commits per present in these boots that is about 4.9 ms per present on the committer, the thread on the critical path (see above). APS5_PROFILE_DRAW adds its own clock reads and turns off the draw finisher handoff, so these are a comparison between builds, not a timing.

Summary lines (tools/trace_digest.py JSON summary, one per capture, in the order of the table):

{"commit":"7383be1a19c7","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4119,"ms":30086.636},"presents":224,"frame_ms":{"p50":133.016,"p90":138.351,"p99":158.013,"max":202.100},"gpu_busy_ms_per_present":33.796,"worker_busy_pct":{"queue worker 0x0":94.800},"top_phases_ms_per_frame":{"Driver.Packet":120.795,"Graphics.Draw":102.866,"Driver.Packet.draw":91.530,"Driver.Draw":90.928,"Graphics.Draw.draw_and_resource_release":81.126,"Driver.DrawFinish":78.517,"Driver.Draw.prepare":71.069,"Driver.DrawFinish.shader_compile_and_link":43.331},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.091,"events_lost":1299839,"totals_full":false},"draw committer":{"events_full_after_s":10.820,"events_lost":467099,"totals_full":false},"draw finisher":{"events_full_after_s":12.816,"events_lost":349882,"totals_full":false}},"trace":"aps5-trace-7383be1a19c7-24960.json.gz"}
{"commit":"86104970d79d","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4130,"ms":30099.117},"presents":220,"frame_ms":{"p50":133.579,"p90":145.444,"p99":200.923,"max":238.815},"gpu_busy_ms_per_present":34.000,"worker_busy_pct":{"queue worker 0x0":95.234},"top_phases_ms_per_frame":{"Driver.Packet":123.564,"Graphics.Draw":104.735,"Driver.Packet.draw":92.702,"Driver.Draw":92.113,"Graphics.Draw.draw_and_resource_release":82.199,"Driver.DrawFinish":79.021,"Driver.Draw.prepare":71.963,"Driver.DrawFinish.shader_compile_and_link":44.731},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.137,"events_lost":1250287,"totals_full":false},"draw committer":{"events_full_after_s":11.251,"events_lost":432802,"totals_full":false},"draw finisher":{"events_full_after_s":13.065,"events_lost":339709,"totals_full":false}},"trace":"aps5-trace-86104970d79d-10600.json.gz"}
{"commit":"7383be1a19c7","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4079,"ms":30007.194},"presents":216,"frame_ms":{"p50":138.524,"p90":145.591,"p99":162.078,"max":194.210},"gpu_busy_ms_per_present":33.771,"worker_busy_pct":{"queue worker 0x0":95.238},"top_phases_ms_per_frame":{"Driver.Packet":124.735,"Graphics.Draw":107.107,"Driver.Packet.draw":94.222,"Driver.Draw":93.599,"Graphics.Draw.draw_and_resource_release":84.117,"Driver.DrawFinish":79.620,"Driver.Draw.prepare":72.851,"Driver.DrawFinish.shader_compile_and_link":45.859},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":4.923,"events_lost":1302401,"totals_full":false},"draw committer":{"events_full_after_s":10.599,"events_lost":475399,"totals_full":false},"draw finisher":{"events_full_after_s":11.773,"events_lost":393890,"totals_full":false}},"trace":"aps5-trace-7383be1a19c7-13360.json.gz"}
{"commit":"86104970d79d","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4124,"ms":30103.471},"presents":227,"frame_ms":{"p50":131.048,"p90":137.280,"p99":168.750,"max":195.476},"gpu_busy_ms_per_present":34.068,"worker_busy_pct":{"queue worker 0x0":94.820},"top_phases_ms_per_frame":{"Driver.Packet":119.044,"Graphics.Draw":101.151,"Driver.Packet.draw":89.227,"Driver.Draw":88.637,"Graphics.Draw.draw_and_resource_release":79.489,"Driver.DrawFinish":76.272,"Driver.Draw.prepare":68.730,"Driver.DrawFinish.shader_compile_and_link":43.289},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.191,"events_lost":1248477,"totals_full":false},"draw committer":{"events_full_after_s":11.307,"events_lost":435802,"totals_full":false},"draw finisher":{"events_full_after_s":13.274,"events_lost":332110,"totals_full":false}},"trace":"aps5-trace-86104970d79d-19600.json.gz"}

Traces: main, pair 1 aps5-trace-7383be1a19c7-24960.json.gz, change, pair 1 aps5-trace-86104970d79d-10600.json.gz, main, pair 2 aps5-trace-7383be1a19c7-13360.json.gz, change, pair 2 aps5-trace-86104970d79d-19600.json.gz. Counter lines: counters-base.txt, counters-base2.txt, counters-cand.txt.

tools/performance_compare.py output per pair: pair 1, pair 2. tools/trace_digest.py output per capture: main, pair 1, change, pair 1, main, pair 2, change, pair 2.

Deviations from the Performance report form, the same in every capture (deviations.txt, environment per capture in the *-env.txt files):

  • The pipelined draw variables above, APS5_ADDRESS_COPY_MAX_MIB=512, APS5_NO_PAD_INPUT=1, APS5_LOG_TIMESTAMPS=1 and APS5_TRACE_SUMMARY_EVERY=10.
  • Scripted pad input from one saved game reaches the scene, and frame dumps (APS5_DUMP_FRAMES=80, APS5_DUMP_FRAMES_EVERY=300) let the script see the menus and check the view; the log is redirected to a file the script reads.
  • All builds share one warm shader cache directory (ANYPS5_SHADER_CACHE_DIR, __GL_SHADER_DISK_CACHE_PATH).
  • The trace buffers fill in every capture (trace_dropped), so slice counts are partial; the summary totals are complete.
  • This block only: the first main capture ran at 21:09 and the other three at 21:16 to 21:31, with one killed boot between them that was not kept.

Host: AMD Ryzen 7 5800X (16 threads), 32 GB, NVIDIA GeForce RTX 3080 (driver 621.14, Vulkan 1.4.357), Windows 10.0.26220, desktop on AC power with the High performance scheme, display 2560x1440 at 179 Hz; the title renders 3840x2160 (host-report.txt). That is the host of the older pairs and the counter boots above. Since then Resizable BAR is on (BAR1 16384 MiB, VBIOS 94.02.27.00.09), Windows is build 26320 and Defender excludes the build, tool and capture folders; the driver is still 621.14. The replay measurement and the stacked boots ran on that host.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080 (driver 621.14, Windows 10.0.26220); Mesa lavapipe on the fork's GitHub runners (Linux and Windows)
  • AI-assisted: yes

🤖 Generated with Claude Code

chitters2004 and others added 8 commits November 7, 2026 13:00
…mands

Each recorder batch owns a CommandState that remembers the graphics pipeline
bound in its command buffer and the effective value of every dynamic state
the draw path sets. Pipeline::Begin, Continue, the back-face and
second-channel binds, and the stencil replay reference skip a bind or setter
the command buffer already holds. The state is unknown after
vkBeginCommandBuffer, after a pipeline bind for every state the pipeline
fixes statically, and around RecordSampleOrder and Recorder::RecordUncounted,
which record graphics commands the tracker does not see.
APS5_NO_STATE_SUPPRESSION restores unconditional recording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Draw.cpp's APS5_DRAW_TRANSITIONS recorded fallback now hands the recorder's
graphics state to the sample order, pipeline begin, stencil replay, back-face
and second-channel calls, as the lean path does.

Tests drive the tracker through real objects. A real Recorder reopened over a
reused command buffer handle re-emits the pipeline bind and every setter, two
interleaved recorders never suppress each other, and a tracked draw after
RecordUncounted (also when it throws) or RecordSampleOrder re-emits all of
them. Pipeline::Continue swaps from the fast-linked to the optimized handle
within one tracker and suppresses afterwards, and a D16 stencil target stored
as D24 caches and emits the converted depth bias for front and back faces,
with and without graphics pipeline libraries. Recorded per-face draws set the
viewport and scissor once, the synchronous path twice, and the optimized
readback, stencil replay and per-face depth bias tests also run with
APS5_NO_STATE_SUPPRESSION.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CommandState now records the tracked binds and dynamic state on its own
command buffer, so no caller can pass an untracked or mismatched buffer.
Pipeline, stencil replay, sample order and pass-end callbacks take the
recorder's CommandState; raw recording goes through CommandState::Untracked,
which forgets tracked state around it. APS5_NO_STATE_SUPPRESSION keeps
tracking off through a mask instead of a null tracker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The depth reorder now records its graphics pipeline bind, viewport, scissor, stencil write mask and stencil reference through CommandState, with one shared dynamic state list for pipeline creation and the slot mask. RecordSampleOrder no longer forgets the tracked state, so the draw after a pass records only what differs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RecordUncounted hands its callback the batch's CommandState instead of a raw command buffer behind Untracked, which is removed. The first sample copy records its graphics pipeline bind through the tracker, so the draw after an uncounted pass records only what differs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CommandState suppresses redundant graphics pipeline binds and dynamic
state, so any such command recorded outside it leaves the tracker stale
and silently drops a needed command. Context::Function, Context::Resolved
and the device setup lookup now take a consteval FunctionName that
rejects a graphics bind, a tracked dynamic state command,
vkCmdBindShadersEXT or vkCmdExecuteCommands by name. The device table's
tracked entries become write-only TrackedFunction members that only
CommandState and the new Context::BindComputePipeline read.

Compute binds go through BindComputePipeline; presentation, the overlay
and tests that record their own command buffers use an untracked local
CommandState. Recorded commands are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DynamicSlots rejects a dynamic state the tracker does not follow, and a
second render pass of a batch records nothing for an identical draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FunctionName keeps its name private, CommandState cannot be copied, the draw
fallback builds a tracker only for unrecorded draws, and the unused recording
generation is gone. Tests check the recorded per-face pixels and a failed
submit reopened on a recycled command buffer handle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean oneandonlydean self-assigned this Nov 7, 2026
@github-actions github-actions Bot added perf Performance change build docs agc libSceAgc* labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9503 core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp L246-248, L250-252
PR 9508 core/libs/prx/libSceAgcDriver/Execution/src/PresentationPass.cpp L363-368
core/libs/prx/libSceAgcDriver/Execution/src/PresentationUpscaler.cpp L3, L347, L350-353
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L826, L828, L5956-5959
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp L307-312
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp L841-842
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L150-153
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2599, L2953
core/libs/prx/libSceAgcDriver/Graphics/src/FirstSampleCopy.cpp L246-247
core/libs/prx/libSceAgcDriver/Graphics/src/GpuColorTransfer.cpp L149-151
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleReadback.cpp L99-102
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleUpload.cpp L61-64
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp L1365-1366, L1991-1992, L2527, L2906-2908, L3013, L3059
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp L177-181, L246-252
core/libs/prx/libSceAgcDriver/Graphics/src/StagedMerge.cpp L116-121
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp L251-269, L334-337, L416-417, L442-460
core/libs/prx/libSceAgcDriver/tests/execution/SampleOrder.cpp L539, L546, L627, L634, L1469, L1471, L1473, L1475
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp L422
PR 9897 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L13899
PR 10351 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L3929, L3931
PR 12840 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L5956, L6044
PR 12944 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L6044
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp L20
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2858, L3842-3843
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp L1870, L1897, L1990-2010, L2764-2765
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp L20
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2858, L3842-3843
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp L1870, L1897, L1990-2010, L2764-2765
PR 14032 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L13899
PR 15570 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp L422
PR 17899 core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp L1001, L1004-1014, L1039-1044
PR 19119 core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp L21
PR 19373 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp L80-81
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp L986-987, L990-994, L1039-1044
PR 19559 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2953
PR 19697 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp L52
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp L92-93
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2887, L2920, L2925-2926, L2953, L2957-2958, L2961-2962
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp L937, L965
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp L1870
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp L11504-11505
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake L477, L481

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
docs/dev/ENVIRONMENT.md
PR 4847 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5581 core/libs/prx/libSceAgcDriver/Graphics/src/GpuColorTransfer.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6186 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6192 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6209 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6553 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 6804 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6808 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7449 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 7514 docs/dev/ENVIRONMENT.md
PR 7642 core/libs/prx/libSceAgcDriver/Execution/src/PerformanceOverlay.cpp
core/libs/prx/libSceAgcDriver/Execution/src/PresentationPass.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/SampleOrder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/FirstSampleCopy.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GpuColorTransfer.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleReadback.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleUpload.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/StagedMerge.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/MultisampleReadback.cpp
core/libs/prx/libSceAgcDriver/tests/execution/SampleOrder.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 7643 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 8004 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 8246 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/TextureDetiler.cpp
docs/dev/ENVIRONMENT.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 9335 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9345 docs/dev/ENVIRONMENT.md
PR 9356 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 9387 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9950 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10049 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/Execution/src/PerformanceOverlay.cpp
core/libs/prx/libSceAgcDriver/Execution/src/PresentationPass.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GpuColorTransfer.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleReadback.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleUpload.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 10359 docs/dev/debt/libSceAgcDriver.md
PR 10442 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/ENVIRONMENT.md
PR 10652 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 10678 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 10757 docs/dev/ENVIRONMENT.md
PR 11435 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 11436 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PartiallyResidentSnapshot.cpp
PR 11483 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 12324 docs/dev/ENVIRONMENT.md
PR 12619 core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
PR 12746 docs/dev/ENVIRONMENT.md
PR 12828 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 12849 docs/dev/ENVIRONMENT.md
PR 12904 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
docs/dev/debt/libSceAgcDriver.md
PR 13148 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13251 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 13928 core/libs/prx/libSceAgcDriver/Execution/src/PerformanceOverlay.cpp
core/libs/prx/libSceAgcDriver/Execution/src/PresentationPass.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GpuColorTransfer.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleReadback.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleUpload.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 13929 core/libs/prx/libSceAgcDriver/Execution/src/PerformanceOverlay.cpp
core/libs/prx/libSceAgcDriver/Execution/src/PresentationPass.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GpuColorTransfer.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleReadback.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleUpload.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 14217 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 14218 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmake
docs/dev/debt/libSceAgcDriver.md
PR 15296 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 15456 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 15548 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 15621 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 16354 docs/dev/ENVIRONMENT.md
PR 16371 docs/dev/ENVIRONMENT.md
PR 16372 docs/dev/ENVIRONMENT.md
PR 16793 docs/dev/ENVIRONMENT.md
PR 17056 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 17557 docs/dev/ENVIRONMENT.md
PR 17558 docs/dev/ENVIRONMENT.md
PR 17611 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 17700 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 17719 docs/dev/ENVIRONMENT.md
PR 17729 docs/dev/ENVIRONMENT.md
PR 17796 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 18173 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
PR 18226 docs/dev/ENVIRONMENT.md
PR 18390 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 18515 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md

@gabichuuuuu

Copy link
Copy Markdown
Contributor

Ran 1781488bcb merged on main 302864d on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Khronos validation layer 1.4.368), over every test whose file this PR touches: ctest -R '^(agc_driver_graphics|agc_driver_recorder|agc_driver_depth_bias_per_face|agc_driver_pipeline_optimized_readback|agc_driver_stencil_replay|agc_driver_multisample_readback|agc_driver_oversized_descriptor_sets|agc_driver_partially_resident_snapshot|agc_driver_pooled_buffer_range|agc_driver_sample_order|agc_driver_sparse_buffer_holes|agc_driver_stencil_null_feedback|agc_driver_draw_cache_reuse)' -V.

main (38 tests) change, 2 runs each (45 tests)
NVIDIA 38/38 45/45
Intel 37/38 44/45
  • On the Intel iGPU, agc_driver_multisample_readback_upload fails on main and with the change in the same way, so it isn't from this PR. Nothing else fails.
  • The new agc_command_state test passes 2/2 on both GPUs. I couldn't run it without the change: the test needs the new CommandState API, so it doesn't build against main's sources.
  • The layer was inserted in every device test. No log has was not found but was requested by env var VK_INSTANCE_LAYERS, and no log on either side has a VUID-. With pipeline and dynamic state commands now skipped when redundant, a draw left with stale or missing state would be the likely VUID here, and none showed up in these tests.
  • This checks correctness, not speed. I didn't run tools/trace_digest.py.

AI-assisted: yes.

…tate

Main's presentation upscaler resolved vkCmdBindPipeline, vkCmdSetViewport and
vkCmdSetScissor by name, which the tracked command-state functions of this
change reject at compile time. Record them through a CommandState that does
not suppress, so every command is still emitted as before.
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 9, 2026
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 9, 2026
Keep both debt entries.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 9, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 10, 2026
Conflicts:
- Graphics/include/Context.hpp, Graphics/src/Resources.cpp: main (boykopovar#16572)
  added cmdSetColorWriteMask next to the viewport and scissor entries we made
  tracked; kept our TrackedFunction members and lookups, and added main's
  entry as a plain function pointer, since the colour write mask is set
  outside CommandState (its test swaps the pointer).
- Graphics/include/Pipeline.hpp, Graphics/src/Pipeline.cpp: main added a
  masked state argument to Begin, Continue, ContinueBackFaces and
  ContinueSecondChannel and setColorWriteMasks after each bind; our side moved
  those functions to CommandState. They now take CommandState& with main's
  masked argument, and call setColorWriteMasks(recording.Commands(), ...) at
  main's points, after the CommandState bind.
- Graphics/src/Pipeline.cpp constructor: our DynamicSlots runs before main
  appends VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT, so the tracker follows only
  the states it knows; the mask is set after every bind, so a skipped rebind
  keeps it right.
- Graphics/src/Draw.cpp: main passes the masked state to each pipeline call;
  kept main's arguments with our CommandState recording.
- tests/Recorder.cpp, tests/cmake/agc_driver_recorder_tests.cmake: main added
  agc_snapshot_read_into_staging where we added the graphics state tests; kept
  both, and both are in the WIN32 PATH list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 11, 2026
One textual conflict in agc_driver_graphics_tests.cmake: both sides
added tests after agc_sparse_buffer_holes (agc_command_state here,
agc_copy_input_failure_lifetime on main); both are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 11, 2026
The dynamic color write masks (vkCmdSetColorWriteMaskEXT, set per draw
since the color write masks moved into dynamic state) were set through
context.Resolved after every pipeline bind and continue, outside
CommandState, so a run of draws with the same masks set them again on
every draw, and the pipeline's dynamic slots left them out.

CommandState now has a ColorWriteMask slot. SetColorWriteMasks keeps the
count and the masks it last set: a set whose masks are a prefix of the
known ones (the same attachments, or fewer with the same masks) records
nothing; a changed mask or a wider set records the command. A pipeline
that declares VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT keeps the slot across
its binds (the slot is computed after the mask joins the dynamic states);
one with static masks forgets it. Pipeline::setColorWriteMasks goes
through the command state, and vkCmdSetColorWriteMaskEXT joins the
tracked commands: the device function is a TrackedFunction, and naming
it in Context::Function or Resolved outside CommandState does not
compile (checked by adding such a call: TrackedCommandOutsideCommandState
in a constant expression).

Tests: agc_command_state checks the slot mapping (the library's dynamic
states and the mask slot together cover every slot) and a sequence of
mask sets by attachment count, after binds of pipelines with dynamic and
static masks, after invalidation and without suppression.
ColorWriteMaskDynamic expects no set for a continued draw with the same
masks unless APS5_NO_STATE_SUPPRESSION=1, and resolves the native
function itself since the table entry is tracked; two new runs cover it
without suppression and with the masks in the pipeline
(APS5_NO_DYNAMIC_COLOR_WRITE_MASK=1). A mutant that ignores the mask
values (compares the counts only) fails agc_command_state and
ColorWriteMaskDynamic. The command state, graphics state recorder (both
modes), color write mask (three runs), draw cache, relocation,
recapture, alpha to coverage and village tests pass (23 of 23; four
alpha to coverage variants skip on lavapipe).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean
oneandonlydean merged commit 54b04dd into boykopovar:main Nov 14, 2026
13 checks passed
chitters2004 added a commit to chitters2004/AnyPS5 that referenced this pull request Nov 14, 2026
Merges main 2b964d8, which brings the command state (boykopovar#16752) and
boykopovar#17739. Conflicts resolved as in the command-state and encoder merge
43bf5c8: a batch keeps its BatchCommands, encoder recording and
folded samples next to the command state, the recorder's function
lookup takes a FunctionName and the caller's source location, and the
tests keep both the encoder segment tests and the first-sample copy
tracking test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pipodi pushed a commit to Pipodi/AnyPS5 that referenced this pull request Nov 15, 2026
…t opens

Recorder::SplitForRun replaces the batch's command buffer, but the CommandState
introduced by boykopovar#16752 kept tracking the ended one, so the next draw suppressed
state it never recorded into the new buffer and crashed at the first title draw.
Begin the state on the new command buffer.

Found and fixed by Celegans12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs perf Performance change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants