feat(agc): blend into 10_11_11 unorm color targets in the pixel shader #9748
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9748"
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 Celegans12 on 2026-10-22T12:14:28Z.
What
A blended or partial write into a 10_11_11 unorm color target threw. It now goes through the pixel-interlock target merge that #9020 added for 11_11_10 float targets, instead of a second path.
mergeBlendand maps red to bits 10..0, green to 21..11 and blue to 31..22 of the word. Partial writes merge only those fields.Since #9020 and #7243 merged, main has the merge path and the replacement-blend rule; this PR adds only the 10_11_11 unorm case. #11684's unclamped normalized blend still refuses packed targets, so blends without BLEND_CLAMP keep throwing. The request, shader cache and journal layouts do not change, so this takes no new version numbers.
Tested
Based on
mainb4a82720a8. Windows 11, MinGW-w64 GCC 15.2.0, Release,-DBUILD_TESTING=ON, touched targets only. On an RTX 3080 Laptop (621.14), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(layer 1.4.363, insertion confirmed in each log):agc_driver_packed_unorm_blend,agc_driver_graphics, and the neighboursagc_driver_packed_float_blend,agc_driver_packed_float_color_target,agc_driver_packed_unorm_color_target,agc_driver_packed_unorm4444_partial_write,agc_driver_packed_unorm4444_multisample_partial_writeandagc_driver_unclamped_normalized_blend. All 8 passed in each of three runs, with no skips and noVUID-errors; the layer only reportedShaderOutputNotConsumedwarnings.The two tests this PR changes,
agc_driver_graphicsandagc_driver_packed_unorm_blend, are unchanged since they were shown to fail without the change, apart from theshaderStorageImageReadWithoutFormatskip that main's float blend test now has. I didn't rerun them on main this round; main's ownGraphics.cppstill expects these blends to throw. Not tested: Linux (CI), AMD and Intel GPUs, title runs, console behaviour. No performance claim.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T14:57:11Z.
Review: DISMISSED
I reviewed the last commit only, as requested. The new packed-target path needs the repository's GPU validation evidence before it is ready to approve: CONTRIBUTING.md requires the same focused tests on main and the change, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, via ctest -V from the same machine/GPU, and a comparison showing no new VUID errors. The report has ctest totals and says there were no VUID errors on the change, but it does not give a paired main run, the exact environment/verbose test details, or a baseline comparison. Please add that evidence after refreshing from current main, or say clearly if this cannot be run. Current hosted PR checks cover conventions, intake and labels; they do not run this GPU comparison.\n\nThere is also an acknowledged test integration follow-up: #7243 is still open, and its graphics tests currently expect additive blending into this 10_11_11 unorm target to throw. When both changes land, that expectation must be updated. Please coordinate via the existing Depends on/overlap convention so the result does not leave a failing test.\n\nLocal review checks: and All conventions checks passed. passed (the diff-check emitted an existing trailing blank line warning in docs/dev/debt/libSceContentExport.md). could not run because this checkout has no configured build directory. I could not run Vulkan execution tests here because no configured build/dependencies are available and disk space is insufficient for a new build. The submitted Windows RTX 3080 and WSL lavapipe runs are recorded in the PR description, but I did not independently reproduce them.\n\nI did not find a substantiated defect in the last commit's merge logic or new test in this review. This request is limited to the repository-required validation evidence and integration coordination.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T14:57:21Z.
Correction to my local-check wording above:
git diff --checkreported a trailing blank line at EOF indocs/dev/debt/libSceContentExport.md;python tools/check_conventions.py --base b7d1d47 --head 28d4f1b0d130eaa56381f8adb2e31581b8d27f96passed.python tools/check_test_registration.pycould not run because there is no configuredbuild/CMakeCache.txt. I could not run Vulkan execution tests here because no configured build/dependencies are available and disk space is insufficient for a new build. The reported RTX 3080 and WSL lavapipe test runs are from the PR description; I did not independently reproduce them.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T17:04:40Z.
Review: COMMENTED
I rechecked the current head
28d4f1b0d130eaa56381f8adb2e31581b8d27f96. The PR reports a Windows RTX 3080 run and WSL/lavapipe run, but neither is a paired current-main versus final-head comparison with the required environment and layer-found confirmation; the Windows report only says no VUIDs on the change. The #9020 dependency and #7243 overlap also need to be stated in the checklist/merge order. Against live main11f976b27c16ed91633f00039dba5dfd97dd7cc1, the merge tree conflicts indocs/dev/debt/shader.md; the branch is 619 commits behind its base snapshot. Please rebase onto current main, resolve that debt conflict and the #7243 test expectation with its author, then run the same focused Vulkan tests on main and the final head withVK_INSTANCE_LAYERS,ANYPS5_NO_SHADER_CACHE=1, andANYPS5_REQUIRE_VULKAN=1; confirm the layer loaded and compare VUIDs. If unavailable, state the limitation. I found no additional functional defect in the blend path inspected, but those repository-required integration checks remain.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T14:34:11Z.
Review: CHANGES_REQUESTED
Reviewed the last commit (16a82db7af) only; the base is #9020.
PackedWriteMaskfields (10..0, 21..11, 31..22) match the format,BLEND_CLAMPis required and source color/alpha are clamped to [0, 1] before the blend.agc_driver_graphicspins the decode andagc_driver_packed_unorm_blendthe result, and both fail without the change.main. Once they merge, please rebase and take the next free shader disk cache / request serializer numbers, as @oneandonlydean asked.Graphics.cppexpectations you changed (0x40050504) against its decode, and rerunagc_driver_packed_unorm_blendwith the validation layer on the rebased head.Not verified here: the console's rounding and clamp for this format (the debt line states the assumption).
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T04:02:30Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The last commit behaves as described: it builds, its tests pass under the validation layer with no
VUID-errors, and both negative controls fail. It cannot land yet, though: the head conflicts with currentmainin 7 files, and the PRs it depends on (#9020, #7243) are still open.What I ran
16a82db7af80158594b47341820f9e7c269ed573(one commit on #9020's head5f7287406a069f053e70a86b4e79220d12f2fece)main:b433c40f2f46aa2e59e19806010a839ac8572d64BUILD_TESTING=ONResults
mainb433c40f2fgit diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.main, validation layermain)VUID-linesmainwas not found but was requested by env var VK_INSTANCE_LAYERSVK_LAYER_KHRONOS_validationfor every test that opens a device (5 on head, 3 onmain)Undefined-Value-ShaderOutputNotConsumed-DynamicRendering: 10 onmain(4_4_4_4 partial write), 30 on head (10 each from 4_4_4_4 partial write, float blend and unorm blend)Merge conflicts with main
b433c40f2f(hunk count)Only the debt hunk touches a line of the last commit; the other hunks come from #9020.
Head test run (excerpt)
main test run (excerpt)
Negative control
The last commit is measured against its parent, #9020's head
5f7287406a.Graphics/include/State.hpp,Graphics/src/State.cpp,SpirvModuleEmitter.cppandShaderInputInfoBuilder.cppfrom the parent.agc_driver_graphicsthen fails withAGC graphics: blending into a 10_11_11 unorm color target is unsupported.agc_driver_packed_unorm_blenddoes not compile, because it calls the newPackedBlendControl(packing, control)overload.State.hppandState.cpp, so the execution test compiles, and restored onlySpirvModuleEmitter.cppandShaderInputInfoBuilder.cpp.agc_driver_packed_unorm_blendthen fails withShaderInputInfoBuilder: a color target merge into an unsupported packing.I then restored the head's files.
Findings
Blocking
main. The 7 files are listed above. MarcZX10 and oneandonlydean already reported conflicts on earliermaincommits. This confirms them onmainb433c40f2f, wheredocs/dev/debt/libSceAgcDriver.mdalso collides withmain's new "11_11_10 float CB resolve" entry. The request-serializer, disk-cache and journal conflicts belong to #9020. They still block this PR, because its head carries them.Graphics.cppexpectation for an additive 10_11_11 unorm blend has to be reconciled with #7243's test once that lands, as adriadam10 already noted. I have nothing to add there.Non-blocking
BlendPackedColorclamps the source to [0, 1] before every combine function (SpirvModuleEmitter.cpp:525-530), and that includes MIN and MAX (lines 555-556). The MIN and MAX cases in the test only use sources inside [0, 1] (PackedUnormBlend.cpp:450-451), so a regression that skipped the clamp for MIN or MAX would still pass. One MIN case and one MAX case with a component above 1 or below 0 would cover it.NMaxandNMinturn a NaN source component into 0. The console's behaviour for NaN underBLEND_CLAMPisn't stated anywhere, and the debt line (libSceAgcDriver.md:166) could name this assumption next to the rounding one.Otherwise I found nothing in the last commit itself:
PackedWriteMaskfields (0x7ff, 0x3ff800, 0xffc00000) match theFormat11_11_10UNormlayout of the plain export, which uses offsets 0, 11 and 22 and widths 11, 11 and 10.BLEND_CLAMP(bit 15 ofCB_COLOR_INFO) is required before the merge takes the blend (State.cpp:1721). That check is needed: the general unclamped-normalized check further down only runs whileblendEnableis still set, and the merge clears it.BLEND_BYPASSis already handled whereblendEnableis decoded.ShaderInputInfoBuilder(packing == None) refuses exactly the one remaining packing.Not verified
mainfor SPIRV-Headers, SPIRV-Tools and vorbis, not the head's.To get this to a good state
mainand merged, rebase this commit onto it. In the debt file, keepmain's "11_11_10 float CB resolve" line next to the two blend lines.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-29T17:15:43Z.
Review: CHANGES_REQUESTED
Reviewed the last commit again; nothing new in it to fix, and the points of the previous comment stand. It still can't land:
237ede9d9, request serializer 50) and #7243, both still open, and conflicts withmaininPipelineJournal.cpp,ShaderMemory.cpp,RequestSerializer.cpp,ShaderDiskCache.hpp,RequestSerializerTests.cppand the debt file.0x40050504expectation inGraphics.cppand rerunagc_driver_packed_unorm_blendwith the validation layer on the rebased head.Feel free to ping when the base has merged.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T20:29:55Z.
Review: APPROVED
Re-checked — approved
What changed: the head is rebased onto current
main. It carries the #9020 prerequisite as its own commit and follows the merged #7243. It takes request format 56, disk cache format 53 and pipeline journal format 16. It also adds MIN/MAX cases with sources outside [0, 1] and records the NaN-to-0 assumption in the debt file. The merged tree builds, the focused tests pass under the validation layer with noVUID-errors, and both negative controls fail as expected.What changed since my last review
16a82db7af, which was one commit on #9020's head. The head is now two commits onmain2a429a3108:01f8649dec: the attributed #9020 prerequisite, adapted to the current API.7b05c47249: the 10_11_11 unorm blend.Depends onis nownone. #7243 has been merged (per the thread), and the0x40050504expectation inGraphics.cppnow decodes to a merged target instead of throwing.main's 52 and 51, and rejects 50 and 53–55 (RequestSerializer.cpp:971).ShaderDiskCacheFormatVersion: 53, against 51 onmain.FileFormat16 (mainis at 15), andsizeof(State)936. The journal test checks that format 15 is rejected.PackedUnormBlend.cpp:456-457adds a MIN and a MAX case with a source component outside [0, 1].docs/dev/debt/libSceAgcDriver.md:228now states "NaN to 0".Graphics.cpp.What I ran
Head
7b05c472495812cdda97ffc68a4d7c835a44d9bc,main096c45570f516de76a43bbe1b97781381c84f55f, merged treeb6e01669bdba872bdc210df69ffce2ba88703f42.Machine: Debian 13 VM, 32 vCPU Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19).
main096c45570fgit diff --checkcheck_conventions.pyAll conventions checks passed.mainfailuresVUID-VUID-lines, nowas not found but was requestedagc_driver_packed_unorm_blendfails:ShaderInputInfoBuilder: a color target merge into an unsupported packingagc_driver_graphicsfails:AGC graphics: blending into a 10_11_11 unorm color target is unsupportedFocused run (excerpt)
The negative controls compare against the carried parent
01f8649dec, notmain. With all production files restored frommain, the tests could not compile: they need the prerequisite's API.Previous findings
main: Resolved. The script merged the head intomain096c45570fwithout conflicts. The debt file keepsmain's "11_11_10 float CB resolve" entry next to the two blend entries (lines 227–229).01f8649decwith attribution, and the checklist saysDepends on: none.0x40050504expectation now expects a merged target, as adriadam10 asked.PackedUnormBlend.cpp:456-457adds MIN and MAX cases with components at -0.25 and 1.5, and the test reports 16 single blends (it was 14). As the description says, these cases check the final packed value, not the order of clamping.docs/dev/debt/libSceAgcDriver.md:228states "NaN to 0", matching theNMax/NMinclamp atSpirvModuleEmitter.cpp:542-549.New findings
Blocking
None.
Non-blocking
agc_driver_pipeline_journaltook 43 s andagc_driver_graphicstook 35–37 s, with or without the layer. The author reports 38 s for the journal test onmain, and the NVIDIA CI comments show both tests near or above 30 s on earlier heads. I did not timemainon this machine, so I don't count this against the PR. Still,Graphics.cppgrows by about 100 lines here, and splitting it would keep it under the CONTRIBUTING limit.RequestSerializer.cpp:971) keeps those versions from being misread as 52 in the meantime.Other code I checked:
State.cpp:1850requiresBLEND_CLAMP(bit 15 of CB_COLOR_INFO at0x31c + slot * 0xf, the same addressing as line 1890) before taking a unorm blend.Requireremoved, everyWordPackedpacking (4_4_4_4, 11_11_10, 10_11_11) is handled byPackedWriteMask, which still throws for any other packing.0x7ff,0x3ff800,0xffc00000) are unchanged from what I checked last time.version >= 56u, and the v52 fixture covers the legacy layout.Not verified
mainon this machine.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T02:17:51Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected changes add single-sample 10_11_11 unorm blend and partial-write merges; I found no concrete defect, but did not run the checks needed to justify approval.
What I ran
Reviewed head
84d9a641da0d26ee62600afce924b1c72b90c10busing the prepared diff, manifest, and pinned reader. No build, test, or negative-control commands were run. The hardware test results in the PR description are author-reported.Results
Findings
Blocking
None.
Non-blocking
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp:551).Sources
Behavior claims were checked against the changed implementation and tests at the pinned head. The PR description reports three successful Windows/NVIDIA runs; those results were not independently verified.
Not verified
Build and test execution, Linux CI, AMD and Intel GPUs, physical console behavior, and the PR’s reported hardware runs.
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas read only at its changed lines; the rest of that file was excluded as too large. No changed files were excluded from changed-line review.To get this to a good state
Nothing is required. Optional: add NaN input cases to the execution test.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.