Skip to content

fix(agc): keep a replaced Vulkan device alive - #59

Merged
boykopovar merged 1 commit into
boykopovar:mainfrom
oneandonlydean:fix/retain-replaced-device
Sep 28, 2026
Merged

boykopovar merged 1 commit into
boykopovar:mainfrom
oneandonlydean:fix/retain-replaced-device

Conversation

@oneandonlydean

@oneandonlydean oneandonlydean commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

What

The driver starts with a headless Vulkan device and replaces it with a windowed one at the first flip. The old device was destroyed as soon as the replacement was made. At that point, objects created from it (102 of them in a retail title, mostly device memory) were still referenced by caches. Destroying a device with live child objects is invalid (validation reports VUID-vkDestroyDevice-device-05137), and the title later crashed inside the NVIDIA driver.

How

In the presenter path, after PrepareForReplacement() (which flushes cached textures, publishes shadows and waits for idle), the old device is kept in a function-local static list instead of being released. Its child objects stay valid for as long as anything still refers to them. The cost is one idle device for the life of the process; the replacement happens once, at the first flip.

Testing

No automated test: the replacement only happens when a window is attached at the first flip, and agc_driver_flip already hangs on main. All other CTest tests pass (agc_driver and agc_driver_pm4 fail as on main).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ButHENCbXXt8h4EZuWUabJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants