fix(agc): refuse image-table entries whose base address is not mapped #27295
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27295"
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 B-Howell on 2026-11-25T18:57:12Z.
What
An image table binds every record its keys can reach before the shader selects one, so a record that holds other data is decoded as a T#.
decodeEntryrefused such an entry only when no page of its surface was committed. A record whose base lies in a reserved hole of a large guest reservation, with committed pages further on, was built and uploaded from whatever pages were committed.God of War Ragnarök (PPSA08329) stops this way on the Image Calibration screen (
[gpu] driver failure: compute shader 0x1052a03100: std::bad_alloc). A local diagnostic print of the T# words and their source showed the view comes from image-table records of shaders0x1052a03100and0x1051fb1800:Words 0 and 1 are the floats 12.0 and 24.0, word 2 is a float near 0.3, and words 4 and 6 are small integers that change between dispatches, so the width, height and depth differ every time (9522x15015x301 up to 14802x15162x754, 150 to 650 GiB). The base
0x4140000000lies in a---range of the 483 GB reservation0x28a0000000..0x9ea0000000. Each such view was placed in about 160 GiB of host memory (vkAllocateMemory texture ... 170065920000 bytes placed in host memory type 0, 806723 MiB over five allocations in one 1200 s run) until a dispatch failed withstd::bad_alloc, which is memory-dependent: some runs survive it.This refuses a table entry whose base address is not mapped, before its surface is read. As for any refused entry, a shader that selects it faults (
image table: ... selected the descriptor ...: rejected by the driver: ... is not mapped at its base address), and an unselected one changes nothing. Directly bound T#s are unchanged, and so is an entry whose base is mapped with later pages uncommitted (the partially committed 3D path). The unmeasured console behaviour for a selected partially resident texture whose first page is not committed is recorded in the debt fragment.ImageTable.cppadds a record whose first 64 KiB are reserved and whose next 64 KiB are committed. Onmainit is bound and the selected case samples it without a fault, so the test fails withan entry whose base address is not mapped, with a mapped page later in its surface, was bound instead of faulting when selected.Related open work: #6481 checks table entries against
maxResourceSizeand classifies Vulkan memory refusals; these views are under 1 TiB and their host allocations succeed, so it would not refuse them, and the abort is a hoststd::bad_alloc. #9318 bounds array slices only (this is a 3D view). #10193, #13928, #13929, #20519 and #22424 move or copy the old unmapped check; none changes what it refuses.tools/pr_overlap.py --branchfailed closed on conflicting PRs; their diffs were compared by hand for this check.Tested
Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7, Release, NVIDIA GeForce RTX 4080 SUPER (driver 621.14), Khronos validation layer 1.4.363.1.
agc_driver_image_table,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest -R '^agc_driver_image_table$' -V: passes with this change; fails on main'sShaderResources.cppat the new case (message above). The validation comparison ranmain's unchanged test againstmain's source and this change's test against this change: both logs showInsert instance layer "VK_LAYER_KHRONOS_validation", neither haswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither has aVUID-orSYNC-HAZARD-line. These builds were onmain102cad67dae5with #26197 merged and local diagnostic prints; the two changed source files are identical between102cad67dae5and this branch's base66f88154a4cd.18286ef4: AMD Radeon RX Vega (VEGA10, GCN5), RADV (Mesa), Linux, clean build,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1withVK_LAYER_KHRONOS_validation:agc_driver_image_tablepasses 3/3 with this change and fails 3/3 at the new case when onlyShaderResources.cppis reverted to the merge base.18286ef4merged ontomain9f52918eb0: Windows 11 Pro, NVIDIA GeForce RTX 5070 Ti (Blackwell), driver 621.40, WinLibs GCC 16.2.0, Release, withVK_LAYER_KHRONOS_validation:agc_driver_image_tablepasses 3/3 with noVUID-line and fails at the new case when onlyShaderResources.cppis reverted to main.python3 tools/check_conventions.py --base origin/mainandpython3 tools/debt_fold.py --checkpass.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 MarcZX10 on 2026-11-25T19:21:33Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
18286ef4c98da09ac7cdb2175962dfffcde30ad5using the prepared diff and pinned reader. No tests or prechecks were run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
ShaderResources.cppwas excluded from the prepared full-text files because it was too large; the changed hunk and its nearby table-resolution flow were read throughrepo_read.py. The includedImageTable.cppwas read around the changed test and its includes. The new debt fragment was visible in the diff. No other file contents were read. Tests, prechecks, and console behavior were not independently verified; test and game results in the description are author-reported.To get this to a good state
Nothing is required.