fix(agc): fall back to pixel (0,0)'s sample locations where the device has no 2x2 grid #6451
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6451"
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 EagleBearerYS on 2026-10-15T16:02:41Z.
What
A draw whose MSAA sample locations vary between the pixels of the guest's 2x2 pattern (
PA_SC_AA_SAMPLE_LOCS_PIXEL_*) threwon a device whose
maxSampleLocationGridSizefor the draw's sample count is not a multiple of 2x2 (#5861's refusal,ValidateSampleLocations). An RTX 3070 Laptop GPU reports 1x1 for every count, so Resident Evil Village's 2x checkerboard pattern stops there before the title.The pipeline now decides the grid when it is created:
X0Y0, and the pixel the guest's grid is anchored at.[gpu] no 2x2 sample location grid at sample count N ....Pipeline::Begintakes the pipeline's grid forVkRenderPassSampleLocationsBeginInfoEXT, so a sample-location-compatible depth image is begun with the locations it is drawn with.What differs from the console (recorded in
docs/dev/debt/libSceAgcDriver.md):Out of scope: reproducing such a pattern exactly on a device without the grid. For patterns whose pixels share one set of positions, as Resident Evil Village's do, exact emulation needs more work and is outside this PR.
The pipeline-creation cost is two branches. On the draw path,
Pipeline::Beginloses one call (SampleLocationGrid(state)becomes a member load), and the store lookup andContinueare unchanged.Tested
Resident Evil Village (PPSA01556), Windows 11, RTX 3070 Laptop GPU (driver 617.42):
6ea62f9b40with #6366 and #5703 (open), plus two local commits for its next stops (the depth and colour sample counts), Resident Evil Village stopped before its title with:[gpu] driver failure: AGC graphics: sample locations varying between pixels require a 2x2 sample location grid for the draw's sample count(Pipeline.cpp:120).Linux, lavapipe (Mesa 25.2.8). Lavapipe has no
VK_EXT_sample_locationsand no 2x MSAA, so the device capabilities are simulated with a mockContextanddeviceProc.New
agc_driver_sample_location_grid_fallbackdecodes Resident Evil Village's registers and builds pipelines through both pipeline paths, with and without a 2x depth target:Pipeline::Prebuild);Pipeline,AcquireFramebuffer,Begin).It checks every
VkSampleLocationsInfoEXThanded tovkCreateGraphicsPipelinesandvkCmdBeginRenderPass:{1,1}, (0.75, 0.5) (0.25, 0.5);{2,2}, all eight locations;Red on main, green here. On main it fails with the refusal above, as does the updated
agc_driver_covered_centroid_state.Mutants are caught: always falling back, never falling back, and a
Beginthat ignores the pipeline's grid.CI Linux configure and build, plus
tools/check_test_registration.py build: pass.ctest -R '^agc': 602/602 (main 601/601).The new and changed tests with
--repeat until-fail:10: 10/10 each.tools/check_conventions.py: passes, with no comments added.Windows (GitHub's runner, MinGW, mock device; run): with
main's implementation,agc_driver_sample_location_grid_fallbackandagc_driver_covered_centroid_statefail with "sample locations varying between pixels require a 2x2 sample location grid for the draw's sample count", andagc_driver_graphicsfails too. With this branch they pass 5 of 5, and 595 of 596^agctests pass (463 skip without a Vulkan device). The one failure,agc_driver_pm4_replay_tool(0xc0000139), and libkernel'sguest_kqueuefail onmainon that runner too.Merged with
main, on GitHub's runners:f474fb7768(d06d3eea86), which brings #5907:agc_driver_sample_location_grid_fallback,agc_driver_graphics,agc_driver_covered_centroid_stateand the tests tied to the changed files (11 in all) pass 3 runs in a row on Linux and Windows (run). The suites' only failures were libc'sprecise_waiton Linux, a timing test, and libkernel'sguest_kqueueon Windows, which fails onmainon that runner too.d7262bd6d6(cebbd414eb) and1e4ec0e3f7(d25edc98f7, the head), each with a conflict only in shared lists (the debt file's entries, the graphics tests' run list), both sides kept. At the head (run), the^agctests pass on Linux (650, 0 failed) and the libc and libkernel suites pass. On Windows the only failures areagc_driver_pm4_replay_toolandagc_shader_replay_tool, which fail the same way on that runner for an unrelated branch (run), andguest_kqueue.Checklist
mainf633042df, merged withmainf474fb7768,d7262bd6d6and1e4ec0e3f7; no other open PR implements the same functions (#5907, merged, extended the same check to one sample, see Depends on)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file (none added).mdfiles or images added to the repository (attach them to this PR)mainf474fb7768(d06d3eea86) made the three changes for that order:enabledline and dropped the gridRequire;expectFailure(... "2x2 sample location grid")into an acceptance.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T16:37:07Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/CMakeLists.txtL2647, L2650core/libs/prx/libSceAgcDriver/tests/Graphics.cppL9929Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by MaxLikesCode on 2026-10-19T03:27:14Z.
A run on a real device without the grid: NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ONwith every execution test built.vulkaninforeportsmaxSampleLocationGridSize1x1 andvariableSampleLocationstrue, so this is the case the fallback is for. This head (b6489b863) merged intomainad502d717.agc_driver_sample_location_grid_fallback,agc_driver_covered_centroid_stateandagc_driver_graphicspass.CMakeLists.txt): 1522 pass, 15 skip and 4 fail. The failures are the onesmainhas on this GPU without this PR:agc_driver_bda_device(#7584),agc_driver_image_table_reuse(#7710),agc_driver_pixel_lds(#7708), and a load-dependentagc_driver_storage_file_writethat passes when rerun alone.[gpu] no 2x2 sample location grid at sample count .... So on a real device the fallback was not reached, and only the mock tests exercise it.AI-assisted: yes (Claude Code)