Repository navigation
Conversation
… on Intel's Windows driver (ItsNotRexed#7030) Intel's Windows Vulkan driver (101.9175, Arc 140V) drops the MinLod operand of an implicit-LOD sample that also carries a Bias, so ps_texture_b_cl reads mip 0 on the half where the clamp asks for mip 1. MinLod alone, Bias alone and Grad|MinLod are right on the same driver. With --bias-minlod-grad, a pixel-shader image_sample_b_cl / image_sample_c_b_cl becomes OpImageSample(Dref)ExplicitLod Grad|MinLod (Grad|Offset|MinLod for _o), with the quad derivatives of the spatial coordinates scaled by exp2(bias): the same LOD and anisotropy. Grad samples are slower on some GPUs, so it is a fallback: - tools/vk_subgroup_info.py reports bias_minlod_grad for driver ID 5 (Intel proprietary Windows); - make_game.py, scripts/run_gpu_tests.py and runtime/test/shaders/build.py turn the flag on there, LEONIDA_BIAS_MINLOD_GRAD=1/0 overrides, and make_game records it with the other fallback flags. Tests: tests/semantic/test_sample_cl.py (shape, bias source, array layer, offset order, other forms unchanged), tests/test_vk_subgroup_info.py, tests/test_make_game_translator_flags.py, tests/test_run_gpu_tests.py. Not run on Intel hardware. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent Linux GPU comparison at ad05b5b. On Bazzite 44 I pinned each 64-bit Vulkan ICD in turn and verified the physical device in vk_texture_test’s output.
The target was ps_texture_b_cl, with ps_texture_cl, ps_texture_grad_cl_a16 and ps_texture_bias_a16 as controls. On each GPU, check.py’s per-pixel oracle passed all 4,096 pixels for each case. The separate raw readbacks matched byte for byte with the fallback on and off and across the two GPUs. On the target shader I confirmed the generated instruction changed from implicit LOD with Bias|MinLod to explicit LOD with Grad|MinLod. I used build.py twice with LEONIDA_BIAS_MINLOD_GRAD=0/1. All five synthetic shaders in each build (including the shared vertex shader) passed spirv-val. The 17 test_sample_cl tests passed. Built in Fedora 44 with GCC 16.2.1, LLVM MC 22.1.8 and SPIRV-Tools v2026.1, then ran the native binary against the host drivers. This establishes equivalent output for these fixtures on NVIDIA and RADV. The original Intel Arc 140V / Windows driver case in #7030 still needs a hardware run. No game data. AI-assisted with Codex. |
|
Tested
Synthetic project fixtures only. AI-assisted: yes (Codex). |
|
Tested
Synthetic fixtures only, no game data. AI-assisted. |
|
Tested ad05b5b (merged locally onto main dde82f2, no conflicts) on RTX 5060 Ti, NVIDIA 621.24, Windows 11 (26300): pass. No game files involved. Runtime built from main with
Per-test PASS/FAIL/SKIP status is identical across the three runs. The one failure,
Checked that the fallback really kicks in (
So on NVIDIA the The PR's CPU tests pass too: Run with an AI assistant (Claude Code). |
|
Tested ad05b5b on NVIDIA GeForce GTX 1660 (Turing, TU116, subgroup 32..32), driver 620.73.04 (proprietary, Vulkan 1.4.357), Arch Linux (kernel 6.18): pass, no regression. Native build of runtime/ from this head (Ninja, RelWithDebInfo, clang 23.1.5), llvm-mc 23.1.5, SPIRV-Tools v2026.4.
AI-assisted run (Claude). Synthetic programs only, no game files involved. |
|
Tested ad05b5b on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
Fixes #7030. Claim: #7694 (comment)
@ItsNotRexed
The bug
Intel's Windows Vulkan driver (101.9175, Arc 140V) drops the
MinLodoperand of an implicit-LOD sample that also carries aBias:ps_texture_b_clreads mip 0 on the right half where the clamp asks for mip 1. On the same driverMinLodalone (ps_texture_cl),Biasalone (ps_texture_bias_a16) andGrad|MinLod(ps_texture_grad_cl_a16) are right.The fix
A translator fallback,
--bias-minlod-grad. A pixel-shaderimage_sample_b_cl/image_sample_c_b_clbecomesOpImageSample(Dref)ExplicitLodwithGrad|MinLod(Grad|Offset|MinLodfor_o). The gradients areOpDPdx/OpDPdyof the spatial coordinates (not the array layer), timesexp2(bias). Scaling the footprint by 2^bias addsbiasto log2 of it, so the LOD and the anisotropy are those of the implicit sample. The sampler's own bias and LOD clamps apply to both forms alike. The one difference is themaxSamplerLodBiasclamp on the shader bias, which Grad does not apply.texel_offset_foldalready scales the derivatives the same way for--texel-offset-fallback.A Grad sample is slower than an implicit one on some GPUs, so the translator does not use this form by default. It follows the
--bary-fallbackpattern from #6828:tools/vk_subgroup_info.pyreportsbias_minlod_gradfor driver ID 5 (VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS).make_game.py,scripts/run_gpu_tests.pyandruntime/test/shaders/build.pyturn the flag on there.LEONIDA_BIAS_MINLOD_GRAD=1/0overrides it.make_game.pyrecords it with the other fallback flags, so a change retranslates. It also keeps it when the probe can't answer, the same as the other flags.docs/design.mdmin-LOD row and thedocs/testing.mdtroubleshooting table describe it.Tested
Windows 11, CPU only. No Intel GPU here, so
ps_texture_b_clon an Arc is not tested. A run on an Arc under Intel's Windows driver with this branch would confirm it:python -I scripts/run_gpu_tests.py --build <build> --filter ps_texture_b_cl.tests/semantic/test_sample_cl.py: newBiasMinLodGradcases check the Grad|MinLod shape, thatexp2reads the bias VGPR and scalesOpDPdx/OpDPdyof the sampled coordinate, the array layer having no derivative,Offsetcoming betweenGradandMinLod,_c_b_cl, the other forms staying unchanged, and the flag being off by default. Aspirv-valcase runs where SPIRV-Tools are installed, as in CI. I had no SPIRV-Tools locally, so CI runs it.tests/test_vk_subgroup_info.py,tests/test_make_game_translator_flags.py,tests/test_run_gpu_tests.py: the probe, the CLI and environment precedence, and the recorded flag order. The existing tests that mock the barycentric probe now mock this one too.scripts/run_semantic_tests.py tests/semantic): 446 files and 5,958 tests.test_image_atomics_guardandtest_image_store_d16fail the same way on unmodifiedmain.No game data. AI-assisted (Claude Code).
🤖 Generated with Claude Code