feat(agc): blend into 11_11_10 float color targets in the pixel shader #9020

Merged
frankea merged 24 commits from upstream-pr/9020 into main 2026-11-07 11:49:52 +00:00
frankea commented 2026-10-21 09:55:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-21T09:55:50Z.


What

A blended or partial write into a one-sample 11_11_10 float color target used to throw (AGC graphics: blending into an 11_11_10 float color target is unsupported). No host format holds this target's bits (red in 31..21, blue in 9..0, the mirror of B10G11R11), so it renders as R32_UINT and fixed-function blending can't apply. This PR blends in the pixel shader instead, through the pixel-interlock merge that JAB-dev's #8564 adds for partial 4_4_4_4 writes. The merge mechanism is theirs; this PR adds blending to it and opens it to mips and 2D array slices.

#8564 and #8563 are in main since dcd7e3a61, and this branch merges main 3bd88ca119. The changes of this PR are its two commits, 9a7a202bf (the blend) and 6f240cbfa (mips and array slices), plus the resolution of the merge commits, which number this PR's serializer fields after #8564's: github.com/frankea/[email protected]

  • DecodeState turns a blended or partial write into a one-sample 11_11_10 float target into a merge. TargetMerge carries the target's packing and the color equation of CB_BLEND_CONTROL, and its mask is 32 bits wide; ColorTarget.partialWriteMask is 32 bits as well, next to a new mergeBlend. With #12916 in main a draw carries one TargetMerge per merged target, and these fields sit on each entry; a packed merge still merges alone, so an 11_11_10 blend or partial write next to another merged target throws, as a 4_4_4_4 partial write does.
  • The pixel shader unpacks the stored word, evaluates the equation in fp32 and packs the result with the same toward-zero conversion the export path uses, then applies the write mask. The target has no alpha, so destination alpha is 1. MIN and MAX ignore the factors, and a ZERO or ONE factor never multiplies, so an infinite operand doesn't turn into NaN.
  • Mips and 2D array slices: TargetMergeSurface describes the resident image of the whole array (ArraySurfaceForTarget, moved from Draw.cpp to State.cpp and shared) at the drawn mip, so the merge's storage image is the same image the target renders into. EncodeTextureResource encodes a mip range and 2D arrays, and the shader addresses the view's first slice plus gl_Layer, clamped to the view's last slice as the console clamps the render target index to SLICE_MAX, so a guest layer index past the view never reaches outside the image. This applies to one-sample 4_4_4_4 merges too.
  • Still throw: constant color and dual-source factors, multisampled 11_11_10 targets, volume targets, multisampled mips or arrays, and devices without fragmentShaderPixelInterlock. The refusal now names the target's shape.
  • Formats: request serializer 55. main reads #8564's merge record from 46 (target, mask, samples, descriptor and the two depth and stencil flags), #11684's target blend from 46 as well (bit 16 of the mask word, then its fields after the two flags), #12916's further merges (their count in bits 17-19 of the first record's mask word, then one record each), its depth export bounds from 49, and target flags at the end of the stream from 51 to 54; it rejects 50. At 55 this PR writes each record's mask as a full 32-bit word and, after the two flags, a flag byte that holds what the 46-54 word kept above its mask (bit 0 the blend, bits 1-3 the number of further merges, on the first record), then #11684's blend fields when it is set, then this PR's packing, blend control, layered flag and the view's first and last slice; the depth export bounds follow the last record. A version 46 to 54 record (as main writes it) takes the flags from the upper half of its mask word, keeps the 16-bit mask limit, and without a blend reads a merge as a one-slice 4_4_4_4 merge without blending. request_serializer and agc_shader_memory read version 51, 53 and 54 streams as main writes them. Shader disk cache 57 (main is at 56; #10049 takes 58; this branch's cache key adds the merge's packing, blend and slice fields). Pipeline journal 16 with sizeof(State) 944 (main is at 15 and 936; #8564's 16-bit partialWriteMask becomes 32 bits and mergeBlend follows it).
  • With #11684 (oneandonlydean, merged into main on 10/29): its blend into an unclamped normalized target uses the same merge with a float storage image and a stored texel, and this PR's packed merges keep the uint image and the stored word; MergeColorTarget takes #11684's path first when its blend is set. ShaderInputInfoBuilder accepts a merge without packing only when it carries #11684's blend. TargetMergeSurface now gives every merge, #11684's included, the drawn mip and, for a 2D array view, the array's image with the view's slices; the 11_11_10 debt entry says so. #11684's UnclampedBlendMask (0xffff) stays unambiguous with the 32-bit mask: a 4_4_4_4 merge with all four nibbles is a full write and never merges, and no 11_11_10 field mask gives 0xffff.
  • With main's ONE/ZERO/ADD rule (such a color equation into a packed target is a plain write) the merge only takes other equations, and with main's staged multisampled 4_4_4_4 partial writes (StagedMerge.cpp) a multisampled 4_4_4_4 partial write still takes that path; 11_11_10 merges stay one-sample.

Tested

  • After merging main 3cb1cd29ec and 3bd88ca119 (head 4ba1676e00), Apple M5 Max (macOS 27.0.1, x86-64 under Rosetta 2, MoltenVK 1.4.2 from Vulkan SDK 1.4.363.0), each test run three times: request_serializer, agc_shader_memory, agc_driver_graphics, agc_driver_packed_float_blend, agc_driver_packed_float_color_target, agc_driver_packed_unorm4444_color_target and agc_driver_packed_unorm4444_partial_write pass 7/7, and agc_driver_packed_unorm4444_multisample_partial_write skips (no multisampled storage images on MoltenVK). main no longer builds libkernel on macOS (pthread_getattr_np, pthread_getcpuclockid, the Linux signal context, sched_getcpu, RUSAGE_THREAD, environ), so these builds carry a local, uncommitted macOS patch for those calls. The RTX 4090 runs below predate this merge; I will repeat them on it.
  • After merging main ee9a9a66c (head aa1d45243; #12916's multi-target merges, see the comments), RTX 4090 (NVIDIA 616.92, Windows 11), each test run three times: the 75 ctest entries of the same 14 targets 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): 115 Insert instance layer lines, no VUID- line, 39 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings (in the tests main also runs, the counts main shows; 10 in agc_driver_packed_float_blend). main ee9a9a66c passes a 236-entry set holding all of these but agc_driver_packed_float_blend in both runs, with no VUID- line. The shader memory test now also checks one and two merges at serializer versions 49 and 50. Not run on Linux.
  • After merging main bb04a4f1e (head 237ede9d9; see the comments for the renumbering and #11684), RTX 4090, each test run three times: the 72 ctest entries of 14 targets (request_serializer, agc_shader_memory, agc_shader_disk_cache, agc_driver_pipeline_journal, agc_driver_graphics, agc_driver_key_miss, agc_driver_unclamped_normalized_blend, agc_driver_depth_export_clamp, agc_driver_layered_array_color_draw, agc_driver_packed_float_blend, agc_driver_packed_float_color_target, agc_driver_packed_unorm4444_color_target, agc_driver_packed_unorm4444_partial_write, agc_driver_packed_unorm4444_multisample_partial_write) pass 72/72, and 72/72 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): 115 Insert instance layer lines, no VUID- line, no was not found but was requested by env var VK_INSTANCE_LAYERS, 39 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings. main bb04a4f1e passes its 71 entries (no agc_driver_packed_float_blend) in both runs: 110 Insert instance layer lines, no VUID- line, 29 of those warnings. sizeof(State): a macOS probe gives 920 for main (its Linux guard) and 928 for this head (the new guard). Not run on Linux.
  • tests/execution/PackedFloatBlend.cpp (new) against a CPU reference, bit for bit on every pixel: 11 equations, a blended and a plain partial write, a back-to-back chain, two same-draw overdraws of 16 alternating layers, and three array merges (mip 0 of all six slices of a 128x128 array of 8 mips, one layer per slice, the shape Gran Turismo 7 renders; mip 1 of slices 1 to 3 of a 256x256 array; one slice drawn without a layer export).
  • RTX 4090 (NVIDIA 616.92, Windows 11, WinLibs GCC 15.2), head 599060108: agc_driver_packed_float_blend, agc_driver_packed_unorm4444_partial_write, agc_driver_packed_unorm4444_multisample_partial_write, agc_driver_packed_float_color_target, agc_driver_layered_array_color_draw, agc_driver_graphics and agc_shader_memory pass.
  • Linux x86-64 (Docker, emulated on an Apple-silicon Mac): the 35 tests of request_serializer, agc_shader_disk_cache, agc_shader_memory, agc_shader_control_flow, agc_driver_bda_device, agc_shader_replay_requests, agc_driver_graphics, agc_pipeline_journal and agc_driver_prepared_shaders pass.
  • After the main merges, head e554d27c3 on the RTX 4090: agc_shader_memory, agc_driver_graphics, agc_driver_layered_array_color_draw, agc_driver_packed_float_blend, agc_driver_packed_float_color_target, agc_driver_packed_unorm4444_partial_write and agc_driver_packed_unorm4444_multisample_partial_write pass. The same 35 Linux tests pass on 374556c0f, the main merge before it.
  • After merging main 7e69be679 (head 4fad5fd36) on the RTX 4090: the 49 ctest entries of agc_driver_graphics_tests, agc_shader_memory_tests, agc_driver_pipeline_journal_tests, agc_driver_packed_float_blend_tests, agc_driver_packed_float_color_target_tests, agc_driver_packed_unorm4444_partial_write_tests, agc_driver_packed_unorm4444_multisample_partial_write_tests and agc_driver_layered_array_color_draw_tests pass 49/49, 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=1 and ANYPS5_REQUIRE_VULKAN=1 with ctest -V, on main 83462cc57 (7e69be679 plus eight commits to tools/ only) (46/46: main lacks the float blend and both 4_4_4_4 partial-write tests) and on this head (49/49). Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has a VUID- line. The layer's only messages on this head are Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings from the merge tests, where the merged target has no color attachment and the fragment output goes unused: 10 in agc_driver_packed_float_blend, 10 in agc_driver_packed_unorm4444_partial_write and 9 in agc_driver_packed_unorm4444_multisample_partial_write. main logs no validation message in its 46.
  • After merging #8564's head d201de3f3 and main 2259f0530 (head 634b3dc78) on the RTX 4090: the 56 ctest entries of agc_driver_graphics_tests, agc_shader_memory_tests, agc_driver_pipeline_journal_tests, agc_driver_packed_float_blend_tests, agc_driver_packed_float_color_target_tests, agc_driver_packed_unorm4444_partial_write_tests, agc_driver_packed_unorm4444_multisample_partial_write_tests, agc_driver_packed_unorm4444_color_target_tests, agc_driver_layered_array_color_draw_tests, request_serializer_tests, agc_shader_disk_cache_tests and agc_driver_key_miss_tests pass 56/56, each test run three times. Under the validation layer, with the settings above: this head 56/56 and main 9d6adeb55 54/54 (main lacks the float blend test and #8564's three); no VUID- line in either log, and this head's only messages are the same 29 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings.
  • After merging main 0db47b263 (head a51e479d9; the only conflict was the disk cache format), RTX 4090: the same 56 ctest entries pass 56/56, each test run three times, and 56/56 under the validation layer with no VUID- line (the same 29 warnings); main 0db47b263 54/54 and 54/54 under the layer, no VUID- line.
  • After merging #8564's head 3a6688415 (which takes disk cache format 46 and merges main) and main 513ca7e55 (head 6806092c4; no textual conflicts, and the disk cache format moves to 47), RTX 4090: the same 56 ctest entries pass 56/56, each test run three times, and 56/56 under the validation layer with no VUID- line (the same 29 warnings). The head also merges cleanly with main 58ceeb8ed.
  • After merging main 379b1dca3 (head 5e0455020), which has #8564's final head: this PR's serializer fields move to version 47 and the disk cache stays at 47 over main's 46; the journal is 10 and sizeof(State) 832 over main's 9 and 824. request_serializer and agc_shader_memory now also check that a version 47 record carries the packing, blend control and slice bytes, that a version 46 record with a merge reads as 4_4_4_4 without blending, and that a version 46 record whose mask is wider than 16 bits is refused. RTX 4090: the 59 ctest entries of the same targets (main added three since the last run) pass 59/59, each test run three times, and 59/59 under the validation layer with no VUID- line (the same 29 warnings). Built with Apple clang on macOS, main's RequestSerializerTests.cpp aborts against this head's serializer (it expects version 46), and this head's passes. The head also merges cleanly with main 9c85790c9.
  • After merging main 732ab06f4 (a657def72): the only conflict was the journal's sizeof(State) guard, now 848. main had meanwhile moved the pipeline journal to format 10 and the shader disk cache to 47 for its own changes, the numbers this PR used, so the merge kept both lines without a conflict. 5f7287406 moves them to 11 and 49. The request serializer stays at 47; main's is still 46. RTX 4090, head 5f7287406: the 65 ctest entries of the same targets (main added six since the last run) pass 65/65, each test run three times, and 65/65 under the validation layer with no VUID- line (the same 29 warnings). main 3af09d95e, on the targets it has plus agc_driver_sample_mask_draw_tests and agc_driver_stencil_known_replace_tests: 66/66, three times each, and 66/66 under the layer with no VUID- line (19 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings, from its own two 4_4_4_4 partial-write tests). The head also merges cleanly with main 504ea3b53, whose newer commits change no AGC code.
  • @Celegans12 ran the same comparison for #9748 on an RTX 3080 Laptop (driver 610.62), with this PR's previous head aab4fb4a5 among the trees: no VUID- errors. The layer's one message there is Undefined-Value-ShaderOutputNotConsumed-DynamicRendering, 10 per merge test, because the merged target has no color attachment and the fragment output goes unused.
  • sizeof(State) is 848 on Linux x86-64 after the latest merge: main's 840 plus a 32-bit partialWriteMask and mergeBlend (#8564's 16-bit mask keeps main's size). A probe built on macOS gives the Linux guards' values for main 732ab06f4 (840) and this PR's previous head 5e0455020 (832), and 848 for this head. Not built on Linux since the merge.
  • Gran Turismo 7 (PPSA01317) on the RTX 4090, with an earlier state of these commits (before the main merge and the layer clamp) and #7978, #7243, #7256 and #7550 merged locally: past the 11_11_10 blend stop and the cube-map target, the main menu at 4.4 FPS. With scripted input it goes on to the World Map, the Used Cars dealer and a car purchase, then stops in the car delivery scene on color targets with fewer fragments than samples (EQAA) are unsupported, which this PR doesn't touch.

Checklist

  • Based on current main; no other open PR implements the same functions (the ONE/ZERO/ADD case is left to #7243)
  • 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 (#8564 and #8563 are in main). #10049 (mine) takes shader disk cache format 58 and this PR 57, so if both land, the second one's version line conflicts instead of merging silently. #9335 (mine) is stacked on this PR.
  • Fixes: none
  • Unblocks: PPSA01317 #4697
  • GPUs tested: NVIDIA GeForce RTX 4090, driver 616.92, Windows 11
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4949720121 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9020). Originally posted by [frankea](https://github.com/frankea) on 2026-10-21T09:55:50Z. --- ### What A blended or partial write into a one-sample 11_11_10 float color target used to throw (`AGC graphics: blending into an 11_11_10 float color target is unsupported`). No host format holds this target's bits (red in 31..21, blue in 9..0, the mirror of `B10G11R11`), so it renders as R32_UINT and fixed-function blending can't apply. This PR blends in the pixel shader instead, through the pixel-interlock merge that JAB-dev's #8564 adds for partial 4_4_4_4 writes. The merge mechanism is theirs; this PR adds blending to it and opens it to mips and 2D array slices. #8564 and #8563 are in `main` since dcd7e3a61, and this branch merges `main` 3bd88ca119. The changes of this PR are its two commits, 9a7a202bf (the blend) and 6f240cbfa (mips and array slices), plus the resolution of the merge commits, which number this PR's serializer fields after #8564's: https://github.com/frankea/AnyPS5/compare/f5edd537e...6f240cbfa - `DecodeState` turns a blended or partial write into a one-sample 11_11_10 float target into a merge. `TargetMerge` carries the target's packing and the color equation of `CB_BLEND_CONTROL`, and its mask is 32 bits wide; `ColorTarget.partialWriteMask` is 32 bits as well, next to a new `mergeBlend`. With #12916 in `main` a draw carries one `TargetMerge` per merged target, and these fields sit on each entry; a packed merge still merges alone, so an 11_11_10 blend or partial write next to another merged target throws, as a 4_4_4_4 partial write does. - The pixel shader unpacks the stored word, evaluates the equation in fp32 and packs the result with the same toward-zero conversion the export path uses, then applies the write mask. The target has no alpha, so destination alpha is 1. MIN and MAX ignore the factors, and a ZERO or ONE factor never multiplies, so an infinite operand doesn't turn into NaN. - Mips and 2D array slices: `TargetMergeSurface` describes the resident image of the whole array (`ArraySurfaceForTarget`, moved from `Draw.cpp` to `State.cpp` and shared) at the drawn mip, so the merge's storage image is the same image the target renders into. `EncodeTextureResource` encodes a mip range and 2D arrays, and the shader addresses the view's first slice plus `gl_Layer`, clamped to the view's last slice as the console clamps the render target index to `SLICE_MAX`, so a guest layer index past the view never reaches outside the image. This applies to one-sample 4_4_4_4 merges too. - Still throw: constant color and dual-source factors, multisampled 11_11_10 targets, volume targets, multisampled mips or arrays, and devices without `fragmentShaderPixelInterlock`. The refusal now names the target's shape. - Formats: request serializer 55. `main` reads #8564's merge record from 46 (target, mask, samples, descriptor and the two depth and stencil flags), #11684's target blend from 46 as well (bit 16 of the mask word, then its fields after the two flags), #12916's further merges (their count in bits 17-19 of the first record's mask word, then one record each), its depth export bounds from 49, and target flags at the end of the stream from 51 to 54; it rejects 50. At 55 this PR writes each record's mask as a full 32-bit word and, after the two flags, a flag byte that holds what the 46-54 word kept above its mask (bit 0 the blend, bits 1-3 the number of further merges, on the first record), then #11684's blend fields when it is set, then this PR's packing, blend control, layered flag and the view's first and last slice; the depth export bounds follow the last record. A version 46 to 54 record (as `main` writes it) takes the flags from the upper half of its mask word, keeps the 16-bit mask limit, and without a blend reads a merge as a one-slice 4_4_4_4 merge without blending. `request_serializer` and `agc_shader_memory` read version 51, 53 and 54 streams as `main` writes them. Shader disk cache 57 (`main` is at 56; #10049 takes 58; this branch's cache key adds the merge's packing, blend and slice fields). Pipeline journal 16 with `sizeof(State)` 944 (`main` is at 15 and 936; #8564's 16-bit `partialWriteMask` becomes 32 bits and `mergeBlend` follows it). - With #11684 (oneandonlydean, merged into `main` on 10/29): its blend into an unclamped normalized target uses the same merge with a float storage image and a stored texel, and this PR's packed merges keep the uint image and the stored word; `MergeColorTarget` takes #11684's path first when its blend is set. `ShaderInputInfoBuilder` accepts a merge without packing only when it carries #11684's blend. `TargetMergeSurface` now gives every merge, #11684's included, the drawn mip and, for a 2D array view, the array's image with the view's slices; the 11_11_10 debt entry says so. #11684's `UnclampedBlendMask` (0xffff) stays unambiguous with the 32-bit mask: a 4_4_4_4 merge with all four nibbles is a full write and never merges, and no 11_11_10 field mask gives 0xffff. - With `main`'s ONE/ZERO/ADD rule (such a color equation into a packed target is a plain write) the merge only takes other equations, and with `main`'s staged multisampled 4_4_4_4 partial writes (`StagedMerge.cpp`) a multisampled 4_4_4_4 partial write still takes that path; 11_11_10 merges stay one-sample. ### Tested - After merging `main` 3cb1cd29ec and 3bd88ca119 (head 4ba1676e00), Apple M5 Max (macOS 27.0.1, x86-64 under Rosetta 2, MoltenVK 1.4.2 from Vulkan SDK 1.4.363.0), each test run three times: `request_serializer`, `agc_shader_memory`, `agc_driver_graphics`, `agc_driver_packed_float_blend`, `agc_driver_packed_float_color_target`, `agc_driver_packed_unorm4444_color_target` and `agc_driver_packed_unorm4444_partial_write` pass 7/7, and `agc_driver_packed_unorm4444_multisample_partial_write` skips (no multisampled storage images on MoltenVK). `main` no longer builds `libkernel` on macOS (`pthread_getattr_np`, `pthread_getcpuclockid`, the Linux signal context, `sched_getcpu`, `RUSAGE_THREAD`, `environ`), so these builds carry a local, uncommitted macOS patch for those calls. The RTX 4090 runs below predate this merge; I will repeat them on it. - After merging `main` ee9a9a66c (head aa1d45243; #12916's multi-target merges, see the comments), RTX 4090 (NVIDIA 616.92, Windows 11), each test run three times: the 75 ctest entries of the same 14 targets 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`): 115 `Insert instance layer` lines, no `VUID-` line, 39 `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings (in the tests `main` also runs, the counts `main` shows; 10 in `agc_driver_packed_float_blend`). `main` ee9a9a66c passes a 236-entry set holding all of these but `agc_driver_packed_float_blend` in both runs, with no `VUID-` line. The shader memory test now also checks one and two merges at serializer versions 49 and 50. Not run on Linux. - After merging `main` bb04a4f1e (head 237ede9d9; see the comments for the renumbering and #11684), RTX 4090, each test run three times: the 72 ctest entries of 14 targets (`request_serializer`, `agc_shader_memory`, `agc_shader_disk_cache`, `agc_driver_pipeline_journal`, `agc_driver_graphics`, `agc_driver_key_miss`, `agc_driver_unclamped_normalized_blend`, `agc_driver_depth_export_clamp`, `agc_driver_layered_array_color_draw`, `agc_driver_packed_float_blend`, `agc_driver_packed_float_color_target`, `agc_driver_packed_unorm4444_color_target`, `agc_driver_packed_unorm4444_partial_write`, `agc_driver_packed_unorm4444_multisample_partial_write`) pass 72/72, and 72/72 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`): 115 `Insert instance layer` lines, no `VUID-` line, no `was not found but was requested by env var VK_INSTANCE_LAYERS`, 39 `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings. `main` bb04a4f1e passes its 71 entries (no `agc_driver_packed_float_blend`) in both runs: 110 `Insert instance layer` lines, no `VUID-` line, 29 of those warnings. `sizeof(State)`: a macOS probe gives 920 for `main` (its Linux guard) and 928 for this head (the new guard). Not run on Linux. - `tests/execution/PackedFloatBlend.cpp` (new) against a CPU reference, bit for bit on every pixel: 11 equations, a blended and a plain partial write, a back-to-back chain, two same-draw overdraws of 16 alternating layers, and three array merges (mip 0 of all six slices of a 128x128 array of 8 mips, one layer per slice, the shape Gran Turismo 7 renders; mip 1 of slices 1 to 3 of a 256x256 array; one slice drawn without a layer export). - RTX 4090 (NVIDIA 616.92, Windows 11, WinLibs GCC 15.2), head 599060108: `agc_driver_packed_float_blend`, `agc_driver_packed_unorm4444_partial_write`, `agc_driver_packed_unorm4444_multisample_partial_write`, `agc_driver_packed_float_color_target`, `agc_driver_layered_array_color_draw`, `agc_driver_graphics` and `agc_shader_memory` pass. - Linux x86-64 (Docker, emulated on an Apple-silicon Mac): the 35 tests of `request_serializer`, `agc_shader_disk_cache`, `agc_shader_memory`, `agc_shader_control_flow`, `agc_driver_bda_device`, `agc_shader_replay_requests`, `agc_driver_graphics`, `agc_pipeline_journal` and `agc_driver_prepared_shaders` pass. - After the `main` merges, head e554d27c3 on the RTX 4090: `agc_shader_memory`, `agc_driver_graphics`, `agc_driver_layered_array_color_draw`, `agc_driver_packed_float_blend`, `agc_driver_packed_float_color_target`, `agc_driver_packed_unorm4444_partial_write` and `agc_driver_packed_unorm4444_multisample_partial_write` pass. The same 35 Linux tests pass on 374556c0f, the `main` merge before it. - After merging `main` 7e69be679 (head 4fad5fd36) on the RTX 4090: the 49 ctest entries of `agc_driver_graphics_tests`, `agc_shader_memory_tests`, `agc_driver_pipeline_journal_tests`, `agc_driver_packed_float_blend_tests`, `agc_driver_packed_float_color_target_tests`, `agc_driver_packed_unorm4444_partial_write_tests`, `agc_driver_packed_unorm4444_multisample_partial_write_tests` and `agc_driver_layered_array_color_draw_tests` pass 49/49, 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=1` and `ANYPS5_REQUIRE_VULKAN=1` with `ctest -V`, on `main` 83462cc57 (7e69be679 plus eight commits to `tools/` only) (46/46: `main` lacks the float blend and both 4_4_4_4 partial-write tests) and on this head (49/49). Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither has a `VUID-` line. The layer's only messages on this head are `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings from the merge tests, where the merged target has no color attachment and the fragment output goes unused: 10 in `agc_driver_packed_float_blend`, 10 in `agc_driver_packed_unorm4444_partial_write` and 9 in `agc_driver_packed_unorm4444_multisample_partial_write`. `main` logs no validation message in its 46. - After merging #8564's head d201de3f3 and `main` 2259f0530 (head 634b3dc78) on the RTX 4090: the 56 ctest entries of `agc_driver_graphics_tests`, `agc_shader_memory_tests`, `agc_driver_pipeline_journal_tests`, `agc_driver_packed_float_blend_tests`, `agc_driver_packed_float_color_target_tests`, `agc_driver_packed_unorm4444_partial_write_tests`, `agc_driver_packed_unorm4444_multisample_partial_write_tests`, `agc_driver_packed_unorm4444_color_target_tests`, `agc_driver_layered_array_color_draw_tests`, `request_serializer_tests`, `agc_shader_disk_cache_tests` and `agc_driver_key_miss_tests` pass 56/56, each test run three times. Under the validation layer, with the settings above: this head 56/56 and `main` 9d6adeb55 54/54 (`main` lacks the float blend test and #8564's three); no `VUID-` line in either log, and this head's only messages are the same 29 `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings. - After merging `main` 0db47b263 (head a51e479d9; the only conflict was the disk cache format), RTX 4090: the same 56 ctest entries pass 56/56, each test run three times, and 56/56 under the validation layer with no `VUID-` line (the same 29 warnings); `main` 0db47b263 54/54 and 54/54 under the layer, no `VUID-` line. - After merging #8564's head 3a6688415 (which takes disk cache format 46 and merges `main`) and `main` 513ca7e55 (head 6806092c4; no textual conflicts, and the disk cache format moves to 47), RTX 4090: the same 56 ctest entries pass 56/56, each test run three times, and 56/56 under the validation layer with no `VUID-` line (the same 29 warnings). The head also merges cleanly with `main` 58ceeb8ed. - After merging `main` 379b1dca3 (head 5e0455020), which has #8564's final head: this PR's serializer fields move to version 47 and the disk cache stays at 47 over `main`'s 46; the journal is 10 and `sizeof(State)` 832 over `main`'s 9 and 824. `request_serializer` and `agc_shader_memory` now also check that a version 47 record carries the packing, blend control and slice bytes, that a version 46 record with a merge reads as 4_4_4_4 without blending, and that a version 46 record whose mask is wider than 16 bits is refused. RTX 4090: the 59 ctest entries of the same targets (`main` added three since the last run) pass 59/59, each test run three times, and 59/59 under the validation layer with no `VUID-` line (the same 29 warnings). Built with Apple clang on macOS, `main`'s `RequestSerializerTests.cpp` aborts against this head's serializer (it expects version 46), and this head's passes. The head also merges cleanly with `main` 9c85790c9. - After merging `main` 732ab06f4 (a657def72): the only conflict was the journal's `sizeof(State)` guard, now 848. `main` had meanwhile moved the pipeline journal to format 10 and the shader disk cache to 47 for its own changes, the numbers this PR used, so the merge kept both lines without a conflict. 5f7287406 moves them to 11 and 49. The request serializer stays at 47; `main`'s is still 46. RTX 4090, head 5f7287406: the 65 ctest entries of the same targets (`main` added six since the last run) pass 65/65, each test run three times, and 65/65 under the validation layer with no `VUID-` line (the same 29 warnings). `main` 3af09d95e, on the targets it has plus `agc_driver_sample_mask_draw_tests` and `agc_driver_stencil_known_replace_tests`: 66/66, three times each, and 66/66 under the layer with no `VUID-` line (19 `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings, from its own two 4_4_4_4 partial-write tests). The head also merges cleanly with `main` 504ea3b53, whose newer commits change no AGC code. - @Celegans12 ran the same comparison for #9748 on an RTX 3080 Laptop (driver 610.62), with this PR's previous head aab4fb4a5 among the trees: no `VUID-` errors. The layer's one message there is `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering`, 10 per merge test, because the merged target has no color attachment and the fragment output goes unused. - `sizeof(State)` is 848 on Linux x86-64 after the latest merge: `main`'s 840 plus a 32-bit `partialWriteMask` and `mergeBlend` (#8564's 16-bit mask keeps `main`'s size). A probe built on macOS gives the Linux guards' values for `main` 732ab06f4 (840) and this PR's previous head 5e0455020 (832), and 848 for this head. Not built on Linux since the merge. - Gran Turismo 7 (PPSA01317) on the RTX 4090, with an earlier state of these commits (before the `main` merge and the layer clamp) and #7978, #7243, #7256 and #7550 merged locally: past the 11_11_10 blend stop and the cube-map target, the main menu at 4.4 FPS. With scripted input it goes on to the World Map, the Used Cars dealer and a car purchase, then stops in the car delivery scene on `color targets with fewer fragments than samples (EQAA) are unsupported`, which this PR doesn't touch. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (the ONE/ZERO/ADD case is left to #7243) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#8564 and #8563 are in `main`). #10049 (mine) takes shader disk cache format 58 and this PR 57, so if both land, the second one's version line conflicts instead of merging silently. #9335 (mine) is stacked on this PR. - [x] Fixes: none - [x] Unblocks: PPSA01317 #4697 - [x] GPUs tested: NVIDIA GeForce RTX 4090, driver 616.92, Windows 11 - [x] AI-assisted: yes (Claude Code)
CnRJay commented 2026-10-21 18:05:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-21T18:05:56Z.

Review: COMMENTED


Replacing a thrown refusal with a working blend is worth having (GT7 gets past the 11_11_10 stop to its main menu), and building on #8564's interlock merge is reasonable. The cost of that mechanism is not in either PR.

  • A blended draw into this target now runs its pixel shader in a fragment-shader-interlock critical section with early fragment tests forced, and for multisampled targets with per-sample shading. Interlock serializes overlapping fragments of the same pixel, and forcing early fragment tests changes when depth is tested relative to the shader's discards; on a blend-heavy pass (particles, UI, fog) that can be much slower than fixed-function blending. The description's only speed figure is "main menu at 4.4 FPS" in GT7 on an RTX 4090 with an earlier state of the commits. Please post the summary lines of the same scene with and without the blend path (the unsupported draw can be skipped with a switch for the comparison), and Graphics.Draw per frame, so the cost is known before titles depend on it.
  • State which GPUs support fragmentShaderPixelInterlock and what happens on those that do not (the previous behavior was a clear throw; the replacement should be too, with a message that names the missing feature), including lavapipe, which the tests run on.
  • The 2,961 lines include #8563 and #8564 "unchanged". Rebase onto them once they merge so this PR's two commits are what is reviewed; as it stands this PR is marked conflicting and cannot be tested as a unit.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5604097876 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9020#pullrequestreview-5604097876). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-21T18:05:56Z. **Review:** COMMENTED --- Replacing a thrown refusal with a working blend is worth having (GT7 gets past the 11_11_10 stop to its main menu), and building on #8564's interlock merge is reasonable. The cost of that mechanism is not in either PR. - A blended draw into this target now runs its pixel shader in a fragment-shader-interlock critical section with early fragment tests forced, and for multisampled targets with per-sample shading. Interlock serializes overlapping fragments of the same pixel, and forcing early fragment tests changes when depth is tested relative to the shader's discards; on a blend-heavy pass (particles, UI, fog) that can be much slower than fixed-function blending. The description's only speed figure is "main menu at 4.4 FPS" in GT7 on an RTX 4090 with an earlier state of the commits. Please post the summary lines of the same scene with and without the blend path (the unsupported draw can be skipped with a switch for the comparison), and `Graphics.Draw` per frame, so the cost is known before titles depend on it. - State which GPUs support `fragmentShaderPixelInterlock` and what happens on those that do not (the previous behavior was a clear throw; the replacement should be too, with a message that names the missing feature), including lavapipe, which the tests run on. - The 2,961 lines include #8563 and #8564 "unchanged". Rebase onto them once they merge so this PR's two commits are what is reviewed; as it stands this PR is marked conflicting and cannot be tested as a unit.
frankea commented 2026-10-21 20:02:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-21T20:02:42Z.


@CnRJay thanks, all three points are fair. In order:

Cost in GT7. Here is the same scene with and without the blend path, from the same build: Gran Turismo 7 (PPSA01317 01.710.000) idling on its main menu with no input, RTX 4090 (NVIDIA 616.92), Windows 11, Ryzen 7 5800X, 3840x2160 output, warm shader cache. The build is this PR before its main merge, plus what GT7 needs to reach the menu (#9068's two fixes, #7978, #7243, #7256, #7550, and a local change that draws a partially resident depth target whose pages are all committed) and local diagnostics. For "without", a local switch that is not in this PR (APS5_REFUSE_PACKED_MERGE) throws for any pixel stage that would merge, and APS5_SKIP_REFUSED_DRAWS=1 skips those draws. Both configurations set APS5_SKIP_REFUSED_DRAWS=1 and APS5_TRACE_SUMMARY_EVERY=10. They also set two local switches for later GT7 stops (APS5_SKIP_REFUSED_DISPATCHES, APS5_A2C_UNDITHERED), and neither fires in these runs. Two runs of each, alternating; each value is the median of the 10 s interval lines from 240 s to 510 s after the first present, when the menu is steady:

run frame p50 (ms) p90 p99 GPU busy per present (ms) Graphics.Draw per frame (ms) Driver.Packet per frame (ms)
without, run 1 221.5 228.5 234.7 67.1 134.4 256.3
with, run 1 220.4 226.9 234.9 67.1 133.6 254.8
without, run 2 222.9 230.3 236.0 67.2 135.3 257.5
with, run 2 224.3 230.1 236.9 67.4 136.4 259.0

About 12 draws per frame go through the merge here, out of about 1,880, and all of them are this PR's path: blended, layered draws into an 11_11_10 array target, from one pixel shader (0x120af97800). GPU busy per present is the same either way, so in this scene the interlocked merge costs less than the run-to-run spread. But the merged draws are few, and the frame is CPU-bound (queue worker 0 is about 95% busy, Driver.Packet takes about 255 ms per frame), so this scene says little about a blend-heavy pass with large overlapping draws. A skipped draw still goes through decode and capture up to the refusal every frame, so the CPU columns of the "without" rows include part of those draws' cost; the GPU column doesn't.

For that bound I added a timed overdraw case to the GPU test, aab4fb4a5: agc_driver_packed_float_blend_tests --benchmark-overdraw, which CTest doesn't run. It records one draw of N full-target triangles with a premultiplied source-over blend (CB_BLEND_CONTROL 0x40000501, the blend of GT7's World Map draw in #9335) into a 2048x2048 tiled target, twice: once as 11_11_10 float through the merge, and once as 10_11_11 float, the same 32 bits in mirrored order, which the host blends itself as B10G11R11_UFLOAT. GPU time comes from the recorder's batch timestamps (APS5_PROFILE_GPU). The time per layer is (N=64 minus N=1) / 63, which leaves out the fixed cost of the batch. Medians of 9 rounds, three runs on the RTX 4090:

path N=1 N=64 per full-target layer fill rate
11_11_10 through the merge 0.060 ms 3.654 to 3.659 ms 0.057 ms 73 Gpixel/s
10_11_11 blended by the host 0.033 to 0.034 ms 1.768 to 1.769 ms 0.0275 ms 152 Gpixel/s

So when every fragment overlaps 63 others in the same draw, the merge blends at about half the host's rate on this GPU: 2.07x the time per layer, the same in all three runs. At GT7's 12 merged draws per frame that disappears in the noise, as above. A full-screen particle or fog pass with heavy overdraw into an 11_11_10 target would take about twice as long as fixed-function blending. I only measured the RTX 4090.

One summary line of each configuration
{"commit":"6b2abf6280b2","dirty":false,"env":{"APS5_A2C_UNDITHERED":"1","APS5_COUNT_PACKED_MERGES":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_REFUSE_PACKED_MERGE":"1","APS5_SKIP_REFUSED_DISPATCHES":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 616.92","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32688,"title_id":"PPSA01317","title":"Gran Turismo® 7","content_version":"01.710.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":6002,"ms":10068.172},"interval_start_s":308.048,"interval_end_s":318.116,"presents":45,"frame_ms":{"p50":223.224,"p90":228.548,"p99":231.352,"max":231.352},"gpu_busy_ms_per_present":67.109,"worker_busy_pct":{"queue worker 0x0":94.996,"queue worker 0x50":16.165,"queue worker 0x51":2.0,"queue worker 0x2a":1.611,"queue worker 0x23":0.137,"queue worker 0x2b":1.064,"queue worker 0x4a":0.0,"queue worker 0x4b":0.362},"top_phases_ms_per_frame":{"Driver.Packet":257.351,"Driver.Packet.draw":136.407,"Driver.Draw":135.473,"Graphics.Draw":134.318,"Graphics.Draw.draw_and_resource_release":122.08,"Driver.Draw.shader_compile_and_link":75.933,"Shader.DrawStage":68.33,"Resources.Complete":66.874},"trace_dropped":false,"trace":""}
{"commit":"6b2abf6280b2","dirty":false,"env":{"APS5_A2C_UNDITHERED":"1","APS5_COUNT_PACKED_MERGES":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_SKIP_REFUSED_DISPATCHES":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 616.92","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32688,"title_id":"PPSA01317","title":"Gran Turismo® 7","content_version":"01.710.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":6068,"ms":10133.97},"interval_start_s":308.212,"interval_end_s":318.346,"presents":46,"frame_ms":{"p50":220.356,"p90":227.307,"p99":230.243,"max":230.243},"gpu_busy_ms_per_present":67.021,"worker_busy_pct":{"queue worker 0x0":94.948,"queue worker 0x50":16.493,"queue worker 0x51":2.003,"queue worker 0x2a":1.57,"queue worker 0x23":0.063,"queue worker 0x2b":1.069,"queue worker 0x4a":0.007,"queue worker 0x4b":0.33},"top_phases_ms_per_frame":{"Driver.Packet":253.753,"Driver.Packet.draw":137.355,"Driver.Draw":136.429,"Graphics.Draw":133.212,"Graphics.Draw.draw_and_resource_release":120.961,"Driver.Draw.shader_compile_and_link":74.699,"Shader.DrawStage":67.017,"Resources.Complete":65.963},"trace_dropped":false,"trace":""}

On the mechanism:

  • Per-sample shading applies only to #8564's multisampled 4_4_4_4 merges. A multisampled 11_11_10 target still throws in this PR.
  • Early fragment tests are forced only where they don't change the result. #8564 refuses a merge whose shader kills under late tests in a draw that writes depth or stencil, writes guest memory under late tests in a draw with a depth, stencil or depth-bounds test, or kills under late tests while an occlusion query counts samples. #9335, stacked on this PR, draws the first of these (GT7's World Map has one) as a depth pass and an EQUAL merge pass.

Devices without fragmentShaderPixelInterlock. That case stays a throw that names the feature. The recompiler throws a partial write of a packed color target needs the fragmentShaderPixelInterlock feature, which the device lacks (#8564's check in SpirvModuleSetup.cpp). #8564's unit test pins it for a 4_4_4_4 merge with a target that lacks the capability, and the 11_11_10 merge goes through the same check. The GPU tests print skipped, the device lacks fragmentShaderPixelInterlock and return the skip code. Which drivers expose the feature:

  • Mesa at 3e32b0e1f: lavapipe always (lvp_device.c), so the CI's lavapipe runs these tests rather than skipping them. ANV always (anv_physical_device.c). RADV on GFX9 and newer when it compiles with ACO (radv_has_pops). NVK, turnip, panvk and honeykrisp don't expose it.
  • MoltenVK 1.4.1: when the Metal device reports raster order groups (MVKDevice.mm).
  • Windows, from the Vulkan Hardware Database's fragmentShaderPixelInterlock listing and its &option=not counterpart: NVIDIA from second-generation Maxwell on; the reports without it are Kepler, first-generation Maxwell, or drivers from 2019 and earlier. Intel from Gen9 on (Broadwell and older lack it). AMD's own driver from around Vulkan driver version 2.0.317 (early 2025), for example the RX 9070 GRE on 2.0.395 and the Radeon PRO W7900 on 2.0.353. It is missing on 2.0.310 and older, for example the RX 7700S on 2.0.310 and the RX 7800 XT on 2.0.299.

So on an AMD Windows driver from before early 2025, GT7 now stops on the interlock message instead of the old 11_11_10 blend message.

#8563 and #8564. Agreed. The branch carries them unchanged so that it builds and tests as a whole. This PR's own change is the two commits in the compare link in the description. I merged current main into the branch today (e554d27c3), so it no longer conflicts. Once they merge, I'll rebase onto main and drop them.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6325334844 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9020#issuecomment-6325334844). Originally posted by [frankea](https://github.com/frankea) on 2026-10-21T20:02:42Z. --- @CnRJay thanks, all three points are fair. In order: **Cost in GT7.** Here is the same scene with and without the blend path, from the same build: Gran Turismo 7 (PPSA01317 01.710.000) idling on its main menu with no input, RTX 4090 (NVIDIA 616.92), Windows 11, Ryzen 7 5800X, 3840x2160 output, warm shader cache. The build is this PR before its `main` merge, plus what GT7 needs to reach the menu (#9068's two fixes, #7978, #7243, #7256, #7550, and a local change that draws a partially resident depth target whose pages are all committed) and local diagnostics. For "without", a local switch that is not in this PR (`APS5_REFUSE_PACKED_MERGE`) throws for any pixel stage that would merge, and `APS5_SKIP_REFUSED_DRAWS=1` skips those draws. Both configurations set `APS5_SKIP_REFUSED_DRAWS=1` and `APS5_TRACE_SUMMARY_EVERY=10`. They also set two local switches for later GT7 stops (`APS5_SKIP_REFUSED_DISPATCHES`, `APS5_A2C_UNDITHERED`), and neither fires in these runs. Two runs of each, alternating; each value is the median of the 10 s interval lines from 240 s to 510 s after the first present, when the menu is steady: | run | frame p50 (ms) | p90 | p99 | GPU busy per present (ms) | `Graphics.Draw` per frame (ms) | `Driver.Packet` per frame (ms) | |---|---|---|---|---|---|---| | without, run 1 | 221.5 | 228.5 | 234.7 | 67.1 | 134.4 | 256.3 | | with, run 1 | 220.4 | 226.9 | 234.9 | 67.1 | 133.6 | 254.8 | | without, run 2 | 222.9 | 230.3 | 236.0 | 67.2 | 135.3 | 257.5 | | with, run 2 | 224.3 | 230.1 | 236.9 | 67.4 | 136.4 | 259.0 | About 12 draws per frame go through the merge here, out of about 1,880, and all of them are this PR's path: blended, layered draws into an 11_11_10 array target, from one pixel shader (0x120af97800). GPU busy per present is the same either way, so in this scene the interlocked merge costs less than the run-to-run spread. But the merged draws are few, and the frame is CPU-bound (queue worker 0 is about 95% busy, `Driver.Packet` takes about 255 ms per frame), so this scene says little about a blend-heavy pass with large overlapping draws. A skipped draw still goes through decode and capture up to the refusal every frame, so the CPU columns of the "without" rows include part of those draws' cost; the GPU column doesn't. For that bound I added a timed overdraw case to the GPU test, aab4fb4a5: `agc_driver_packed_float_blend_tests --benchmark-overdraw`, which CTest doesn't run. It records one draw of N full-target triangles with a premultiplied source-over blend (`CB_BLEND_CONTROL` 0x40000501, the blend of GT7's World Map draw in #9335) into a 2048x2048 tiled target, twice: once as 11_11_10 float through the merge, and once as 10_11_11 float, the same 32 bits in mirrored order, which the host blends itself as `B10G11R11_UFLOAT`. GPU time comes from the recorder's batch timestamps (`APS5_PROFILE_GPU`). The time per layer is (N=64 minus N=1) / 63, which leaves out the fixed cost of the batch. Medians of 9 rounds, three runs on the RTX 4090: | path | N=1 | N=64 | per full-target layer | fill rate | |---|---|---|---|---| | 11_11_10 through the merge | 0.060 ms | 3.654 to 3.659 ms | 0.057 ms | 73 Gpixel/s | | 10_11_11 blended by the host | 0.033 to 0.034 ms | 1.768 to 1.769 ms | 0.0275 ms | 152 Gpixel/s | So when every fragment overlaps 63 others in the same draw, the merge blends at about half the host's rate on this GPU: 2.07x the time per layer, the same in all three runs. At GT7's 12 merged draws per frame that disappears in the noise, as above. A full-screen particle or fog pass with heavy overdraw into an 11_11_10 target would take about twice as long as fixed-function blending. I only measured the RTX 4090. <details><summary>One summary line of each configuration</summary> ``` {"commit":"6b2abf6280b2","dirty":false,"env":{"APS5_A2C_UNDITHERED":"1","APS5_COUNT_PACKED_MERGES":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_REFUSE_PACKED_MERGE":"1","APS5_SKIP_REFUSED_DISPATCHES":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 616.92","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32688,"title_id":"PPSA01317","title":"Gran Turismo® 7","content_version":"01.710.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":6002,"ms":10068.172},"interval_start_s":308.048,"interval_end_s":318.116,"presents":45,"frame_ms":{"p50":223.224,"p90":228.548,"p99":231.352,"max":231.352},"gpu_busy_ms_per_present":67.109,"worker_busy_pct":{"queue worker 0x0":94.996,"queue worker 0x50":16.165,"queue worker 0x51":2.0,"queue worker 0x2a":1.611,"queue worker 0x23":0.137,"queue worker 0x2b":1.064,"queue worker 0x4a":0.0,"queue worker 0x4b":0.362},"top_phases_ms_per_frame":{"Driver.Packet":257.351,"Driver.Packet.draw":136.407,"Driver.Draw":135.473,"Graphics.Draw":134.318,"Graphics.Draw.draw_and_resource_release":122.08,"Driver.Draw.shader_compile_and_link":75.933,"Shader.DrawStage":68.33,"Resources.Complete":66.874},"trace_dropped":false,"trace":""} {"commit":"6b2abf6280b2","dirty":false,"env":{"APS5_A2C_UNDITHERED":"1","APS5_COUNT_PACKED_MERGES":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_SKIP_REFUSED_DISPATCHES":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 616.92","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32688,"title_id":"PPSA01317","title":"Gran Turismo® 7","content_version":"01.710.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":6068,"ms":10133.97},"interval_start_s":308.212,"interval_end_s":318.346,"presents":46,"frame_ms":{"p50":220.356,"p90":227.307,"p99":230.243,"max":230.243},"gpu_busy_ms_per_present":67.021,"worker_busy_pct":{"queue worker 0x0":94.948,"queue worker 0x50":16.493,"queue worker 0x51":2.003,"queue worker 0x2a":1.57,"queue worker 0x23":0.063,"queue worker 0x2b":1.069,"queue worker 0x4a":0.007,"queue worker 0x4b":0.33},"top_phases_ms_per_frame":{"Driver.Packet":253.753,"Driver.Packet.draw":137.355,"Driver.Draw":136.429,"Graphics.Draw":133.212,"Graphics.Draw.draw_and_resource_release":120.961,"Driver.Draw.shader_compile_and_link":74.699,"Shader.DrawStage":67.017,"Resources.Complete":65.963},"trace_dropped":false,"trace":""} ``` </details> On the mechanism: - Per-sample shading applies only to #8564's multisampled 4_4_4_4 merges. A multisampled 11_11_10 target still throws in this PR. - Early fragment tests are forced only where they don't change the result. #8564 refuses a merge whose shader kills under late tests in a draw that writes depth or stencil, writes guest memory under late tests in a draw with a depth, stencil or depth-bounds test, or kills under late tests while an occlusion query counts samples. #9335, stacked on this PR, draws the first of these (GT7's World Map has one) as a depth pass and an EQUAL merge pass. **Devices without `fragmentShaderPixelInterlock`.** That case stays a throw that names the feature. The recompiler throws `a partial write of a packed color target needs the fragmentShaderPixelInterlock feature, which the device lacks` (#8564's check in `SpirvModuleSetup.cpp`). #8564's unit test pins it for a 4_4_4_4 merge with a target that lacks the capability, and the 11_11_10 merge goes through the same check. The GPU tests print `skipped, the device lacks fragmentShaderPixelInterlock` and return the skip code. Which drivers expose the feature: - Mesa at 3e32b0e1f: lavapipe always ([`lvp_device.c`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/3e32b0e1f132231b7a972c1b0b5b06c7e16cf8b9/src/gallium/frontends/lavapipe/lvp_device.c#L902)), so the CI's lavapipe runs these tests rather than skipping them. ANV always ([`anv_physical_device.c`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/3e32b0e1f132231b7a972c1b0b5b06c7e16cf8b9/src/intel/vulkan/anv_physical_device.c#L878)). RADV on GFX9 and newer when it compiles with ACO ([`radv_has_pops`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/3e32b0e1f132231b7a972c1b0b5b06c7e16cf8b9/src/amd/vulkan/radv_physical_device.h#L245)). NVK, turnip, panvk and honeykrisp don't expose it. - MoltenVK 1.4.1: when the Metal device reports raster order groups ([`MVKDevice.mm`](https://github.com/KhronosGroup/MoltenVK/blob/v1.4.1/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm#L728)). - Windows, from the Vulkan Hardware Database's [`fragmentShaderPixelInterlock` listing](https://vulkan.gpuinfo.org/listdevicescoverage.php?extensionname=VK_EXT_fragment_shader_interlock&extensionfeature=fragmentShaderPixelInterlock&platform=windows) and its `&option=not` counterpart: NVIDIA from second-generation Maxwell on; the reports without it are Kepler, first-generation Maxwell, or drivers from 2019 and earlier. Intel from Gen9 on (Broadwell and older lack it). AMD's own driver from around Vulkan driver version 2.0.317 (early 2025), for example the RX 9070 GRE on 2.0.395 and the Radeon PRO W7900 on 2.0.353. It is missing on 2.0.310 and older, for example the RX 7700S on 2.0.310 and the RX 7800 XT on 2.0.299. So on an AMD Windows driver from before early 2025, GT7 now stops on the interlock message instead of the old 11_11_10 blend message. **#8563 and #8564.** Agreed. The branch carries them unchanged so that it builds and tests as a whole. This PR's own change is the two commits in the compare link in the description. I merged current `main` into the branch today (e554d27c3), so it no longer conflicts. Once they merge, I'll rebase onto `main` and drop them. AI-assisted: yes (Claude Code)
Celegans12 commented 2026-10-22 02:24:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-22T02:24:15Z.


Ghost of Yōtei (PPSA26344) on plain main (0c6a5bd593) stops about 20 minutes into a warm open-world run on AGC graphics: blending into a 10_11_11 unorm color target is unsupported. That's the sibling packed target, so I'd like to cover it on top of your merge instead of adding a second mechanism.

Your blend path already passes the packing through TargetMerge, PackedWriteMask and the merge emitter. As far as I can see, 10_11_11 unorm needs four things on top: decode letting Unorm10_11_11 into the merge, its 10/11/11 fields in PackedWriteMask, unorm unpack and pack in the merge emitter (round to nearest, as the existing export does), and the serializer range. We've carried a working version of that blend in our own tree since 10-12. It uses a separate epilogue, so I wouldn't send it as is, but its CPU reference test (the factor and op combinations Yōtei uses, add and both subtracts) should carry over.

Would you rather fold 10_11_11 unorm into #9020, or should I open a small follow-up with Depends on: #9020 once your stack settles? Either way I'll run it in Yōtei and post the result here. I don't think #7243's ONE/ZERO case covers it: I haven't pinned down the exact blend Yōtei sets on this target yet, but our working version needed real blending.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6331167173 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9020#issuecomment-6331167173). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-22T02:24:15Z. --- Ghost of Yōtei (PPSA26344) on plain `main` (0c6a5bd593) stops about 20 minutes into a warm open-world run on `AGC graphics: blending into a 10_11_11 unorm color target is unsupported`. That's the sibling packed target, so I'd like to cover it on top of your merge instead of adding a second mechanism. Your blend path already passes the packing through `TargetMerge`, `PackedWriteMask` and the merge emitter. As far as I can see, 10_11_11 unorm needs four things on top: decode letting `Unorm10_11_11` into the merge, its 10/11/11 fields in `PackedWriteMask`, unorm unpack and pack in the merge emitter (round to nearest, as the existing export does), and the serializer range. We've carried a working version of that blend in our own tree since 10-12. It uses a separate epilogue, so I wouldn't send it as is, but its CPU reference test (the factor and op combinations Yōtei uses, add and both subtracts) should carry over. Would you rather fold 10_11_11 unorm into #9020, or should I open a small follow-up with `Depends on: #9020` once your stack settles? Either way I'll run it in Yōtei and post the result here. I don't think #7243's ONE/ZERO case covers it: I haven't pinned down the exact blend Yōtei sets on this target yet, but our working version needed real blending.
frankea commented 2026-10-22 08:56:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-22T08:56:32Z.


@Celegans12 thanks for the Yōtei report. Please open it as a follow-up with Depends on: #9020; I'd keep #9020 to 11_11_10 float while it's under review. #9020 itself depends on #8564, which is still open, so your PR stacks on both.

Your list matches what I see in #9020's head (aab4fb4a5):

  • Decode: in DecodeColorBuffer, only an 11_11_10 float target moves the blend into mergeBlend, so a blended 10_11_11 unorm target still reaches blending into a 10_11_11 unorm color target is unsupported. The decode already requires ROUND_MODE 0 for 10_11_11 unorm, which fits your round-to-nearest pack.
  • PackedWriteMask takes 4_4_4_4 unorm and 11_11_10 float only. It needs the 10_11_11 fields: red in the low 11 bits, green in the next 11 and blue in the top 10.
  • Merge emitter: ShaderInputInfoBuilder refuses a blending merge into anything but 11_11_10 float. That's where your unorm unpack and pack go.
  • Serializer: I don't think it needs a change. Since version 44 it reads ColorExportPacking up to Unorm4_4_4_4, which includes Unorm10_11_11, and it reads the merge's blend control unconditionally.

Two limits of #9020 to keep in mind for Yōtei. First, its blend refuses a multisampled 11_11_10 float target, so a multisampled 10_11_11 unorm target would need that case too. The merge as a whole also refuses volume targets and mipmapped or array multisampled ones. Second, the merge needs fragmentShaderPixelInterlock, and devices without it throw.

Post the Yōtei result here or on your PR, whichever you prefer. I can run your branch on an RTX 4090 if that helps.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6336831049 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9020#issuecomment-6336831049). Originally posted by [frankea](https://github.com/frankea) on 2026-10-22T08:56:32Z. --- @Celegans12 thanks for the Yōtei report. Please open it as a follow-up with `Depends on: #9020`; I'd keep #9020 to 11_11_10 float while it's under review. #9020 itself depends on #8564, which is still open, so your PR stacks on both. Your list matches what I see in #9020's head (aab4fb4a5): - **Decode:** in `DecodeColorBuffer`, only an 11_11_10 float target moves the blend into `mergeBlend`, so a blended 10_11_11 unorm target still reaches `blending into a 10_11_11 unorm color target is unsupported`. The decode already requires ROUND_MODE 0 for 10_11_11 unorm, which fits your round-to-nearest pack. - **`PackedWriteMask`** takes 4_4_4_4 unorm and 11_11_10 float only. It needs the 10_11_11 fields: red in the low 11 bits, green in the next 11 and blue in the top 10. - **Merge emitter:** `ShaderInputInfoBuilder` refuses a blending merge into anything but 11_11_10 float. That's where your unorm unpack and pack go. - **Serializer:** I don't think it needs a change. Since version 44 it reads `ColorExportPacking` up to `Unorm4_4_4_4`, which includes `Unorm10_11_11`, and it reads the merge's blend control unconditionally. Two limits of #9020 to keep in mind for Yōtei. First, its blend refuses a multisampled 11_11_10 float target, so a multisampled 10_11_11 unorm target would need that case too. The merge as a whole also refuses volume targets and mipmapped or array multisampled ones. Second, the merge needs `fragmentShaderPixelInterlock`, and devices without it throw. Post the Yōtei result here or on your PR, whichever you prefer. I can run your branch on an RTX 4090 if that helps. AI-assisted: yes (Claude Code)
Celegans12 commented 2026-10-22 12:14:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-22T12:14:37Z.


@frankea thanks for the pointers. The 10_11_11 unorm follow-up is up as #9748, stacked on this PR's head aab4fb4a5, so only its last commit is new.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340474896 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9020#issuecomment-6340474896). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-22T12:14:37Z. --- @frankea thanks for the pointers. The 10_11_11 unorm follow-up is up as #9748, stacked on this PR's head aab4fb4a5, so only its last commit is new.
XairRrR commented 2026-10-29 03:53:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T03:53:04Z.

Review: DISMISSED


Reviewed — changes requested

On its own base the head builds, the focused tests pass under the validation layer, and the new GPU test fails without the emitter change. It no longer merges with current main, though, and main has since taken the request-serializer, pipeline-journal and shader-disk-cache version numbers this PR uses.

What I ran

  • PR head: 5f7287406a069f053e70a86b4e79220d12f2fece (merge base with main: 732ab06f41772c1d805cf58193d1682616ee88d8)
  • main: b433c40f2f46aa2e59e19806010a839ac8572d64
  • Arch Linux 7.2.11-zen, GCC 16.2.1 (Release, Ninja), Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), in a clean worktree.
git fetch origin main pull/9020/head:refs/review/9020
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/9020      # conflicts, aborted
git checkout --detach refs/review/9020            # reviewed the head on its own base
git diff --check origin/main...refs/review/9020
python3 tools/check_conventions.py --base origin/main
cmake --build build -j10 --target agc_driver_packed_float_blend_tests agc_driver_graphics_tests \
  agc_shader_memory_tests request_serializer_tests agc_driver_pipeline_journal_tests \
  agc_driver_packed_float_color_target_tests agc_driver_packed_unorm4444_partial_write_tests \
  agc_driver_packed_unorm4444_multisample_partial_write_tests agc_driver_layered_array_color_draw_tests \
  agc_shader_disk_cache_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \
  VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -j4 -V --output-on-failure \
  -R '^(request_serializer|agc_shader_memory|agc_shader_disk_cache|agc_driver_graphics|agc_driver_layered_array_color_draw|agc_driver_packed_float_blend|agc_driver_packed_float_color_target|agc_driver_packed_unorm4444_multisample_partial_write|agc_driver_packed_unorm4444_partial_write|agc_driver_pipeline_journal)$'
# negative control
git checkout 732ab06f4 -- core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
cmake --build build -j10 --target agc_driver_packed_float_blend_tests
ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -R '^agc_driver_packed_float_blend$' --output-on-failure
# baseline: the same targets and settings on main b433c40f2f (without agc_driver_packed_float_blend, which main lacks)

Results

Check Result
Merge into main b433c40f2f Conflicts in 7 files (listed below)
git diff --check clean
tools/check_conventions.py --base origin/main All conventions checks passed.
Build of the 10 targets above (PR head) OK. The only warning in a file this PR touches is the -Wstringop-overflow from RequestSerializerTests.cpp (54 bytes), which already exists on main, as ycbuzi noted
10 focused tests, PR head, validation layer 10/10 passed, 0 VUID- lines, no was not found but was requested by env var VK_INSTANCE_LAYERS; 29 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings, the number the description reports
9 focused tests, main b433c40f2f, validation layer 9/9 passed, 0 VUID- lines, no missing-layer line; 19 of the same warnings (from main's own 4_4_4_4 merge tests)
Slowest test 4.7 s (agc_driver_pipeline_journal); agc_driver_packed_float_blend well under that
Negative control agc_driver_packed_float_blend fails (details below)
Conflicting files when merging into main b433c40f2f
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR head, validation layer
1012: Selected GPU name=NVIDIA GeForce RTX 4070 Ti SUPER vendor=0x10de device=0x2705 subgroup=32
1012: 11_11_10 float blend tests passed: 11 single blends, 2 partial writes, a back-to-back chain and 2 same-draw overdraws of 16 layers into a 256x128 tiled target, the unscissored pixels kept, and 3 merges into mips and slices of 2D arrays
100% tests passed out of 10
VUID- lines: 0
     29 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering

Negative control

On the PR head I restored only core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp from the merge base 732ab06f4. That version always packs the merge as 4_4_4_4 and has no blend or gl_Layer addressing. I rebuilt agc_driver_packed_float_blend_tests, and the test fails on its first case:

a source-over blend (CB_BLEND_CONTROL 0x65040504, CB_TARGET_MASK 0xf) of (1, 0.5, 0.25, 0.25) into a tiled 11_11_10 float target: pixel (0, 0) holds 0x00004f84, expected 0x698c6178 (it held 0x580b0160)
0% tests passed, 1 tests failed out of 1

Restoring all production files does not build, because the tests use PackedBlendControl and the new TargetMerge fields (ycbuzi reported the same). So the emitter-only revert is the meaningful control. I then restored the file.

Findings

Blocking

  1. The PR conflicts with main, and main now uses its format numbers. The merge into b433c40f2f conflicts in the 7 files above. Resolving the text is not enough:

    • Request serializer. main writes version 49: 48 adds fragmentBarycentricBuiltins, and 49 adds the depth-export range after the target merge (RequestSerializer.cpp L362-L369 and L456-L459 on main). This PR reads its packing, blend control and slice fields at version >= 47u (RequestSerializer.cpp L450-L458 at the head). After a merge, a version 47–49 request written by main would have the depth-export words read as merge fields. The new fields need their own version after 49 (50), and a version 47–49 record needs the same "4_4_4_4, no blend, one slice" default the PR gives version 46.
    • Pipeline journal. main is at FileFormat = 12u with sizeof(State) == 912 (PipelineJournal.cpp L41-L50 on main); the head has 11 and 848. This PR's partialWriteMask widening and mergeBlend need 13 and a new size guard.
    • Shader disk cache. main is already at FormatVersion = 49, from b9f4f65904 (ShaderDiskCache.hpp L16 on main). The head also sets 49, so this line merges without a conflict, and two different cache key layouts would ship under the same format. That is the silent collision the description wanted to avoid with #10049. It needs 50, or the next free number at rebase time.

    Please merge or rebase onto current main, renumber, update the description's "Formats" bullet and the Depends on line (it still says this PR takes 49 and #10049 takes 48), and rerun the serializer, disk-cache, journal and merge tests on the new head.

Non-blocking

  1. Explanatory comments in the new test. core/libs/prx/libSceAgcDriver/tests/execution/PackedFloatBlend.cpp:64, :561 and :587-589 describe the test (// Position from the buffer at offset 0, …, // A 2D array of 11_11_10 float slices …, // One full-screen triangle per layer …). CONVENTIONS allows comments only for technical debt, #endif and namespace ends. check_conventions.py lets them through only because the PR also edits docs/dev/debt/. Some existing tests under tests/execution/ have similar comments, so this is not blocking, but please drop them or fold the information into names or failure messages.

I also checked these points and found nothing to change:

  • PackedBlendControl keeps only the color equation, which fits a target without alpha.
  • Factors 6, 7 and 10 (DST_ALPHA, ONE_MINUS_DST_ALPHA, SRC_ALPHA_SATURATE) reduce correctly with a destination alpha of 1.
  • 11 and 12 and the constant and dual-source factors throw.
  • The 11_11_10 decode only produces mappings 0xe4 and 0xc6, so the merge's source alpha (mapped component 3) is always the export alpha.
  • The layer clamp uses arraySlice + layers - 1, which is the view's SLICE_MAX when a layer is exported, and firstSlice when it is not.

Not verified

  • The merged tree: it does not exist, because of the conflicts. All results above are from the PR head on its own base 732ab06f4, which is 3,637 commits behind main.
  • AMD, Intel, lavapipe or any device without fragmentShaderPixelInterlock. I tested only the NVIDIA GPU above.
  • Whether the fp32 blend and the toward-zero pack match the console's CB for this format (the debt entry already says it is unmeasured).
  • Performance (CnRJay's point). frankea's GT7 and overdraw figures are in the thread; I did not reproduce them.
  • No title was run.

To get this to a good state

  1. Merge current main and resolve the 7 conflicts.
  2. Move this PR's serializer fields to version 50, with defaults for version 46–49 records. Take journal format 13 with the new sizeof(State), and disk cache format 50 (or whatever is free then).
  3. Rerun request_serializer, agc_shader_memory, agc_shader_disk_cache, agc_driver_pipeline_journal, agc_driver_graphics and the merge tests under the validation layer, and update Tested, Formats and Depends on.
  4. Optionally remove the test comments.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692641293 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9020#pullrequestreview-5692641293). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T03:53:04Z. **Review:** DISMISSED --- # Reviewed — changes requested On its own base the head builds, the focused tests pass under the validation layer, and the new GPU test fails without the emitter change. It no longer merges with current `main`, though, and `main` has since taken the request-serializer, pipeline-journal and shader-disk-cache version numbers this PR uses. ## What I ran - PR head: `5f7287406a069f053e70a86b4e79220d12f2fece` (merge base with `main`: `732ab06f41772c1d805cf58193d1682616ee88d8`) - `main`: `b433c40f2f46aa2e59e19806010a839ac8572d64` - Arch Linux 7.2.11-zen, GCC 16.2.1 (Release, Ninja), Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), in a clean worktree. ```sh git fetch origin main pull/9020/head:refs/review/9020 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/9020 # conflicts, aborted git checkout --detach refs/review/9020 # reviewed the head on its own base git diff --check origin/main...refs/review/9020 python3 tools/check_conventions.py --base origin/main cmake --build build -j10 --target agc_driver_packed_float_blend_tests agc_driver_graphics_tests \ agc_shader_memory_tests request_serializer_tests agc_driver_pipeline_journal_tests \ agc_driver_packed_float_color_target_tests agc_driver_packed_unorm4444_partial_write_tests \ agc_driver_packed_unorm4444_multisample_partial_write_tests agc_driver_layered_array_color_draw_tests \ agc_shader_disk_cache_tests VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \ VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -j4 -V --output-on-failure \ -R '^(request_serializer|agc_shader_memory|agc_shader_disk_cache|agc_driver_graphics|agc_driver_layered_array_color_draw|agc_driver_packed_float_blend|agc_driver_packed_float_color_target|agc_driver_packed_unorm4444_multisample_partial_write|agc_driver_packed_unorm4444_partial_write|agc_driver_pipeline_journal)$' # negative control git checkout 732ab06f4 -- core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp cmake --build build -j10 --target agc_driver_packed_float_blend_tests ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -R '^agc_driver_packed_float_blend$' --output-on-failure # baseline: the same targets and settings on main b433c40f2f (without agc_driver_packed_float_blend, which main lacks) ``` ## Results | Check | Result | |---|---| | Merge into `main` b433c40f2f | **Conflicts** in 7 files (listed below) | | `git diff --check` | clean | | `tools/check_conventions.py --base origin/main` | `All conventions checks passed.` | | Build of the 10 targets above (PR head) | OK. The only warning in a file this PR touches is the `-Wstringop-overflow` from `RequestSerializerTests.cpp` (54 bytes), which already exists on `main`, as ycbuzi noted | | 10 focused tests, PR head, validation layer | 10/10 passed, 0 `VUID-` lines, no `was not found but was requested by env var VK_INSTANCE_LAYERS`; 29 `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings, the number the description reports | | 9 focused tests, `main` b433c40f2f, validation layer | 9/9 passed, 0 `VUID-` lines, no missing-layer line; 19 of the same warnings (from `main`'s own 4_4_4_4 merge tests) | | Slowest test | 4.7 s (`agc_driver_pipeline_journal`); `agc_driver_packed_float_blend` well under that | | Negative control | `agc_driver_packed_float_blend` fails (details below) | <details><summary>Conflicting files when merging into main b433c40f2f</summary> ``` core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp core/libs/prx/libSceAgcDriver/tests/Graphics.cpp core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp core/shader/recompiler/tests/RequestSerializerTests.cpp docs/dev/debt/libSceAgcDriver.md ``` </details> <details><summary>PR head, validation layer</summary> ``` 1012: Selected GPU name=NVIDIA GeForce RTX 4070 Ti SUPER vendor=0x10de device=0x2705 subgroup=32 1012: 11_11_10 float blend tests passed: 11 single blends, 2 partial writes, a back-to-back chain and 2 same-draw overdraws of 16 layers into a 256x128 tiled target, the unscissored pixels kept, and 3 merges into mips and slices of 2D arrays 100% tests passed out of 10 VUID- lines: 0 29 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering ``` </details> ## Negative control On the PR head I restored only `core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp` from the merge base 732ab06f4. That version always packs the merge as 4_4_4_4 and has no blend or `gl_Layer` addressing. I rebuilt `agc_driver_packed_float_blend_tests`, and the test fails on its first case: ``` a source-over blend (CB_BLEND_CONTROL 0x65040504, CB_TARGET_MASK 0xf) of (1, 0.5, 0.25, 0.25) into a tiled 11_11_10 float target: pixel (0, 0) holds 0x00004f84, expected 0x698c6178 (it held 0x580b0160) 0% tests passed, 1 tests failed out of 1 ``` Restoring all production files does not build, because the tests use `PackedBlendControl` and the new `TargetMerge` fields (ycbuzi reported the same). So the emitter-only revert is the meaningful control. I then restored the file. ## Findings ### Blocking 1. **The PR conflicts with `main`, and `main` now uses its format numbers.** The merge into b433c40f2f conflicts in the 7 files above. Resolving the text is not enough: - **Request serializer.** `main` writes version 49: 48 adds `fragmentBarycentricBuiltins`, and 49 adds the depth-export range after the target merge ([RequestSerializer.cpp L362-L369 and L456-L459 on main](https://github.com/boykopovar/AnyPS5/blob/b433c40f2f46aa2e59e19806010a839ac8572d64/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L362-L369)). This PR reads its packing, blend control and slice fields at `version >= 47u` ([RequestSerializer.cpp L450-L458 at the head](https://github.com/boykopovar/AnyPS5/blob/5f7287406a069f053e70a86b4e79220d12f2fece/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L450-L458)). After a merge, a version 47–49 request written by `main` would have the depth-export words read as merge fields. The new fields need their own version after 49 (50), and a version 47–49 record needs the same "4_4_4_4, no blend, one slice" default the PR gives version 46. - **Pipeline journal.** `main` is at `FileFormat = 12u` with `sizeof(State) == 912` ([PipelineJournal.cpp L41-L50 on main](https://github.com/boykopovar/AnyPS5/blob/b433c40f2f46aa2e59e19806010a839ac8572d64/core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp#L41-L50)); the head has 11 and 848. This PR's `partialWriteMask` widening and `mergeBlend` need 13 and a new size guard. - **Shader disk cache.** `main` is already at `FormatVersion = 49`, from b9f4f65904 ([ShaderDiskCache.hpp L16 on main](https://github.com/boykopovar/AnyPS5/blob/b433c40f2f46aa2e59e19806010a839ac8572d64/core/shader/recompiler/ShaderDiskCache.hpp#L16)). The head also sets 49, so this line merges **without a conflict**, and two different cache key layouts would ship under the same format. That is the silent collision the description wanted to avoid with #10049. It needs 50, or the next free number at rebase time. Please merge or rebase onto current `main`, renumber, update the description's "Formats" bullet and the `Depends on` line (it still says this PR takes 49 and #10049 takes 48), and rerun the serializer, disk-cache, journal and merge tests on the new head. ### Non-blocking 1. **Explanatory comments in the new test.** `core/libs/prx/libSceAgcDriver/tests/execution/PackedFloatBlend.cpp:64`, `:561` and `:587-589` describe the test (`// Position from the buffer at offset 0, …`, `// A 2D array of 11_11_10 float slices …`, `// One full-screen triangle per layer …`). [CONVENTIONS](https://github.com/boykopovar/AnyPS5/blob/b433c40f2f46aa2e59e19806010a839ac8572d64/docs/dev/CONVENTIONS.md#L13) allows comments only for technical debt, `#endif` and namespace ends. `check_conventions.py` lets them through only because the PR also edits `docs/dev/debt/`. Some existing tests under `tests/execution/` have similar comments, so this is not blocking, but please drop them or fold the information into names or failure messages. I also checked these points and found nothing to change: - `PackedBlendControl` keeps only the color equation, which fits a target without alpha. - Factors 6, 7 and 10 (DST_ALPHA, ONE_MINUS_DST_ALPHA, SRC_ALPHA_SATURATE) reduce correctly with a destination alpha of 1. - 11 and 12 and the constant and dual-source factors throw. - The 11_11_10 decode only produces mappings `0xe4` and `0xc6`, so the merge's source alpha (mapped component 3) is always the export alpha. - The layer clamp uses `arraySlice + layers - 1`, which is the view's `SLICE_MAX` when a layer is exported, and `firstSlice` when it is not. ## Not verified - The merged tree: it does not exist, because of the conflicts. All results above are from the PR head on its own base 732ab06f4, which is 3,637 commits behind `main`. - AMD, Intel, lavapipe or any device without `fragmentShaderPixelInterlock`. I tested only the NVIDIA GPU above. - Whether the fp32 blend and the toward-zero pack match the console's CB for this format (the debt entry already says it is unmeasured). - Performance (CnRJay's point). frankea's GT7 and overdraw figures are in the thread; I did not reproduce them. - No title was run. ## To get this to a good state 1. Merge current `main` and resolve the 7 conflicts. 2. Move this PR's serializer fields to version 50, with defaults for version 46–49 records. Take journal format 13 with the new `sizeof(State)`, and disk cache format 50 (or whatever is free then). 3. Rerun `request_serializer`, `agc_shader_memory`, `agc_shader_disk_cache`, `agc_driver_pipeline_journal`, `agc_driver_graphics` and the merge tests under the validation layer, and update Tested, Formats and Depends on. 4. Optionally remove the test comments.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9020
No description provided.