feat(agc): rasterize sample locations that vary between pixels through a 2x2 grid #5861
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5861"
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 simonbronk on 2026-10-14T14:02:10Z.
What
Onimusha: Way of the Sword (PPSA27836) and Resident Evil Village (PPSA01556, #5169) render with two-sample checkerboard rendering. Their
PA_SC_AA_SAMPLE_LOCS_PIXEL_*registers differ between the pixels of the guest's 2x2 grid:That is samples at (+4, 0)/16 and (-4, 0)/16 on even rows, swapped on odd rows.
decodeSampleLocationsthrew "nonstandard sample locations varying between pixels are unsupported".VK_EXT_sample_locations takes such a pattern as a sample location grid.
VkSampleLocationsInfoEXTindexes it as(x + y * width) * samplesPerPixel + i, which is the guest's register order (X0Y0, X1Y0, X0Y1, X1Y1). The draw state rule refuses a nonzero window offset, so the host framebuffer origin is the guest's and the grid lines up.Statekeeps the locations of all four pixels (sampleLocationsgrows to 32 bytes, pixel * 8 + sample) and setssampleLocationGridwhen they differ.SampleLocationGridgives 2x2 or 1x1, andSampleLocationsfills the grid in Vulkan's order.VkMultisamplePropertiesEXT::maxSampleLocationGridSizeis a multiple of 2x2 (sampleLocationGridSampleCounts). A pattern varying between pixels on any other sample count throws, naming the grid.docs/dev/debt/libSceAgcDriver.mdare updated.The per-sample-count query matters:
VkPhysicalDeviceSampleLocationsPropertiesEXT::maxSampleLocationGridSizeon the RTX 5070 is 1x1, butvkGetPhysicalDeviceMultisamplePropertiesEXTgives 2x4 for 2 samples, 2x2 for 4 and 1x2 for 8. The AMD iGPU gives 2x2 for each. So both GPUs here take the checkerboard pattern.Tested
main5a6ad0ed3:ctest -j 8on the RTX 5070: 1183 of 1184 pass;check_main_syncfails on a Windows code page and is unrelated;ctest -R "agc|shader|video_out"on the AMD iGPU: 551 of 554 pass;agc_driver_lds_mixed_width_atomics,agc_driver_pixel_interlockandagc_driver_layered_volume_vertex_no_gplfail as listed in #5271 for this GPU.agc_driver_graphics: the old refusal case (a standard 2x pattern with the samples swapped in one pixel) now decodes as a grid. The games' pattern decodes as a 2x2 grid with the locations in Vulkan's order.ValidateSampleLocationsrefuses it without grid support for 2 samples and accepts it with it. A uniform 4x pattern stays 1x1.agc_pipeline_library(on the GPU): a grid pattern builds its own fragment shader and fragment output libraries, and the uniform pattern is reused afterwards. It passes on both GPUs.python tools/check_conventions.py --base upstream/main: passes.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 — not applicable.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T14:22:22Z.
Checked the decode against the register order and the Vulkan grid indexing (
(x + y * width) * samplesPerPixel + i), the 2x2 divisibility ofmaxSampleLocationGridSizeper sample count, the key changes (library, pipeline, draw) and the debt entry.agc_driver_graphics, the recorder and prepared graphics tests pass locally, and the new graphics test does not build without the change. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T18:56:15Z.
For the record, on an RTX 3070 Laptop GPU this check stops Resident Evil Village (PPSA01556, 01.210.000) during its title screen:
Windows 11 (10.0.26300), driver 617.42,
maine34c47921. The draw uses 2 samples, and for that count this GPU doesn't report a sample location grid that's a multiple of 2x2. Before this PR, our older stack from 2026-10-13 stopped at the same point with "nonstandard sample locations varying between pixels are unsupported".Village needs local changes to reach the title on this 16 GB PC: #5851, #5703, #5815's two commits, and local commits that prepare shaders at their first draw and fix title-stage stops. The run also carried an unrelated overlay branch. Locally we approximate by using pixel (0,0)'s locations for every pixel, a workaround that isn't for merging.