Repository navigation
Conversation
|
AI-assisted. Tested c9a4a82 on Windows 11 with an NVIDIA GeForce RTX 4090 (driver 32.0.16.2101) and AMD Radeon Graphics (driver 32.0.21043.5001). The MinLod fallback passes on both devices. I used the hand-written vs_ids and ps_texture_grad_cl_a16 listings. I enabled MIN_LOD_FALLBACK in the translator and assembled its output with tools/spirv_asm.py. I ran vk_texture_test with --two-mip. I checked all 4,096 pixels with texture_gradient_a16_test on each device. All pixels match. The device line confirms each adapter. I selected the AMD driver with VK_LOADER_DRIVERS_SELECT=amd. I ran the six changed Python test files with CPython 3.14.7 in isolated mode. They ran 227 tests. One test skipped. The other 226 passed. On merge base d0835dd, the seven fallback tests report 13 subtest failures and two errors. |
|
Tested at GPU & Subgroup Probe Verification
Python & Docs Suites (
|
c9a4a82 to
c4d567e
Compare
|
Tested Native
So with anisotropy off the fallback matches Finding: under an anisotropic sampler the clamp can be missed, not only the extra taps. The shader can't see whether the sampler is anisotropic, so there may be no exact fix. Two options:
An NVIDIA-only effect that explains the isotropic half. The 216 differing pixels in the top half all go the other way: the fallback reads coarser than the clamp. On this driver, explicit isotropic gradients through an anisotropic sampler give a larger LOD than they should. A plain
The min/mag filter doesn't change this. Native I didn't run 1D, 3D or array targets: AI-assisted (Claude Code). |
Kam471
left a comment
There was a problem hiding this comment.
Ran this at c4d567e91 on Windows 11: pytest tests/test_min_lod_fallback.py tests/test_make_game_translator_flags.py tests/test_make_game_argparse.py tests/test_make_game_preflight.py tests/test_make_game_wave64.py -q -> 189 passed, 1 skipped, 85 subtests passed; git diff --check clean.
--min-lod-fallback is threaded through make_game.py, the shader build and the GPU runner, with the translator lowering image_sample_d_cl for devices without shaderResourceMinLod (the Intel path); the added tests cover the flag wiring, the translator form and the unchanged default. No blocking issue.
|
Thank you for the measurements. The finding is right and follows from the code: Pushed d7a83cf, docs only: the The isotropic-half effect you saw (explicit gradients read a larger LOD through an anisotropic sampler on NVIDIA) only touches the fallback path, which runs where |
|
Measured anisotropic samplers on the Intel UHD 770 (driver 32.0.101.6129) with the flag, as the "not tested" line promised. Windows 11, MSVC 14.51, Python 3.13.1, built from Pixels read, per half (2048 each), from the raw output:
( |
Item: new SHADER/TEST item, claimed at #4571 (comment) (from my finding #4571 (comment)). Independent of #3058, which adds the other
_clforms.What broke.
image_sample_d_clis translated toGrad|MinLod, which needs the coreshaderResourceMinLodfeature. The Intel UHD 770 (driver 32.0.101.6129) does not have it, so the 29 of the 12,101 pixel shaders (one build's index) that declareMinLodcannot be created there (4 of the 480 in the #4628 sweep;vk_ps_sweepreports "unsupported: shaderResourceMinLod"). Repro without game data:LEONIDA_VK_DEVICE/VK_LOADER_DRIVERS_DISABLE=*nv*on that machine andpython -I scripts/run_gpu_tests.py --filter ps_texture_grad_clgives SKIP.Fix. A new translator flag
--min-lod-fallback. The clamp is applied to the gradients instead: the footprint rho^2 = max(|dxsize|^2, |dysize|^2) is measured in level-0 texels (OpImageQuerySizeLod), and where rho^2 < 4^minlod the gradients become an isotropic footprint of 2^minlod texels on their own axes (OpSelectbetween the new and the shader's own gradients). Otherwise they are unchanged, so that case is exact. The module then declares noMinLod. Known difference: a clamped sample takes no extra anisotropic taps along the stretched axis (written up indocs/design.md).make_game.pyturns the flag on by itself when the runtime's GPU lacks the feature:tools/vk_subgroup_info.pynow reportsshader_resource_min_lod(coreVkPhysicalDeviceFeatures, 43rd member), and--min-lod-fallbackis inFALLBACK_FLAGS, so it is recorded with the translation and a change retranslates.LEONIDA_MINLOD_FALLBACK=1does the same forruntime/test/shaders/build.pyandscripts/run_gpu_tests.py.Tests.
python -I tests/test_min_lod_fallback.py(7 tests, synthetic listings: with and without the flag, 1D / 2D / 2D array / cube / 3D / a16, the selected gradients, the unclamped arm kept, the clamped footprint on its own axis, other samples unchanged),tests/test_vk_subgroup_info.py(49),tests/test_make_game_*.py(the new device-follows test, and the four files that mock the probes now mock this one too),tests/test_docs_*.py,tests/test_ctest_registration.py.scripts/run_gpu_tests.py --filter ps_texture_grad_cl(the existing two-mip GPU test, a clamp of 0 left of x = 32 and 1 right of it), 4096 pixels each:LEONIDA_MINLOD_FALLBACK=1Negative control.
tests/test_min_lod_fallback.pywithtools/rdna2spirv.pyfrom upstream/main: 13 failures and 2 errors (no flag, stillMinLod). GPU: with the clamp test inverted (OpFOrdGreaterThanforOpFOrdLessThan), the Intel run fails with 2048 of 4096 pixels differing (the right half reads mip 0 instead of cyan).Not tested: 1D, 3D and array targets on a GPU, anisotropic samplers, and real corpus shaders on Intel (I will post that on this PR from the #4628 sweep).
AI-assisted.