fix(agc): treat type-0 texture descriptors as null #4779
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4779"
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 MarcZX10 on 2026-10-12T21:37:28Z.
What
Treat an AMD texture descriptor with
TYPE=0as a null image, even when its base address is nonzero. This lets guest shaders bind stale S#+V# words in image slots without trying to decode them as a real texture. The scope is the observed TYPE=0 case from issue #4139; this PR does not implement cube T# reads through 2D accesses.The null predicate is shared across image precollection, binding resolution, refresh, revalidation and surface presync so each path classifies the same descriptor consistently. Regression coverage includes zero-base descriptors, TYPE=0 with a nonzero base, and a valid nonzero-base descriptor.
Evidence and limits
The issue reports S#+V# words in image slots in High on Life, including repeated TYPE=0 substitutions. An issue contributor measured TYPE=0 behavior on gfx1036 RDNA2: image sample/load/resinfo returned zero, including the reported nonzero unmapped bases, without a GPU fault. This is gfx1036 evidence; PS5 gfx1013 behavior was not measured.
Tested
agc_driver_graphicspassed (1/1) on currentmainbase584cc4c5716b02210ca031593d1a6b0b4ce049cb.python3 tools/check_conventions.py --base upstream/mainpassed.git diff --check upstream/main...HEADpassed.Checklist
main; no open PR implements TYPE=0 null descriptor handlingNotImplemented_nid_no_patchImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T23:24:46Z.
Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built in a batch with five other open GPU PRs cherry-picked onto main
44ab0c39e(not current main, which needs a submodule that isn't checked out here), so only the tests that belong to this PR say anything about it:tests/GuestTextureResource.cpp, which is part ofagc_driver_graphics_tests: see below.agc_driver_graphicsover the batch: 9 of 10 runs passed. The one failure is the known address-layout flake from #4660 as far as I can tell: I kept only the first lines of that run's log (thehost import ... vkAllocateMemory (-2)lines, which appear in passing runs as well), not its final error message, so I can't confirm the cause for that one run. Plainmainfailed 2 of 10 on the same machine earlier.Not tested: no game run; the batch was not rebuilt per PR, so a failure would have needed a bisect (there was none besides the flake).
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:43:16Z.
Two things before merging:
docs/dev/debt/libSceAgcDriver.mdentry: a TYPE=0 descriptor with a non-zero base is bound as a null image, after the gfx1036 measurement in #4139; not measured on the console;Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:12:06Z.
Thanks. The title is High on Life (PPSA15388), documented in #4139; its current-main failure is the rejected descriptor/shader-draw path. The gameplay result in that issue used a local experiment that null-bound both the TYPE=0 slot and the separate cube-through-2D case. This PR changes only the TYPE=0 handling, and I do not have an isolated run of this exact PR head that gets the title past the failure. The gfx1036 measurement is not a console measurement, so I will keep that limitation explicit and will not claim this PR alone gets High on Life to gameplay.
Imported from boykopovar/AnyPS5. Originally posted by Sam-mon7 on 2026-10-13T19:55:03Z.
A second title with TYPE=0 image descriptors: Demon's Souls (PPSA01341 v1.07), Windows 11, RTX 4070 (driver 596.21), MinGW GCC 15.2 Release.
compute shader 0x248a05b00 (shader_248a05b00_failed.req): runtime image descriptor is invalid, then SIGABRT. In the captured request, image slots 3-6 have TYPE=0 (dword3[31:28]) with a nonzero base and nonzero remaining words. Slots 0-2 and 7-9 are valid descriptors.ResourceMaterializer.cpp) still treats only a zero base as null, so a TYPE=0 descriptor with a nonzero base is rejected there first. A CPU regression with such a descriptor fails with this PR applied. I have not replayed the captured request against this head alone.ResourceMaterializer.cpp(words cleared before metadata and swizzle selection), and TYPE=0 image-table entries resolve to null. With this PR plus that change, the captured request gets past image validation, and later runs pass the intro and reach character creation. That tree carries other local changes, so it is not an isolated run of this head either.If it helps, I can open the recompiler half as a follow-up that depends on this PR.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:17:19Z.
Thanks, this separates the two layers clearly: this PR handles runtime binding, while
ResourceMaterializerrejects the TYPE=0 descriptor earlier. The separate CPU regression and title trace are useful evidence. A focused follow-up for the recompiler path, depending on this PR, seems like the right way to carry that fix; the remaining gfx1013 behavior should stay explicit as unverified.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:40:26Z.
I opened the recompiler-side follow-up as PR #5473, depending on this PR. It adds a regression for an image descriptor with TYPE=0 and a nonzero base. The focused Linux test passes with the change and fails on the previous predicate with
runtime image descriptor is invalid. I recorded that this does not include the runtime binding change from this PR.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T17:20:22Z.
Checked the shared
IsNullTextureResourcepredicate against every site that used the old zero-base test (precollect, resolve, refresh, revalidate, presync): all consistent.agc_driver_graphicspasses, and the new type-0 case fails if thetype == 0check is removed.Added on top, per @oneandonlydean's request: a
docs/dev/debt/libSceAgcDriver.mdentry saying a TYPE=0 descriptor with a nonzero base is bound as a null image, from the gfx1036 measurement in #4139 and not measured on the console. Rebased onto current main; merging once CI is green.