fix(shader): let image samples clamp their LOD on devices with shaderResourceMinLod #388
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/388"
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 DotDebian on 2026-10-02T17:05:08Z.
What
Every image sample with an LOD clamp (
image_sample_cl,_d_cl,_b_cl,_c_cl,_cl_o,_cl_a) fails to compile withclamps its LOD, which needs the device's shaderResourceMinLod, also on devices that have the feature.EmitSampleOplooked forCapabilityMinLodinstate.requirements.capabilities.AnalyzeProgramRequirementsnever fills that list, so the check could not pass. It now readsstate.supportedCapabilities, the target's list, whereVulkanDeviceputsCapabilityMinLodwhenshaderResourceMinLodis enabled.MinLodimage operand now declaresOpCapability MinLod. Nothing declared it.The gate is otherwise unchanged: the explicit-level path (level clamped with
FMax) still asks for the device feature, it only reads the right list.Tested
Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce RTX 5080.
ctest: 109/109 pass.New execution test
agc_driver_image_sample_lod_clamp(tests/execution/ImageSampleLodClamp.cpp). A compute shader samples a 16x16 texture with five mip levels, point filtered, where each texel stores its level and position:image_sample_d_cltakes theGradandMinLodoperands: the level read ismax(level of the gradients, clamp). The 32 threads put the gradient in each of the four derivative slots, on levels 0 to 4, against clamps 0 to 3.image_sample_clin a compute shader samples an explicit level 0 clamped withFMax: the level read is the clamp.mainwith the error above. It also fails when the emitter drops theMinLodoperand or theFMax(checked by hand, not part of the change).shaderResourceMinLod.Not tested: a title, a pixel shader (implicit LOD with
MinLod, the same operand path), the Vulkan validation layers (not installed here).Checklist
main; no other open PR implements the same functions (#226 adds more_clopcodes to the decoder, #303 edits the offset block ofEmitSampleOp; neither touches the capability check, both merge cleanly with this branch)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code