fix(agc): set color write masks per draw through dynamic state #16572
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16572"
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 oneandonlydean on 2026-11-07T05:49:23Z.
What
A pipeline took the color write masks of the draw that built it into its blend attachments, so draws that differed only in their masks each built a pipeline (or a fragment output library and a linked pipeline). With two color targets whose masks differ, for example one the pixel shader does not write, the attachments differ, and the validation layer reports
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605whenindependentBlendis not enabled.When the device supports
VK_EXT_extended_dynamic_state3colorWriteMask, the masks are now dynamic state. They are zero in the pipeline and left out of the pipeline and fragment output library keys. Every begin, continue, back-face and second-channel pass sets them from the draw's masked state: outputs the pixel shader lacks are masked, and the split alpha pass of an 8_8 target writes only green. Devices without the feature keep the masks in the pipeline as before, andAPS5_NO_DYNAMIC_COLOR_WRITE_MASK=1selects that path (documented indocs/dev/ENVIRONMENT.md).The new
agc_driver_color_write_mask_dynamictest draws with different masks, an unwritten second target and a split alpha target. It checks the pixels, that no pipeline is built or linked for a mask change, and the masks each recorded draw sets.Tested
Linux 7.2.3, NVIDIA GeForce RTX 4090, driver 610.57.04, Release,
BUILD_TESTING=ON, withVK_LAYER_KHRONOS_validation.^agc_suite: this branch 1327/1327 passed, maind48f11ab161326/1326.pAttachments-00605reports drop from 18 on main to 4. The 4 left are all inagc_driver_srgb8_color_targetand come from blend state other than the masks, so they are out of scope here.agc_driver_color_write_mask_dynamicon this head: passes with the dynamic path (0 validation errors) and withAPS5_NO_DYNAMIC_COLOR_WRITE_MASK=1(0 validation errors).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 gabichuuuuu on 2026-11-07T14:41:02Z.
Review: COMMENTED
A Windows NVIDIA run, the cell the description lists as not tested, on Turing.
Setup: Windows 11 x64, NVIDIA laptop GPU (Turing), driver 610, WinLibs GCC 15.2.0 r7 UCRT, Release, every AGC execution test built. Head
ac4ac99bb2merged ontomain4e44ed59b2(clean merge), withmain4e44ed59b2from the same build directory as the control.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,Selected GPUwas the NVIDIA GPU. No validation layer on this machine.agc_driver_color_write_mask_dynamicpasses in 9 of 9 runs and takes the full dynamic path:color write mask tests passed (dynamic write mask, pipeline libraries, recorded draws). So this driver exposesextendedDynamicState3ColorWriteMask.APS5_NO_DYNAMIC_COLOR_WRITE_MASK=1it passes on the baked path:(write mask in the pipeline, pipeline libraries, no recorded draws).agc_driver_pipeline_journal,agc_pipeline_journal,_long_pathsand_extended_pathspass 4 of 4 onmainand 5 of 5 with this PR.agc_driver_recorderpasses 4 of 4 onmainand 9 of 10 with this PR. The one failure was a 30 s timeout. In the five extra runs, two took about 17 s instead of 2 s, andcolor_write_mask_dynamicin the same runs took 15 s instead of 0.6 s.mainshowed the same kind of stall once (15 s), so I read it as this machine stalling rather than the change.AI-assisted: yes.