fix(agc): prefer host interpolation on RADV to avoid the quad seam #10547
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10547"
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 mrfelek on 2026-10-24T09:32:06Z.
What
On RADV, a pixel shader that reads its inputs through VK_KHR_fragment_shader_barycentric (PerVertexKHR + gl_BaryCoordKHR) gets the second triangle of a full-screen quad with per-vertex values in an order that does not match gl_BaryCoordKHR. Full-screen passes then show a diagonal seam where one triangle's UVs are swapped. Hollow Knight: Silksong's final copy pass shows it on a Radeon 780M on Linux; NVIDIA and the AMD Windows driver are clean.
The device now sets a new
SpirvTarget::hostInterpolationFirstflag on RADV. With it, a pixel shader is first translated with host interpolation, and only a shader thatHostInterpolationCheckercannot lower is translated again with native KHR barycentrics (never the geometry or mesh emulation, since the device has the extension). Other drivers are unchanged. The flag is part of the shader cache key, andAPS5_NO_HOST_INTERPOLATION_FIRSTturns it off.Turning KHR barycentrics off on RADV entirely also removes the seam, but sends shaders that need barycentrics to the emulation paths, which aborts Diablo II Resurrected (a pixel shader reading barycentrics without a vertex shader) and Hot Wheels Infinite Rush (mesh-path emulation needs more than 32 KiB of mesh output), so this keeps KHR for those.
Tested
Linux, Radeon 780M (RADV PHOENIX, Mesa 26.0.8), main
15e71dbe11vs this change on it (rebased ontofe204e1a8dsince, no conflicts in these files):APS5_NO_HOST_INTERPOLATION_FIRST=1the seam is back. 600 presents / 10 s on both.agc_shader_memory(newverifyHostInterpolationFirst),agc_fragment_barycentric,request_serializer,agc_shader_disk_cache,agc_shader_device_profilepass onfe204e1a8d.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, the 13 tests matching interpolation, barycentric emulation, sample order/iteration, implicit derivatives, shader memory, serializer and disk cache pass on main and on the change; both logs have the same two VUIDs fromagc_driver_sample_order(already on main), the change adds none.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)AI-assisted. Tested by me on my own machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T10:39:24Z.
Review: APPROVED
Reviewed the driver gate, fallback path, cache-key addition, and shader-memory coverage. The target flag is enabled only for RADV and only when KHR fragment barycentrics are available; host interpolation is attempted first, and shaders the checker cannot lower are translated again with native barycentrics without entering emulation. The cache key includes the new target choice, and the environment override is documented. I manually checked the overlap warning against #10046: it changes the tessellation pipeline-cache policy at the same Vulkan initialization area, but does not duplicate or depend on this interpolation behavior. The contributor reports the 13-test Vulkan validation set and title checks described in the PR passing; hosted eligibility/conventions/intake/labels/report pass, while hosted build jobs were skipped. I did not rerun GPU tests locally.