mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-03 12:57:27 +00:00
Village's 2x checkerboard puts its two samples at x = +4/16 and -4/16 and swaps their indices on odd rows. On a device without a 2x2 sample location grid every pixel takes pixel (0,0)'s locations, so the odd rows hold the console's sample 1 in sample 0 and the reverse: a pass that reads the samples by index, as checkerboard reconstruction does, exchanges the two half-pixels of every odd row, and SampleID, sample masks and exported coverage name the wrong samples there. Such a pattern holds one set of positions in every pixel, so drawing with pixel (0,0)'s locations is exact up to the order of each pixel's samples. The draw now keeps the guest's order: the pixel shader reads SampleID, applies the sample mask and exports coverage through each pixel's order, and every render pass drawing with the stand-in puts the samples of its multisampled attachments in the stand-in's order before it and back in the guest's after it. Color targets do that through a storage view of their texels as unsigned integers, depth through a copy and a per-sample pass writing FragDepth, and stencil through VK_EXT_shader_stencil_export or one pass per bit. It needs shaderStorageImageMultisample with a storage view of the color format, sampleRateShading, and a depth format FragDepth writes back exactly (16-bit or 32-bit float); otherwise, and for patterns whose pixels hold different positions, the stand-in alone is used, and the log line says why. Devices with the grid are unchanged. Recompile requests carry the order as serialization version 32 (#6470 takes 31), and the shader cache format becomes 40 (open pull requests take 37 and 39).