test(agc): leave the LOD bias -192 case out on lavapipe before Mesa 26.1 #27777
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27777"
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 peacocksir on 2026-11-27T10:26:23Z.
What
Since #23992 changed the clamped LOD case's bias from -96 to -192,
agc_driver_image_sample_lod_clamp_shader_lanefails on Mesa lavapipe 25.2.8:As #23992 says, -192 also separates clamp-then-bias from bias-then-clamp. Vulkan biases first: λ' = λbase + mipLodBias, then λ is clamped to max(minLod, the instruction's MinLod). Thread 5 has λbase -1.25 and an instruction clamp of 1, so Vulkan gives max(-2.0, 1) = 1, which is level 2 over BASE_LEVEL 1. lavapipe returns level 1, which is max(-1.25, 1) - 0.75 = 0.25.
lavapipe before Mesa 26.1 clamps first:
lvp_pipeline.crunsnir_lower_texwith.lower_txd = true(mesa-26.0.8, line 428).replace_gradient_with_lodinnir_lower_tex.cthen turns the gradient sample into an explicit LOD and folds the MinLod operand into it withnir_fmax.lp_build_lod_selector("sampler_lod_bias", mesa-25.2.8 lp_bld_sample.c, line 979).Mesa 56997723 ("llvmpipe: pass explicit derivatives to sampling codegen") set
.lower_txd = false, first released in 26.1.0. From then on llvmpipe adds the bias before the MinLod clamp (mesa-26.1.0 lp_bld_sample.c, lines 1252 and 1283). Mesa 25.2.8 and 26.0.8 both still lower.The test now leaves out only the -192 case when the device is llvmpipe (
VK_DRIVER_ID_MESA_LLVMPIPE) and its driver info names Mesa before 26.1. It printsskipped, the device does not apply the S# LOD bias before an instruction's LOD clamp ...with the driver info. Every other case runs as before. On any other device, or on lavapipe from 26.1 on, or if the version can't be read, the test runs exactly whatmainruns. No production code changes.On old lavapipe this also leaves out the case's
image_sample_landimage_sample_lzresults, which don't use a clamp and pass there.Checkchecks one case's results as a whole, so keeping them would mean restructuring it, which I didn't want to do for a driver bug.Tested
Ubuntu 24.04, kernel 6.8, GCC 13.3.0, Ninja, Release,
BUILD_TESTING=ON. Headbe27ea9776onmain580d1d3e12. GPU: Mesa lavapipe 25.2.8 (llvmpipe (LLVM 20.1.2, 256 bits), driver infoMesa 25.2.8-0ubuntu0.24.04.2 (LLVM 20.1.2)),/dev/udmabufavailable. Validation layer built from source, 1.4.335.Bisect: a first-parent bisect of
00b15fcbb0..afdd33906bon lavapipe, building onlyagc_driver_image_sample_lod_clamp_testsand running--shader-lanewith the test's environment, found #23992's mergea8654598c5as the first bad commit. Its parent2bbf80e857passes.Cause: I printed the level each of the 32 threads sampled for each of the case's 6 instructions on
main. All 192 results match clamp-then-bias. Only 115 match Vulkan's bias-then-clamp, and the 77 that don't are allimage_sample_d_cl,image_sample_clorimage_sample_d_cl_olanes with a clamp above λbase + bias. Every bias I tried from -160 to -256 fails on thread 5 the same way, and -96 passes, as onmainbefore #23992. That local print and the bias change are not part of this PR.Focused runs,
main's test file and this branch's in the same build tree, 3 runs each, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest --test-dir build -R '^agc_driver_image_sample_lod_clamp' -V:agc_driver_image_sample_lod_clamp_shader_laneagc_driver_image_sample_lod_clampmainVK_EXT_image_view_min_lod)image sample LOD clamp tests passed in the shader-clamp laneEvery log shows
Insert instance layer "VK_LAYER_KHRONOS_validation", none showswas not found but was requested by env var VK_INSTANCE_LAYERS, and none containsVUID-.Full
ctest --test-dir build --output-on-failure -j6on this branch: 7124/7133 pass, and both LOD clamp tests are as in the table. The 9 failures are in other test executables. This PR's only changed file is compiled intoagc_driver_image_sample_lod_clamp_testsalone (build.ninja), so those executables are the same asmain's:agc_driver_gcn_multisample_color_fill: new onmainsince #25802; lavapipe has no target with its sample count (the device cannot render color with the target's sample count). Not addressed here.agc_driver_image_d16_load: since #22750, a 16_FLOAT signaling NaN comes back quieted on lavapipe. Not addressed here.agc_driver_image_filter_mode_three: lavapipe has no min/max filtering ofR8G8B8A8_UNORM; #27671 fixes the test.agc_driver_scattered_runs: Mesa before 26 (#21649).guest_json_copy_failure,guest_json_float_failure(SIGSEGV, 3/3 when rerun alone),guest_libressl3_object_header(timeout),nkwebkit_wtf(abort) andtools_headers_manifest: host-side tests unrelated to AGC.main's Linux CI job has not finished a run since #23992 merged. Its 51 push runs since then are cancelled (49) or queued (2).python3 tools/check_conventions.py --base origin/main: all checks passed.Not tested: any real GPU, Mesa lavapipe 26.1 or later, or any console. I relied on the Mesa sources linked above for 26.1, where the case runs as on
main. On any device other than llvmpipe, the new branch is never taken.Open #10867, #16953 and #24153 change the same lines of
main()in this file, and all of them are older than this PR. None of them changes what lavapipe does with the -192 case. Whichever merges first, I'll rebase this one onto it.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
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by arcwiser on 2026-11-27T10:39:06Z.
Review: APPROVED
Reviewed the complete one-file diff and the surrounding test flow at
be27ea9776. The exception is limited toVK_DRIVER_ID_MESA_LLVMPIPE, parses only an identifiableMesa major.minor, skips only versions before 26.1, and fails open (runs the original case) for other drivers or unparseable/future versions. I also checked the related NVIDIA report #23232; its failure was traced to the NVIDIA texture-quality override and is not hidden by this gate. Mesa 26.1's release notes list the cited "llvmpipe: pass explicit derivatives to sampling codegen" change.Local validation:
git diff --checkandpython tools/check_conventions.py --base f73d791b3df4dcaa773297a93f5ae2c062ee95a3passed. I did not run the Vulkan test because this checkout has no configured build or suitable lavapipe test environment. The author's old-lavapipe focused and full-suite evidence covers the affected path, and the PR explicitly documents that limitation. I found no blocking issue.AI-assisted review: yes (Codex); I independently inspected the diff, surrounding code, linked issue, overlapping PR diffs, and validation results.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T10:52:43Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
be27ea9776021f63b42107c1067c666d941eaf69. No commands or tests were run. Readdescription.md,commits.md,manifest.json,diff.patch, and the changed filecore/libs/prx/libSceAgcDriver/tests/execution/ImageSampleLodClamp.cppat lines 360–432, plus targeted context fromVulkanDevice.cppandVulkanTestDevice.hpp. The sole changed file is listed as reviewed inmanifest.json; no changed files were excluded.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Tests, CI, build, real GPU behavior, Mesa lavapipe 26.1 or later, and console behavior were not verified. The author's reported test results and Mesa source analysis were not independently checked.
files.jsonwas not available through the review reader, so I relied onmanifest.jsonfor the changed-file inventory.To get this to a good state
Nothing is required.
Pull request closed