fix(agc): retain storage textures during initial uploads #3813
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3813"
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 jweidenh on 2026-10-11T17:02:12Z.
What
Initial
StorageTextureuploads can record a DCC clear or detiler dispatch before the constructor returns. At that pointweak_from_this()has no owner, so the upload's recorder keep is empty. A later image-view creation failure, or release of the caller's last reference, can destroy resources still referenced by recorded GPU commands.Create storage textures through
StorageTexture::Create: allocate first, establish shared ownership, then upload and create the default view. Publish to the live registry only after initialization succeeds. Allocation failures still use the constructor cleanup; failures after recording keep the object alive until the recorder releases its completed batch. Update all callers to the factory.Add two bounded Vulkan regressions covering immediate caller release and injected
VK_ERROR_OUT_OF_DEVICE_MEMORYduring default-view creation after recording a clear. Both read back all 64×64 cleared texels and verify eventual resource release. The test intercepts premature destroy requests and defers native destruction until recorder drain, so the failing baseline never submits dangling Vulkan resources.Tested
4545f6648f53a0debe6b7db072099e35848006cf.804fcb41e3c971433e3a688592f18ff3b17ae34e.agc_driver_storage_cache_budget(0.93 s), andagc_driver_storage_one_slice_alias(0.98 s), with the app shader cache disabled. The existing alias test does not check watched-import device reuse on Windows because imported memory uses comparisons; its shader/readback assertions pass.agc_storage_upload_lifetime(0.056 s),agc_storage_upload_failure(0.052 s),agc_storage_baseline_settled,agc_unchanged_cpu_stamps,agc_host_import_unmap, andagc_driver_storage_cache_budget, all below 0.4 s with fresh app/Mesa cache directories and no skipped assertions.agc_driver_storage_one_slice_aliasalso passes its pixel assertions (0.32 s), with the same compared-import device-reuse limitation as Windows. The unit-shadow control was excluded because it requires retained import write watching.git diff --checkand the repository conventions checker pass.These are synthetic Vulkan regressions and existing storage tests. No retail title, startup latency, or frame-rate improvement was measured. No workflow changes are included in this PR.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:05:50Z.
Checked the factory change against all callers (
ShaderResources.cppand the tests), the destructor path for an object that never reached the live registry (safe), and ran the PR merged onto main: libSceAgcDriver build and ctest 392/392 pass, includingagc_storage_upload_lifetimeandagc_storage_upload_failure. Merging.