fix(agc): key the pre-rasterization library by rasterizer discard #22058
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22058"
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 chitters2004 on 2026-11-17T03:35:57Z.
What
The pre-rasterization pipeline library bakes
rasterizerDiscardEnablefromstate.rasterizerDiscard, butlibraryKeys(Graphics/src/Pipeline.cpp) did not add it to the pre-rasterization part key. Two draws with the same shaders and raster state, one with rasterization discarded and one without, therefore shared whichever pre-rasterization library was built first. The later draw then ran with the other draw's discard setting: either nothing reached the fragment stage, or a pass meant to discard rasterized.Draws that set it include a position export with
POS_FORMAT0 (State.cpp) and the tessellation capture pass (Draw.cpp). This was found by reading the code; I have not seen it in a title.This PR adds
state.rasterizerDiscardto the pre-rasterization key. Only pre-rasterization libraries change; the vertex-input, fragment-shader and fragment-output keys do not.Tested
pipelineLibraryRasterizerDiscardTestsintests/Graphics.cpp, run byagc_driver_graphics. It prebuilds the same shaders with discard off, on, off, on and requires two pre-rasterization libraries, created with discardVK_FALSEand thenVK_TRUE. It also requires exactly one vertex-input, one fragment-shader and one fragment-output library. Without the fix it fails: only one pre-rasterization library is built.agc_driver_graphics,agc_pipeline_library_clear_waits_for_buildandcolor_write_mask_dynamic.python3 tools/check_conventions.py --base origin/mainpasses.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-17T09:35:25Z.
Review: COMMENTED
Tested on macOS 27.2 on an Apple M4. This is an x86-64 build under Rosetta with Apple clang 21.0.0, on MoltenVK 1.4.2 from the LunarG Vulkan SDK 1.4.363.1.
Method. The base was
mainata72186d3cfplus #22056 and #22074, which fix the macOS build of two other targets; both have since merged. I built the base and this PR merged onto it (a clean merge) in two separate build directories. I ran them alternately, base then PR, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer: five runs each, sinceagc_driver_graphicsis known to be flaky:agc_driver_graphicsagc_pipeline_library_clear_waits_for_buildand the 3color_write_mask_dynamictestswas not found but was requestedVUID-linesEvery
agc_driver_graphicsfailure, on both sides, is the same pre-existing intermittent one:AGC graphics: two ranges under a budget for two were not imported, after MoltenVK refuses a host import (vkAllocateMemory (-2)). The difference between 1 and 2 failures in 5 runs is within that flakiness. The PR's change doesn't touch host imports.Negative control. I kept this PR's test and restored the base's
Graphics/src/Pipeline.cpp. Thenagc_driver_graphicsfails 3 runs out of 3 witha draw that discards rasterization shared a pre-rasterization library with one that does not. So the new mock test catches the bug on macOS too.I didn't run a title.
Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-18T14:42:10Z.
Review: COMMENTED
Tested on NVIDIA hardware, since the description's runs are on lavapipe and the fork's Windows CI.
Setup: Windows 11 Pro (build 26300), AMD Ryzen 5 3400G, NVIDIA GeForce RTX 2060 (driver 621.24), WinLibs GCC 15.2.0, Release. Base:
main28a71b481ewith #22373 (a test-build fix only). "This PR" is the same tree with head5a79dca262merged.10 tests, 3 runs each, with
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1(ctest -V, validation layer 1.4.363):agc_driver_graphics(which runs the newpipelineLibraryRasterizerDiscardTests),agc_pipeline_library_clear_waits_for_build, the threeagc_driver_color_write_mask_dynamic*tests and the fiveagc_pipeline_library*recorder tests.not foundlinesVUID-mainNo new validation errors on NVIDIA.
AI-assisted: yes (Claude Code)
Pull request closed