fix(shader): fall back to barycentrics for a pixel input read through both I/J pairs #15793
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15793"
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 root-over on 2026-11-04T15:28:04Z.
What
On a device that takes the host interpolation path, Genesis Plus GX (PPSA99921, catalog v2.2.1) stops before its menu. On lavapipe, which has mesh shaders but not
VK_KHR_fragment_shader_barycentric,mainstops with:The pixel shader reads attribute 0's x and y through one I/J pair (
v_interp_p1/p2 ... v0/v1) and its z through the other (v2/v3). Host interpolation gives each input one Vulkan interpolation decoration, so it can't express that.Recompilealready has a way out: whenHostInterpolationChecker::Lowerreturns false, the shader is translated again with barycentrics (native or emulated), and eachv_interpis then computed from the pair it reads. The checker never got that far, because it calledShaderPixelInputInfo::InputIsLinear, which throws for an input in both masks.HostInterpolationChecker::Lowerreturns false whenpixelLinearInputs & pixelPerspectiveInputsis non-zero, so such a shader takes the barycentric path.agc_shader_memoryused to expect the throw for its two-pair shader. It now requires the compile to succeed with barycentric emulation active for both the smooth and the linear barycentrics.A device with neither native barycentrics nor mesh shaders still can't run this shader, and stops at the existing "reads barycentrics, and this device has neither ..." error. #9387 covers that case.
Tested
Ubuntu, kernel 7.0, GCC 15.2.0, Release. Ryzen 5 5625U iGPU (Vega/GCN 5, RADV RENOIR, Mesa 26.0.8) and lavapipe (Mesa 26.0.8, LLVM 21.1.8) on the same machine.
Title. Genesis Plus GX v2.2.1 (catalog zip, SHA-256 matches), no ROMs, 45 s:
maindevice does not support mesh shaders/ barycentrics stop (no mesh, no barycentrics)mainFocused tests. The same 11 tests on
mainand this PR,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V -j1:agc_interpolant_mapping,agc_driver_interpolation_f16,agc_driver_interpolation_modes,agc_driver_mesh_barycentric_emulation,agc_driver_mesh_provoking_vertex,agc_driver_pixel_barycentric_emulation,agc_driver_pixel_exec_interpolation,agc_driver_mesh,agc_fragment_barycentric,agc_shader_memory,interpolation_reference_range.mainwas not found but was requested, and every log has 0VUID-.tools/check_conventions.pypasses.tools/pr_overlap.py: no open PR touchesHostInterpolationChecker.cpp; several touch the sharedtests/ShaderMemory.cpp, none of themverifyPixelInputs.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 Superseabas on 2026-11-04T17:09:45Z.
Review: APPROVED
Head
31317e522bmerged onto currentmainb11c7bf84f(clean merge, local only): code read, red/green check and a Windows run on NVIDIA and on AMD's Windows driver.Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (
x86_64-ucrt-posix-seh, r3), Release,BUILD_TESTING=ON.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -R '^(agc_shader_.*|agc_driver_.*interpol.*|agc_driver_.*barycentric.*)$',ANYPS5_GPUselecting the device (confirmed bySelected GPU):main10de:2c05)1002:164e)agc_driver_mesh_barycentric_emulationon the iGPU on both sides. There are noVUID-lines and no missing-layer line in any run.HostInterpolationChecker.cpptaken back frommainfailsagc_shader_memorywithpixel input 0 is interpolated through both a perspective and a linear I/J pair. With the PR's checker it passes.check_conventions.py --base mainpasses on the merge.hostInterpolationFirst=0, andFragmentShaderBarycentricUsableholds for both drivers. So the real-device path is the one this change falls back to, not the host interpolation it fixes. This run checks for regressions on these drivers.Read through the change: the new early
return falseinHostInterpolationChecker::Lowersends a shader with any input in bothpixelLinearInputsandpixelPerspectiveInputsback toRecompile. There it is translated again withfragmentShaderBarycentricEnabled, as on a device with native barycentrics, beforeInputIsLinear(which throws for such an input) is reached at lines 84 and 98. The test now requires both smooth and linear barycentric emulation for the two-pair shader. A shader whose inputs each use one pair still goes throughLoweras before. I found nothing to change.AI-assisted: yes (Claude Code)