mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-08 13:50:20 +00:00
MoltenVK has no VK_EXT_image_view_min_lod, so since #130 the first T# with a MIN_LOD clamp above its base level threw. ASTRO BOT (PPSA21564 01.007.000) hits it on the title screen, about four minutes after boot. MoltenVK does offer shaderResourceMinLod, which maps the SPIR-V MinLod operand to Metal's min_lod_clamp. On a device with shaderResourceMinLod, without the extension and without graphics pipeline libraries, the new target flag shaderImageMinLod moves the clamp into the shader: - DescriptorBindingBuilder writes each direct image's clamp, relative to the view's base level and bounded by its last level and MAX_MIP, as a float specialization constant at MinLodBase + image. - Samples of direct images take it as the MinLod operand, or as an FMax on an explicit LOD when the clamp is above 0, combined with an instruction's _cl clamp. - The image view no longer chains the clamp there; image table entries with a clamp are still rejected, and devices with the extension are unaffected. APS5_NO_IMAGE_VIEW_MIN_LOD forces the shader lane. - It throws when the clamp sits above a paired S#'s MAX_LOD or has no mip filter, follows an explicit LOD or gradient with a nonzero S# LOD bias, pairs with a run-time S# or different min and mag filters, or meets image_get_lod, gathers at a clamp of a level or more, or the emulated depth-compare or 11:11:10 sample. - ValidateShaders accepts CapabilityMinLod when the device enables shaderResourceMinLod. - The flag is written after hostInterpolationFirst as request serialization version 53; older versions read it as false. The gaps, including llvmpipe applying the S# bias after the clamp, are recorded in docs/dev/debt/shader.md. Tested on an M-series Mac (MoltenVK 1.4.2, x86_64 under Rosetta): image_sample_lod_clamp samples a T# with fractional and level clamps over BASE_LEVEL 0 and 1 in both lanes, and fails without the shader clamp or with an absolute one; graphics, shader disk cache, shader memory and request serializer tests pass. PPSA21564 renders the title and reaches the warp sequence after it. Co-Authored-By: Claude Opus 5.5 <[email protected]>