feat(agc): draw alpha-tested packed-target merges that write depth as a depth pass and an EQUAL merge pass #9335
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9335"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-21T18:42:41Z.
What
A partial or blended write into a packed color target merges inside the pixel shader through #8564's pixel-interlock read-modify-write, which forces early fragment tests. That throws when the shader kills pixels under late tests and the draw writes depth (
kills under late tests, draw writes depth or stencil): with early tests the killed fragments would still write depth, so alpha-tested holes would occlude what is drawn behind them. Gran Turismo 7 stops on this in the World Map with an alpha-tested draw into an 11_11_10 target (#9020's blend), reverse-Z:DB_DEPTH_CONTROLZFUNC GEQUAL with depth writes, no stencil, one target.This branch started as #9020 plus its own commits, with merges of #9020's branch into it; #9020, #11557 and #8564 are all in
mainnow, so its diff againstmainis the split alone (13 files). Its commits:5451af857(the split),4768b4ab4(no split when a program of the draw may write memory),5198b9c10and829eb0d21(the split targets returned from the draw),91e0e9da9(no split when the draw clears depth),1454d7b4b(a second, unmerged target in the GPU test),8eb63a203(the split mask kept through the label-recapture retry),8872e283f(the depth-clear check insideLateTestMergeSplitTargets),65ad383ca0(the split mask kept throughmain's recapture retries),dc3f7e7f19(the GPU test skips on devices withoutshaderStorageImageReadWithoutFormat)704f9bfa52(no split when the shader exports depth, stencil or a sample mask or runs with a quad sample mask),fa2d1070a0(no split on a device without the merge pass's capabilities),99f4f9cb60(no split when the draw runs the depth-bounds test),385f83dd64(no split when the depth compare fails at equal depth),f8a53dc5d1(the debt entries moved into the branch's fragment),5889dfff95(both passes drawn at the unsplit draw's render extent),01d6097802(a GPU test of the occlusion-query refusal with a shader that writes no memory) and62f116beb2(both passes prepared before either draws). The latest merge,ad5b0835d1, mergesmaine0ef70639d(the earlierc26a94d46cmergedf2818312ba). The split alone:github.com/frankea/[email protected], and the memory check:github.com/frankea/AnyPS5@4768b4ab4CB_TARGET_MASK, so it has no merge: the title's own late tests, kill and depth write run as they are, and depth ends up as on the console. The second pass keeps only those 4 bits and setsDB_DEPTH_CONTROLZ_WRITE_ENABLEto 0 andZFUNCto EQUAL (2). It writes no depth or stencil, which is the shape #8564 already merges with a kill under late tests, so it blends exactly the fragments the kill keeps whose depth equals what the first pass left. Field positions and theCompareFragencoding are from Mesa's gfx103.json (DB_DEPTH_CONTROLbits 2 and 6:4,CB_TARGET_MASK4 bits per target,DB_SHADER_CONTROLKILL_ENABLEbit 6 andDEPTH_BEFORE_SHADERbit 12).Driver::drawdecides after decoding the state and before capturing any shader (LateTestMergeSplitTargets, from the decoded state andDB_RENDER_CONTROL), returns a newDrawVerdict::Splitwith the merged target'sCB_TARGET_MASKbits in an out parameter, which the draw's label-recapture retry passes on, andPacketExecutionthen runs both passes through the unchangedDriver::draw, so each goes through the usual decode, capture, pipeline and draw caches under its own register key. EQUAL needs bit-identical depth in both passes: they run the same vertex program with the same viewport and depth bias, and positions are already decoratedInvariant. With the target bits it returns the unsplit decode's render extent, whichdrawLateTestMergeSplitsets on the queue for both passes and clears on restore;DecodeStateuses it as the render extent, so both passes get the unsplit draw's scissor and default viewport from the same registers, and it throws a named refusal if a pass's attachments do not cover it. The extent is mixed into the draw register key, so a pass's cached decode never matches an ordinary draw with the same registers.ZFUNCNEVER,DEPTH_BEFORE_SHADER, alpha-to-coverage, multisampled targets, draws while an occlusion query counts samples (the second pass would count them again), draws that clear depth (DB_RENDER_CONTROL.DEPTH_CLEAR_ENABLE), whose first pass stores the clear value the second pass would compare against, and draws that merge into more than one color target (possible since #12916). Nor is a draw split whose shader every packed merge refuses: one that exports depth, stencil or a sample mask (DB_SHADER_CONTROLbits 0, 1 and 8, asDecodePixelStageInforeads them) or runs with a quad sample mask (PA_SC_AA_MASK).LateTestMergeSplitTargetsreads these from the draw's decoded pixel stage info, whose quad masks are already in host sample order. The split prepares both passes before either one draws: with a newQueueState::splitPrepare,finishDrawreturns after every stage compile and before the first snapshot or record, so aRefusedDrawunderAPS5_SKIP_REFUSED_DRAWSor aDrawCompilePendingunderAPS5_ASYNC_DRAW_COMPILEin either pass leaves the packet with no recorded work. The two passes then draw under a thread-localSynchronousDrawCompileScope, so neither can go pending between them, and a split pass is never handed to the draw finisher. A draw is not split when one of its programs may write guest memory: both passes run every stage, so a store, atomic or GDS operation in the vertex or pixel shader would run twice. The check isProgramWritesMemoryon each program and on a user-data tail continuation, the one the draw finisher uses for held writes, which also counts jumps it doesn't follow. Such a draw takes the unsplit path and throws the refusal above.Tested
ctest --test-dir build -R <pattern> -V, 3 runs each side)maine0ef70639d62f116beb2-O3 -DNDEBUG), treeC:\src\wt-14217, build dirbuild, CPU affinity 0x3FFFagc_driver_late_test_merge_splitentries (plain plus_counting_pixel,_counting_vertex,_counting_query,_depth_clear,_equal_depth,_narrow_merge,_mask_export,_quad_mask,_pending_merge),agc_driver_graphics,agc_driver_packed_float_blend,agc_driver_packed_unorm4444_partial_write,agc_driver_sample_mask_draw,agc_driver_stencil_known_replace. Env:ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layermaindoes not have the 9 split entries.C:\VulkanSDK\1.4.363.0\Bin\VkLayer_khronos_validation.json, HKLM ExplicitLayers).Insert instance layer "VK_LAYER_KHRONOS_validation": 6 lines per run onmain, 26 per run on head.was not found but was requested by env var VK_INSTANCE_LAYERS: 0 on both.VUID-lines: 0 onmain, 0 on head. Lines withUndefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings, counted on the earlier run of01d6097802: 20 per run onmain, 35 per run on head; the extra 15 are all inagc_driver_late_test_merge_splitC:\src\pr-results\p9335c\holdsrun.txt,main-vl-{1,2,3}.log,head-vl-{1,2,3}.log,revert-vl-{1,2,3}.logand the build logs. Chain script:C:\src\pr-results\p9335c.cmdBoth sides used the same GPU and build directory, built one after the other.
mainruns the 5 shared tests; it has none of theagc_driver_late_test_merge_splitentries. Control on the 4090: withDraw.cppback at its01d6097802version (no prepare passes),_pending_mergefails in all 3 runs withdrew only its depth pass (the RGBA8 target changed, the 11_11_10 merge target did not) on attempt 4, with 0VUID-lines.On
5889dfff95, the new entryagc_driver_late_test_merge_split_narrow_mergesplits a draw into a 32-pixel-wide 11_11_10 target beside a 64-pixel-wide RGBA8 target and a 64-pixel-wide depth target. It checks that the RGBA8 target is untouched at x >= 32, and a LESS depth probe checks that no depth was written there. Control,5889dfff95with theState.cpphunk reverted: it fails with second-target pixel (32, 0) outside the unsplit draw's 32-pixel render extent holding 0xad4a669f (it held 0x2e2a2620). The paired run of5889dfff95had the same result as the table above without_counting_query(13/13 on head, 22 layer-insert lines per run, 0VUID-lines).On
01d6097802(test only), the new entryagc_driver_late_test_merge_split_counting_queryruns--counting-query: after the background depth draw it callsRecorder::Active()->CountSamples()under the GPU mutex, then submits the same killing, LEQUAL, depth-writing draw into the 11_11_10 target and the additively blended RGBA8 target, with a shader that writes no memory and with no sample mask export or quad mask. Like_mask_exportand_quad_mask, it runs underAPS5_SKIP_REFUSED_DRAWS=1and checks that the draw left depth (by the depth probe) and both targets unchanged. The stock_counting_pixeland_counting_vertexcases do not reach theCountingSamplesgate, because their shaders write memory and thewritesMemorycondition already prevents the split. On MoltenVK all 9agc_driver_late_test_merge_splitentries pass in each of 3 runs. Control,01d6097802without theCountingSamples()check inLateTestMergeSplitTargets: only_counting_queryfails, the merge pass aborting ona partial write of a packed color target merges inside the pixel shader after early depth and stencil tests, which a shader that kills pixels under late tests cannot use while occlusion queries count samples; the other 8 entries pass. On the RTX 4090 it is part of the table above. Control on the 4090,01d6097802with the same check removed:_counting_queryfails with the same message, under the validation layer.On
62f116beb2(head), the new entryagc_driver_late_test_merge_split_pending_mergeruns withAPS5_ASYNC_DRAW_COMPILE=1andANYPS5_NO_SHADER_CACHE=1. It submits the killing, depth-writing ALWAYS split draw into the 11_11_10 target next to an additively blended RGBA8 target, resetting both targets before each of up to 400 attempts. Each attempt must change both targets or neither, and the first attempt must not draw, since its passes are still compiling. When the draw lands, the 11_11_10 target must match the CPU reference bit for bit and the RGBA8 target within 1 per channel. On MoltenVK, the 10agc_driver_late_test_merge_splitentries andagc_driver_graphicspass 11/11 in each of 3 runs. Control on MoltenVK,Draw.cppreverted to01d6097802with the test kept: it fails 3 of 3 runs withdrew only its depth pass (the RGBA8 target changed, the 11_11_10 merge target did not) on attempt 4. On the RTX 4090 it is part of the table above, with the revert control described there.On
704f9bfa52(c26a94d46cplus the export and quad-mask check), Apple M5 Max, macOS 27.0.1, x86-64 build under Rosetta 2, Release, Khronos validation layer (Vulkan SDK 1.4.363.0) on a local MoltenVK 1.4.2 build and on the SDK's MoltenVK:agc_driver_late_test_merge_splitand its counting-pixel, counting-vertex, depth-clear, mask-export and quad-mask entries, plusagc_driver_graphics, pass 3 of 3 on each driver, with 36Insert instance layerlines and noVUID-line. One of the threeagc_driver_graphicsruns on the local MoltenVK failedtwo ranges under a budget for two were not imported(BdaResources.cpp, #22438's host-import budget check, withvkAllocateMemoryfailing on a loaded machine) and passed 3 of 3 on a rerun; the split code is not on that path.On
704f9bfa52, RTX 4090 (NVIDIA 621.14, Windows 11, WinLibs GCC 15.2.0, Release) under the validation layer (Vulkan SDK 1.4.363.0,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1,ctest -V --repeat until-fail:3): the sixagc_driver_late_test_merge_split*entries,agc_driver_graphics,agc_driver_packed_float_blend,agc_driver_packed_unorm4444_partial_write,agc_driver_sample_mask_drawandagc_driver_stencil_known_replacepass 11/11 three times, 54Insert instance layerlines, nowas not found but was requested by env var VK_INSTANCE_LAYERS, noVUID-line; the only validation messages are 90Undefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings.mainf2818312baon the same box passes the 5 of these it has three times, 18 layer lines, noVUID-line, 60 of the same warnings; the 30 more on this head come from the split test.The two new entries,
agc_driver_late_test_merge_split_mask_export(DB_SHADER_CONTROL0x140,SPI_SHADER_Z_FORMAT9) andagc_driver_late_test_merge_split_quad_mask(PA_SC_AA_MASK_X0Y0_X1Y00x0000ffff), run withAPS5_SKIP_REFUSED_DRAWS=1: a background depth draw, the refused draw beside an additively blended RGBA8 second target, then a probe that passes only where depth is unchanged. Every pixel must hold the probe's color and the second target its old value. Control,704f9bfa52without the new line inLateTestMergeSplitTargets: both fail withpixel (0, 0) holds 0x700d0180 (expected 0x780e01a0 from the probe, so the refused draw wrote depth) and 0x9f40609f in the second target (it held 0x20202020), andagc_driver_graphicsfails on its new depth export case.tests/Graphics.cppchecks that a depth, stencil or sample mask export, a quad pixel mask and a partial quad sample mask each stop the split.On
b6e35a0d5f(main1136efb901merged), Apple M5 Max, macOS 27.0.1, x86-64 under Rosetta 2, Release, Khronos validation layer (Vulkan SDK 1.4.363.0) on a local MoltenVK 1.4.2 build and on the SDK's MoltenVK:agc_driver_late_test_merge_splitand its counting-pixel, counting-vertex and depth-clear entries, plusagc_driver_graphics, pass 3 of 3 on each driver, noVUIDmessages.On
dc3f7e7f19(main1c4a047f7fmerged in6a2e0ee49c, plus theshaderStorageImageReadWithoutFormatskip), RTX 4090 (NVIDIA 616.92, Windows 11 10.0.26200.9711, WinLibs GCC 15.2.0, Release), compared withmain1c4a047f7fon the same build directory. Under the validation layer (Vulkan SDK 1.4.363.0,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1,ctest -V), every ctest entry of the focused targets (agc_driver_graphics,agc_driver_late_test_merge_split,agc_driver_packed_float_blend,agc_driver_packed_float_color_target, the 4_4_4_4 color target and partial-write tests,agc_driver_layered_array_color_draw,agc_driver_unclamped_normalized_blend,agc_driver_depth_export_clamp,agc_driver_key_miss,agc_driver_sample_mask_draw,agc_driver_stencil_known_replace,request_serializer,agc_shader_memory,agc_shader_disk_cache,agc_driver_pipeline_journal) passes 97/97 on this head and 93/93 onmain(which lacks the four split entries); 215 and 175Insert instance layerlines, nowas not found but was requested by env var VK_INSTANCE_LAYERS, noVUID-line on either (the threepAttachments-00605errors of the two-target case are gone since #6782 is inmain). The only validation messages areUndefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings, 40 on this head and 30 onmain, the 10 more from the split test.ctest -R agc -j4: 1572/1579 on this head, 1568/1575 onmain, the same 7 tests failing on both (agc_driver_msaa_dcc_clear_{2,4,8},agc_driver_image_plane_address_on_line#6221,agc_driver_image_sample_lod_clamp,agc_driver_image_sample_lod_clamp_shader_lane,agc_driver_native_depth_publication).agc_driver_late_test_merge_splitwith--repeat until-fail:5: 5/5.Lucke0051 ran
65ad383ca0merged ontomainon an RTX 3070 Ti and an Intel UHD Graphics 630 (Mesa 26.2.6): no difference frommainon the NVIDIA GPU; on the UHD 630agc_driver_late_test_merge_splitaborted because the device lacksshaderStorageImageReadWithoutFormat, which the merge pass needs, sodc3f7e7f19makes the test skip there, the same check #16984 adds toPackedFloatBlend.cpp.On
8872e283f(the merge of #9020's headaa1d45243,mainee9a9a66cunder it, plus8eb63a203and8872e283f), RTX 4090 (NVIDIA 616.92, Windows 11), each test run three times: #9020's 75 ctest entries plus the fouragc_driver_late_test_merge_splitones, the newagc_driver_late_test_merge_split_depth_clearamong them, pass 79/79, and 79/79 under the validation layer with the same messages as before: the threeVUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605errors of the two-target case (#11990, which #6782 fixes) and theUndefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings. Control:8872e283fwithout the depth-clear line inLateTestMergeSplitTargetsfailsagc_driver_graphics(a partial 4_4_4_4 write that kills under late tests split while DB_RENDER_CONTROL clears depth) andagc_driver_late_test_merge_split_depth_clear(the merge pass of a late-test merge split still writes depth or stencil). The label-recapture retry has no regression test: no draw can reach it and split today (see the comments).After merging #9020's head
237ede9d9(which mergesmainbb04a4f1e; head829eb0d21), RTX 4090, each test run three times: #9020's 72 ctest entries plus the threeagc_driver_late_test_merge_splitentries pass 75/75, and 75/75 under the validation layer (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1,ctest -V): 145Insert instance layerlines, nowas not found but was requested by env var VK_INSTANCE_LAYERS, 49Undefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings. The layer reportsVUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605three times, from the new two-target case, whose attachments have different blend states whilemainnever enablesindependentBlend(#11990). With #6782 merged on top, the three split-test entries pass under the layer with noVUID-line.mainbb04a4f1epasses #9020's 71-entry set in both runs, noVUID-line.The two-target case: two of the cases also bind an RGBA8 target in slot 1 that blends additively (ONE + ONE), with
CB_TARGET_MASK0xff, and require each pixel the kill keeps on the right half to hold its old value plus the color once and every other pixel to be unchanged. Control: with the merge pass keeping every target bit, the test fails withsecond-target pixel (32, 0) drawn by the depth pass holds 0xff6aa6ff (it held 0x2e2a2620), the color added twice.tests/Graphics.cpp(before704f9bfa52): the split decision over the nine existing 4_4_4_4 depth, stencil and depth-bounds cases withKILL_ENABLEset: only the one that tests and writes depth splits, and none splits without a kill; no split for a stencil write, ZFUNC NEVER orDEPTH_BEFORE_SHADER; a merged target in slot 1 splits onCB_TARGET_MASKbits 4..7.tests/execution/LateTestMergeSplit.cpp(new), through DCB submission: a 64x16 tiled 11_11_10 target over a Z32 depth target. A background depth draw, an occluder over the left half, then the split draw (a checkerboard kill, premultiplied-alpha blend), then a probe with the same compare and no depth write. Checked bit for bit on every pixel against a CPU reference: behind the occluder unchanged, kept pixels blended once, killed pixels covered by the probe, so they wrote no depth. LESS, GREATER and GEQUAL, two rounds each (the second through the caches). With the split disabled the test stops on the refusal above.RTX 4090 (NVIDIA 616.92, Windows 11, WinLibs GCC 15.2), head
7df24cebc:agc_driver_graphics,agc_driver_late_test_merge_split,agc_driver_packed_float_blend,agc_driver_packed_unorm4444_partial_write,agc_driver_packed_unorm4444_multisample_partial_write,agc_driver_sample_mask_draw,agc_driver_stencil_known_replaceandagc_driver_layered_array_color_drawpass.After merging #9020's
mainmerge (head7e67a5468, onmain7e69be679), RTX 4090: the 52 ctest entries of #9020's focused targets plusagc_driver_late_test_merge_split_tests,agc_driver_sample_mask_draw_testsandagc_driver_stencil_known_replace_testspass 52/52, each test run three times (ctest --repeat until-fail:3).Validation layer:
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Vulkan SDK 1.4.363.0),ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1withctest -V, onmain83462cc57(7e69be679plus eight commits totools/only) (48/48:mainlacks the split test and #9020's three) and on this head (52/52). Neither log haswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither has aVUID-line. The layer's only messages on this head areUndefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings from the merge tests, where the merged target has no color attachment and the fragment output goes unused: 10 inagc_driver_late_test_merge_split, and #9020's 29.mainlogs no validation message in its 48.After merging #9020's new head
634b3dc78(which merges #8564's headd201de3f3andmain2259f0530), headbe2546ed7on the RTX 4090: #9020's 56 focused ctest entries plusagc_driver_late_test_merge_split_tests,agc_driver_sample_mask_draw_testsandagc_driver_stencil_known_replace_testspass 59/59, each test run three times; under the validation layer 59/59 with noVUID-line (the 29 warnings of #9020's merge tests plus 10 from the split test, allUndefined-Value-ShaderOutputNotConsumed-DynamicRendering). The packed merge refusals entry inshader.mdnow sits where #8564 moved it, with this PR's narrowing (a kill under late tests throws for a stencil write; a depth write is split).After merging
main0db47b263(#6946's draw finisher pipeline among it), headbb446b79aon the RTX 4090: the same 59 ctest entries pass 59/59, each test run three times, and 59/59 under the validation layer with noVUID-line (the same 39Undefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings); withAPS5_DRAW_PIPELINE=1,agc_driver_late_test_merge_split,agc_driver_packed_float_blendandagc_driver_packed_unorm4444_partial_writepass 3/3, each run three times.main0db47b263: 54/54 and 54/54 under the layer, noVUID-line. The split check runs indrawbefore a draw is handed to #6946's finisher, which receives the decoded state of each pass, so restoring the two registers after each pass is unaffected.After merging #9020's new head
6806092c4(#8564's head3a6688415andmain513ca7e55under it) andmain58ceeb8ed(headde1a81f42; the only conflict was an include line in the driver'sDraw.cpp), RTX 4090: the 61 ctest entries the same targets now select (mainadded two) pass 61/61, each test run three times, and 61/61 under the validation layer with noVUID-line (the same 39 warnings); withAPS5_DRAW_PIPELINE=1the split test and #9020's blend and partial-write tests pass 3/3.tests/execution/LateTestMergeSplit.cppgets two modes, ctestagc_driver_late_test_merge_split_counting_pixelandagc_driver_late_test_merge_split_counting_vertex. A draw without a merge first shows the shader adds to a buffer counter (buffer_atomic_add); then the split draw with the same shader must throw the late-test refusal and leave the counter as it was. Control, this head withDraw.cppas it was before4768b4ab4: the vertex case is split and drawn twice, and the pixel case draws the depth pass, then stops on #8564's memory-write refusal in the merge pass.After merging #9020's head
5e0455020(main379b1dca3under it) and adding4768b4ab4, RTX 4090: the 64 ctest entries the same targets now select, both counting modes among them, pass 64/64, three times each, and 64/64 under the validation layer with noVUID-line (the same 39 warnings); withAPS5_DRAW_PIPELINE=1, the split test, both counting modes and #9020's blend and partial-write tests pass 5/5, three times each.After merging #9020's head
5f7287406(main732ab06f4under it; journal format 11, disk cache 49), head976fc9c3e:main's draw tracing givesdraw()the packet offset, sodrawLateTestMergeSplittakes it too and passes it to both passes, andmain's new verdict names gainSplit. RTX 4090: the 70 ctest entries the same targets now select pass 70/70, three times each, and 70/70 under the validation layer with noVUID-line (the same 39 warnings). Control, this head with the memory-write check removed fromDraw.cpp(3c14784ba): both counting modes fail, the vertex case split and drawn twice and the pixel case stopped on #8564's memory-write refusal.main3af09d95epasses the 66 entries it has, also under the layer with noVUID-line. The head also merges cleanly withmain504ea3b53.Gran Turismo 7 (PPSA01317) on the RTX 4090, with 4768b4ab4's check on the local integration branch of the GT7 runs (
mainof 10/23 plus the PRs the title needs) and a local print of each split candidate's programs. In run ui-4, the first 200 candidates were all the World Map's alpha-tested draw, vertex program 0x126bcefb00 and pixel program 0x126bcf0300.ProgramWritesMemoryis false for both, so the draw still splits, and the load went past the World Map tounsupported tessellation built-in, which this PR doesn't touch.Besides the merge, the two-pass draw's debt sentences moved from the packed merge refusals entry in
shader.mdto an entry of their own inlibSceAgcDriver.md, which keeps the first entry under the 1000-character limit.Gran Turismo 7 (PPSA01317 01.710.000) on the RTX 4090, with this commit on a local integration branch (#9020 before its
mainmerge, #9068's two fixes, #7978, #7243, #7256, #7550, and three local changes: one draws a partially resident depth target whose pages are all committed, one skips the compute dispatches refused in #6191, one draws dithered alpha-to-mask as undithered). The World Map's alpha-tested draw into the 11_11_10 target with pixel shader 0x126bcf0300 (GEQUAL with depth writes, no stencil) used to stop the load on the refusal above. It now draws through the split, and the load goes on tocolor targets with fewer fragments than samples (EQAA) are unsupported(4 samples, 2 fragments, 512x512), which this PR doesn't touch.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)mainSummary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T04:42:10Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
At this head the split builds, the focused tests pass under the validation layer, and both negative controls fail as they should, but the branch no longer merges into current
main(7 conflicting files), so I am requesting changes.What I ran
976fc9c3e53e40ba108b5fce08cafd0b1ab24c9emain:b433c40f2f46aa2e59e19806010a839ac8572d64The submodules stayed at the commits
mainrecords, soSPIRV-Headers,SPIRV-Toolsandvorbisare newer than the ones the PR head pins.Results
mainb433c40f2fgit diff --checktools/check_conventions.pyAll conventions checks passed.VUID-lineswas not found but was requested by env var VK_INSTANCE_LAYERSUndefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings: 10 each inagc_driver_late_test_merge_split,agc_driver_packed_float_blendandagc_driver_packed_unorm4444_partial_write, 9 inagc_driver_packed_unorm4444_multisample_partial_write. That is the same count the description gives.mainctest summary (PR head, validation layer)
Every Vulkan test logged
Selected GPU name=NVIDIA GeForce RTX 4070 Ti SUPER, and the loader loggedadding layers "VK_LAYER_KHRONOS_validation".Negative control
Restoring every production file from
maindoesn't work here, because the tests use the newTargetMergefields and would not compile (as noted in an earlier comment). Instead I ran two narrower controls on the PR head, each changing one line inExecution/src/Driver/Draw/Draw.cpp:false).agc_driver_late_test_merge_splitfails with the #8564 refusal,... which a shader that kills pixels under late tests of a draw writing depth or stencil ... cannot use. The two counting modes still pass, as expected, because they want that refusal.&& std::ranges::none_of(decode->programs, writesMemory)dropped). Both counting modes fail. The vertex mode reports... was split and drawn twice. The pixel mode reportsfailed on another refusal: ... a shader that writes guest memory (stores, atomics or GDS) under late tests cannot use.agc_driver_late_test_merge_splitstill passes.This matches the control results in the description. I restored the file afterwards.
Findings
Blocking
The branch conflicts with
main. A merge of976fc9c3e5intob433c40f2fstops with content conflicts in:core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/shader/recompiler/tests/RequestSerializerTests.cppdocs/dev/debt/libSceAgcDriver.mdMost of these come from #9020's part of the branch.
mainhas since bumped the request serializer to version 49 (RequestSerializer.cpp:864onmain) with depth-export min/max fields. It has also bumped the pipeline journal toFileFormat = 12u(PipelineJournal.cpp:50), and it guardssizeof(State) == 912andsizeof(ShaderStages) == 160. The branch still writes version 47 and format 11, with sizes 848 and 112. The debt conflict is two new entries inserted at the same place, and both need to stay. The "Based on currentmain" box and the earlier "merges cleanly withmain504ea3b53" no longer hold. The PR already has theneeds rebaselabel.Suggested fix: once #9020 is rebased, merge its head again. The
TargetMergefields then need a serializer version above 49 and a journal format above 12, theState/ShaderStagessize guards need the merged sizes, and both debt entries need to be kept. Then rerun the focused tests.Non-blocking
The split mask goes from
draw()todrawLateTestMergeSplit()through aDrivermember.draw()stores it inlateTestSplitTargets(Draw.cpp#L539-L544, member atDriver.hpp:404). The caller inPacketExecution.cpp:475then reads it withstd::exchangeindrawLateTestMergeSplit(Draw.cpp:126).Driver::executeruns on one worker thread per queue (QueueWorker.cpp:267). If two queues can reachdraw()at the same time, this plain field is a data race, and one queue could split with the other's target bits. I did not confirm that two graphics queues draw concurrently. Returning the mask with the verdict, or as an out parameter ofdraw(), would remove the shared state at no cost. The member also sits between the dispatch-cache counters, which does not help readability.A depth-clear draw would reach the merge-pass
requireafter the depth pass has drawn. I found this by reading the code and did not run it. WithDB_RENDER_CONTROLDEPTH_CLEAR_ENABLE,DecodeStateforcesdepthWrite = trueandZFUNCALWAYS (State.cpp#L492-L497). The merge pass'sZ_WRITE_ENABLE = 0/ EQUAL patch then has no effect,LateTestMergeSplitTargetsreturns the targets again, andDraw.cpp:146throwsthe merge pass ... still writes depth or stencilafter the depth pass has already been recorded. Such a draw (depth clear plus a kill plus a packed merge) is unusual, and it does throw rather than draw wrongly. Still, excluding a depth clear inLateTestMergeSplitTargets(State.cpp#L1861-L1872) would make it throw the existing refusal before anything is drawn. The same goes for any other state the patchedDB_DEPTH_CONTROLcannot override.Test coverage gap.
LateTestMergeSplit.cppalways binds the merged target alone, in slot 0 (CB_TARGET_MASK0xf). No test draws a second, unmerged color target next to it, where the depth pass must write that target and the merge pass must leave it alone. The slot-1 case intests/Graphics.cppchecks only the returned mask, not a draw. An execution case with two targets would cover themask & ~targets/mask & targetspatching end to end.Not verified
mainunder the validation layer. I did not rebuild and runmainwithin the time budget, so the "no newVUID-errors" comparison rests on the PR head alone. It logged noVUID-lines.main's submodule commits.Driver::drawconcurrently (non-blocking finding 1).APS5_DRAW_PIPELINE=1runs.To get this to a good state
main. Resolve the 7 conflicts with new serializer and journal versions and updated size guards, keep both debt entries, and update "Based on currentmain" and the Tested section with the new heads.Drivermember, exclude a depth clear inLateTestMergeSplitTargets, and add a two-target execution case.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T20:05:07Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change based on the code reviewed; the split eligibility checks and register restoration align with the documented limitations.
What I ran
Reviewed head
b6e35a0d5fdad8ee80bccaabdd751fb5c1447db7usingrepo_read.py. No commands or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Did not run the build or tests. Did not read the full text of
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, which was excluded from the review folder due to size; inspected the relevant changed hunk inreview/diff.patch. The code reviewed wasDrawCache.hpp,Driver.hpp,Draw.cpp,DrawPrecheck.cpp,PacketExecution.cpp,State.hpp,State.cpp,agc_driver_late_test_merge_split_tests.cmake, andLateTestMergeSplit.cpp. Also readdescription.md,commits.md,manifest.json, anddiff.patch. The remaining changed documentation files were not read in full; their additions were inspected in the diff.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T05:34:32Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
c26a94d46c3808a5538f7c7b65e87c32035bcc06, basemain. No merged-preview check was run.diff.patch) and the three house-rule sections.tests/Graphics.cppis marked too large for the review folder, so only its changed hunk was read.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp:579decides the split without looking at what the pixel shader exports. The recompiler refuses any merge whose shader exports depth, stencil or a sample mask, whatever the kill or depth write (SpirvModuleSetup.cpp:532).KILL_ENABLE,GEQUALwith depth writes, and a partial 4_4_4_4 write. The depth pass draws and writes depth, then the merge pass throws. Before this change the draw was refused before any pass ran.Draw.cpp:578dereferencesprogram.snapshotdirectly, whileDraw.cpp:307checks it first. Decoding dereferences it too (DrawDecode.cpp:114-115), so the path looks non-null. Matching the guarded form costs nothing.docs/dev/debt/shader.md:43now names only stencil writes as the kill-under-late-tests refusal. An unsplit draw that writes depth still throws it, because the check at SpirvModuleSetup.cpp:532 usesmergeDepthStencilWrites, which is set from depth or stencil writes. ThelibSceAgcDriver.mdentry names only some of those cases (memory writes, depth clear, two targets). A pointer fromshader.mdto that entry would fix it.core/libs/prx/libSceAgcDriver/tests/execution/LateTestMergeSplit.cpp:74: the condition on the tailmunmapis always true, becausealignedis always belowbegin + BlockBytes. The call can run unconditionally.Sources
Not verified
tests/Graphics.cpp: only the changed hunk was read; its full text at head was not read.main: not run.To get this to a good state
Nothing is required. The non-blocking points above are optional.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T04:06:52Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this review; the checks and full-file coverage needed for approval were not available.
What I ran
Reviewed head
704f9bfa52373550a2fa0503d96194c8201b4672using the prepared review materials andrepo_read.py. No tests or build commands were run.Results
Negative control
Not run during this review. The description reports author-run control cases; those results were not independently reproduced.
Findings
Blocking
None verified.
Non-blocking
None.
Sources
Reviewed the prepared diff and relevant code at the pinned head. No external links are included because no repository permalink was available through the reader.
Not verified
The full text of the 490-line
LateTestMergeSplit.cppandGraphics.cppwas not read; only relevant ranges were inspected.Graphics.cppwas excluded from the prepared review folder because it was too large. The two changed documentation files were read at their beginnings, not at their changed lines. No tests, build, physical-console behavior, or author-reported results were independently verified.To get this to a good state
Nothing is required. Optional: inspect the remaining changed lines and run the focused split tests before treating this review as approval-ready.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T05:08:41Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the split conditions, register restoration, and tests I read support the documented behavior.
What I ran
Reviewed head
ad5b0835d178267c57433a46af8e23193d5a27b6. I usedrepo_read.pyto inspect the prepared diff and source at the pinned head. No build or tests were run; the test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No build, test, or console behavior was run or confirmed in this review. I read all changed files except
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp; its added lines were inspected at the pinned head. The reviewed files list marks every other changed file as included, and that file as excluded because it was too large for the review folder.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T05:17:20Z.
Review: COMMENTED
Actionable comments posted: 3
c7d6bbd3-ce2a-4a79-b9c0-3539da3bfaccReviewing files that changed from the base of the PR and between
e0ef70639dandad5b0835d1.core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hppcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_late_test_merge_split_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/LateTestMergeSplit.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T06:55:01Z.
Review: COMMENTED
Actionable comments posted: 1
5828bb66-2910-48a4-a3ce-0acfccbaf7c4Reviewing files that changed from the base of the PR and between
ad5b0835d1andf8a53dc5d1.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_late_test_merge_split_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/LateTestMergeSplit.cppdocs/dev/debt/changes/late-kill-merge.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T07:11:19Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change based on the source inspected; approval is not justified because the full Graphics.cpp change and execution-test implementation were not completely read, and no checks were run.
What I ran
Reviewed head
f8a53dc5d1bcfe6f59814cd7d248c51bb912f037using the prepared review bundle andrepo_read.pysource reader. No tests or builds were run.Results
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Not verified
The full
core/libs/prx/libSceAgcDriver/tests/Graphics.cppfile was excluded from the bundle; only the changed hunk was read. The 531-linecore/libs/prx/libSceAgcDriver/tests/execution/LateTestMergeSplit.cppwas not fully read. No tests or build were run. Other source files in the prepared bundle were not fully read; the review covered the change description, commits, diff, relevant split selection and draw paths, and selected test code. The description's reported test results were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T17:08:28Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes at
5889dfff9589d78d45e15eca4954ba886de57d80address late-test packed-target merges with guarded depth and merge passes; no blocking defect was verified in the inspected code.What I ran
No build or tests were run in this review. The test runs described in
description.mdare author-reported.Results
Graphics.cppfull text was excluded; its diff and changed lines were readFindings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
No build, test, validation-layer run, or console behavior was performed or confirmed by this review. Full file text for
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas excluded from the review bundle; its changed hunk was read from the diff and its changed lines from the pinned-head reader. The other changed files were read at the changed lines and relevant context, including the full new execution test and test CMake file. No unchanged files were read.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T22:45:09Z.
Review: APPROVED
Reviewed — looks good
The split path and its refusal conditions are represented in the code and focused tests at head
01d6097802f9eb804121f0b12e38be55349b095f; this review did not run tests, so the author-reported runs are not independently verified.What I ran
Read the prepared description, commit list, diff, manifest, all included changed files, and the excluded
Graphics.cppadditions throughrepo_read.py. I also read the touched decode, draw dispatch, and precheck context at the pinned head. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas excluded from the prepared bundle as too large; its relevant added lines were read throughrepo_read.py. No build, test, validation-layer run, or physical-console behavior was independently verified. Other repository files not needed for the touched paths were not read.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T22:49:36Z.
Review: COMMENTED
Architecture findings (1)
Advisory architecture findings (1)
92681514-5238-4f3c-8b14-8d7c8c3e5fcaReviewing files that changed from the base of the PR and between
5889dfff95and01d6097802.core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_late_test_merge_split_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/LateTestMergeSplit.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T00:20:31Z.
Review: COMMENTED
Architecture findings (1)
Advisory architecture findings (1)
7f1276d4-36ae-4063-b98b-5becdfc2a877Reviewing files that changed from the base of the PR and between
01d6097802and62f116beb2.core/libs/prx/libSceAgcDriver/Execution/include/Driver/Diagnostics.hppcore/libs/prx/libSceAgcDriver/Execution/include/QueueState.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Diagnostics.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_late_test_merge_split_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/LateTestMergeSplit.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T00:22:32Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed code and supplied test report support merging.
What I ran
62f116beb2149c812e23fa6fa1c7363742519427; base ismain. No commands or tests were run in this read-only review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas read at its changed range; its full text was excluded from the bundle for size.To get this to a good state
Nothing is required.