Repository navigation
fix(test): sample the anisotropic min/max rows without a mip filter - #7364
Merged
oneandonlydean merged 1 commit intoOct 18, 2026
Merged
Conversation
The two anisotropic rows of agc_driver_image_sample_reduction sampled a two-level texture at explicit LOD 0.25 and 0.75 through a point mip filter, and expected only the nearest level in the min or max. Vulkan leaves the anisotropic filtering scheme to the implementation, and only recommends that it consider mipmapMode, minLod and maxLod. On an RTX 4090 (NVIDIA 616.92) the min row returns 5, a level-1 texel, where level 0's bilinear minimum is 17, so the test fails on main there. The rows now use no mip filter, which the decoder turns into a host sampler with minLod and maxLod 0, so they read level 0 only, as the RDNA2 measurements without derivatives did (gfx1030 with no mip filter over a single-level texture, gfx1035 with image_sample_lz). They still throw if the min or max reduction with anisotropy is refused again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This follows #5821, which accepts a min or max reduction sampler with anisotropic filtering and added two anisotropic rows to
agc_driver_image_sample_reduction(tests/execution/ImageSampleReduction.cpp). On an RTX 4090 (NVIDIA 616.92, Windows 11), the first of them fails onmain, as @frankea reported on #5821:The problem is in the test, not the decoder. The two rows sample a two-level texture with
image_sample_lat an explicit LOD of 0.25 (even threads) or 0.75 (odd threads) through a point mip filter, and expect only the nearest level. At thread 0 (LOD 0.25), level 0's bilinear footprint is 17, 17, 20 and 20, and level 1 there is 5, so the 4090's 5 comes from level 1. #5821 expected these samples to stay isotropic, and so on the nearest level, because aLodoperand sets the derivatives to zero (textures.adoc L1376-L1378). But Vulkan leaves the anisotropic filtering scheme to the implementation. It only says that implementations should considermagFilter,minFilter,mipmapMode,minLodandmaxLod(textures.adoc L2777-L2783). So which levels an anisotropic sample reads through a point mip filter is up to the host driver, and on the 4090 it reads level 1 at LOD 0.25.The two rows now use no mip filter (
MipNone, named "no mip"), like the two existing "no mip" rows above them:minLodandmaxLodat 0 (GuestSamplerResource.cpp L126-L132), andSamplerpasses them tovkCreateSampler(Sampler.cpp L41-L42).MAX_LODat 0xfff (ImageSampleReduction.cpp L95); without a mip filter the decoder ignores it.[minLod, maxLod](textures.adoc L1697-L1703, L1726), so it is 0 on every thread. Level 1 then gets no weight even under a linear mip filter (δ = 0, L1824-L1826), and a min or max reduction only takes values with non-zero weight (L2761-L2765). So level 0 is the only level read, whichever mip mode the anisotropic scheme applies, as long as it honoursmaxLod. The anisotropic paragraph above asks for that, and the 4090 run and the negative control below show that NVIDIA and lavapipe do.This matches what was measured on RDNA2 without derivatives, where the sample reads level 0:
image_sample_lat LOD 0 through an S# without a mip filter, over a single-level texture.image_sample_lz.In both, min or max with anisotropic bilinear returned exactly the bilinear minimum or maximum, which is what the two rows expect.
The rows no longer check mip level selection under anisotropy, which Vulkan leaves to the host driver. The four point-mip rows without anisotropy still check it. The rows still check the reduction: at thread 0 a weighted average would be 17.45, not 17. They also still fail if the decoder refuses a min or max reduction with anisotropy again. Neither before nor after did these explicit-LOD rows check anisotropic filtering itself, since they expect the plain bilinear minimum or maximum;
agc_driver_graphics(tests/GuestSamplerResource.cpp L180-L197) checks thatanisotropyEnable,maxAnisotropyand the reduction reachvkCreateSampler. Only the test changes.Tested
Ubuntu 24.04, GCC 13.3, Release with
BUILD_TESTING=ON, onmain195d0d0. Locally, the libusb lines were removed fromCMakeLists.txt, because the libusb submodule isn't checked out here.agc_driver_image_sample_reductionpasses 5 of 5 runs on the RTX 3050 Ti and 3 of 3 on lavapipe.agc_driver_image*tests pass on the RTX 3050 Ti.main922dc89, the same two-row diff; the test,GuestSamplerResource.cppandSampler.cppare the same there as on 195d0d0):thread 0 sampled 5.000000, expected 17.000000;main31cbb55 (the tree of his first report), rebuilt from scratch, fails 3 of 3.Negative control: the unchanged rows pass on the RTX 3050 Ti and on lavapipe, so neither shows the 4090's result by itself. I tried a temporary local change that gives the host sampler a linear mip filter whenever anisotropy is on (
mipFilter == 2u || anisoat GuestSamplerResource.cpp L148; it is not part of this PR), so that the sample at LOD 0.25 also reads level 1, as on the 4090. With it:min, 2x anisotropic bilinear, point mip: thread 0 sampled 5.000000, expected 17.000000.thread 0 sampled 14.000000, expected 17.000000, which is 0.75 × 17 + 0.25 × 5: lavapipe's anisotropic path blends the two levels' minima, where the RTX 3050 Ti returns 5, the minimum over both levels that Vulkan's mipmap filtering gives for a min reduction (L2761-L2765).maxLod0 still keeps them on level 0.With the local change reverted, the test passes again on both.
tools/check_conventions.pyfrommainpasses with this title and body.@frankea, thanks for both 4090 runs: the report and the check of this change.
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)🤖 Generated with Claude Code