fix(shader): deduplicate sampler table elements in ResolveImageTables #7882
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7882"
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 klosixgaming-arch on 2026-10-19T12:20:23Z.
What
During
ResolveImageTables, unique image descriptors are already deduplicated intoout.elementsviaelementIndex. However, sampler table entries previously allocated 4 sampler elements for every entry encountered without checking if an identical sampler descriptor had already been allocated inout.samplers. When tables contain duplicate sampler descriptors across slots or tables, this unnecessarily exhausts theAbi::SamplerElementBudget(1024 elements / 256 unique samplers) and poisons valid entries withPoisonReason::Budget.Index and deduplicate sampler table elements in
samplerRecord()usingsamplerIndex. If an identical sampler descriptor was already recorded inout.samplers, reuse its element index instead of allocating new elements. Add tests inShaderMemory.cppverifying deduplication across tables, reuse when the budget is full, and poisoning when unique samplers exceed the budget, along with verifying existing behaviour thatTableOutsideCodestill poisons withPoisonReason::Budgetwhen the budget is full.Tested
ctest -R ^agc_shader_memory$(agc_shader_memory_teststarget): passed locally on Windows (x86_64 mingw-w64). CI build jobs (Windows, Linux, relinker) were skipped; only the conventions, labels and eligibility jobs ran in CI.mainwithout the fix, the new test fails with assertion:"sampler table deduplication: duplicate sampler entries across tables were not deduplicated".PoisonReason::Budget) and covering existing behaviour thatTableOutsideCodepoisons withPoisonReason::Budgetwhen the budget is full.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T12:20:37Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T17:22:13Z.
First GPU run of this PR that I can see: AMD on Linux (RADV). Merged onto
maindbac9fa15(clean merge), built in full and compared with the samemain, on the same machine.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
Full suite (
ANYPS5_REQUIRE_VULKAN=1 ctest -j8): 1638/1640 with this PR, against 1638/1640 onmain. The failures are the same two on both, so this PR adds none:agc_driver_image_table_vouched_lookups(#7766, fixed by #7916) andagc_driver_guest_memory_lifetime(#7784).agc_shader_memorypasses. The PR adds no new ctest entry, and no test is skipped or removed compared withmain.GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T18:17:02Z.
First AMD-on-Linux (RADV) run of this PR. Merged onto
maindbac9fa15(clean merge), built in full and compared with the samemain, on the same machine.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
Full suite (
ANYPS5_REQUIRE_VULKAN=1 ctest -j8) atabd5914ab: 1638/1640 with this PR, against 1638/1640 onmain. The two failures are the same on both, so this PR adds none:agc_driver_image_table_vouched_lookups(#7766, fixed by #7916) andagc_driver_guest_memory_lifetime(#7784).Comparing the JUnit output with
main: this PR adds no ctest entry, and none is skipped or removed.This checks correctness only; I did not measure performance.
GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes