fix(agc): bind large vertex inputs in place instead of copying them #19445
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19445"
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 SP4C3B4R-8 on 2026-11-13T10:16:27Z.
What
An indirect draw's counts are unknown when its inputs are prepared, so
prepareDrawInputscopies the whole range its vertex descriptor spans. In a heavy 3D scene those copies reach 144 MiB each and are allocated again and again in host memory (Bufferper copy), until heap 1 is full and the title dies withvkAllocateMemory-2.InPlaceDrawInputnow binds a vertex input range of at leastAPS5_LARGE_INPUT_IN_PLACE_MIB(default 8 MiB; 0 copies them as before) in place from its host import on any device, also where in-place inputs are otherwise off (NVIDIA's Windows driver). Everything else of the in-place path stays: the pending label and queued store refusals, the copied-writer checks, the import alignment andNotePendingRead. Index ranges and smaller vertex ranges are unchanged. The variable is listed indocs/dev/ENVIRONMENT.md.Tested
Windows 11 Pro, Ryzen 7 7800X3D, GeForce RTX 5070 Ti (NVIDIA 610.88), the same retail 3D title's heaviest level, launched straight into it,
APS5_HOST_IMPORT_MIB=14336 APS5_TEXTURE_CACHE_MIB=3584, otherwise defaults, one run per side of 280 s:maincddfa7e662vkAllocateMemory buffer: allocation=150994944 ... heap 0 14610/15227 MiB; heap 1 15334/15132 MiB: Vulkan result -2(presentation failed, driver failure)The same failure with default budgets (
APS5_HOST_IMPORT_MIB20480, automatic texture cache) is masked by the texture cache budget shrinking to 2048 MiB first, on both sides. The allocations were traced on an older base: 168 new host buffers, 7.1 GB in 235 s, from indirect draws' vertex ranges; with the change, 24 MiB.Focused tests on
mainand on this PR, same machine and GPU,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R '^(agc_draw_inputs_in_place_driver|agc_owned_draw_inputs.*|agc_draw_inputs_in_place|agc_draw_inputs_copied|agc_vertex_input.*|agc_driver_native_msaa_vertex_input|agc_driver_prepared_shaders_abi_deferred_vertex_inputs)$' -V: 12/12 passed on both, noVUID-lines, the validation layer was found in both logs.tools/pr_overlap.pyreported open PRs touchingDraw.cpp(#18390, #18515, #19119) andENVIRONMENT.md; compared by hand, none changesInPlaceDrawInputor the vertex input copies.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
https://claude.ai/code/session_01DuBfeb8q3sBv5kLpAytGCG
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T04:22:29Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the code preserves the existing in-place vertex safety checks while allowing large vertex ranges to use host imports.
What I ran
Reviewed head
d76c084138abd8667f9257d74b4a8c717e9db080using the prepared review bundle andrepo_read.py. No commands or tests could be run in this review environment. The reported Windows runtime and focused test results are author-reported, not independently verified.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The repository diff and description were read. Full text was available and read for both changed files:
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppanddocs/dev/ENVIRONMENT.md. Targeted context was read forHostImportForincore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp, the draw-input callers, anddrawInputsInPlaceconfiguration inVulkanDevice.cpp. No changed files were excluded. Runtime behavior, GPU synchronization on physical hardware, and the author-reported tests were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T09:37:27Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the review supports merging, and the author reported focused tests and a title run that I did not perform.
What I ran
Reviewed head
f1e0c06caf855eec1b55034bd263864fbb2f85e4. I read the prepared description, commits, manifest, diff, and both changed files; I usedrepo_read.pysearch and targeted reads for the affected vertex input path, import lookup, and read tracking. No tests or build commands were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not read
files.jsonbecause it is unavailable in the review folder; the manifest lists both changed files as included, and I read both. I did not verify the reported Windows 11, NVIDIA, or other device behavior, run the focused tests, inspect the repository's test coverage, or check the base merge state.To get this to a good state
Nothing is required.