fix(vk): replace menu upload buffers only after successful growth #1453
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1453
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/menu-upload-growth"
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?
When an Insert menu, FPS or startup bitmap outgrows a frame slot's upload buffer,
copy_overpasses the published handles directly to the allocator. Successful growth loses the previous allocation without destroying it; a failed allocation can overwrite those handles while leaving the old capacity, mapping and version metadata.Construct the replacement locally, release the previous buffer only after allocation succeeds, then publish the new upload with its copy version reset. Failure preserves the old upload and skips the oversized copy. The existing per-slot fence wait before
menu_recordmakes the old buffer safe to release; no extra device-idle wait or memory-budget policy is added.Validation:
Based on main
9a2e80e. Five source/test/doc files only; no game data, generated guest code or private fault switches. Menu-related PRs were checked for this function; #1389/#1330/#1352 merge cleanly at the fetched heads. This is separate from #1445's interpolation resources and #1448's source-crop validation.Current-head validation
Current head
7575ed2, based on mainb2e1c5a. Earlier local/runtime results describe their recorded source hashes.The standalone contribution patch is unchanged after the audited main refresh; exact-head build/source checks are refreshed below. Earlier runtime evidence remains tied to its recorded hash.
Fork runs are separate from upstream Actions approval; no maintainer approval gate is bypassed.
Thanks, this looks right to me.
vmaCreateBufferwrites straight intou.buf/u.alloc, so a successful grow loses the old buffer, and a failed one nulls the handles whileu.sizestays the old value. The next frame then skips the grow and copies fromVK_NULL_HANDLE. Building into a localUploadand swapping only on success fixes both.present_imagein vk_replay.cpp. It waits onframes[frame_index].donebeforemenu_record(..., log_slot), andlog_slot == frame_index, soups[*][slot]only belongs to the submission that fence covers. The early returns (acquire timeout, out of date) come beforevkResetFences, so the fence stays signaled and the next wait still holds. Each upload is used once permenu_record, so the command buffer being recorded doesn't reference the old buffer either. Freeing it right away is safe.next.version = 0forces the memcpy into the new mapping, which is what you want.{vulkan_headers}, and it builds from the realcopy_over/Upload.Nit, from before this PR and not blocking: nothing ever destroys
ups[3][3]at shutdown. That isn't a problem today, but a small teardown loop would be worth adding if VMA teardown ever starts checking for leaks.No upstream checks have run yet (fork PR, waiting on Actions approval), so CI on this head is still pending.