mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-31 12:35:51 +00:00
MoltenVK exposes VK_KHR_fragment_shader_barycentric but its MSL step rejects PerVertexKHR, so the extension is disabled there and a pixel shader whose I/J VGPRs outlive their v_interp_p1/p2 pairs takes the generated barycentric stages, which accept only triangle lists without primitive restart on a device without geometry shaders. A new target flag, fragmentBarycentricBuiltins, enables the extension for its built-ins only. The host interpolation check then keeps the leftover I/J reads (all perspective or all linear, at the fragment's default position) and reads them from BaryCoordKHR or BaryCoordNoPerspKHR, while the interpolated attributes stay hardware varyings. Raw vertex parameters and I/J at an offset or a sample position still take the generated stages. Apple GPUs return unnormalized perspective weights unless the fragment function reads [[position]], so each perspective read keeps a neutral use of gl_FragCoord.w, loaded as a float. Devices with the full extension are unaffected; the request serialization moves to version 45. Co-authored-by: yripper <[email protected]>