Skip to content

Fix application info and device creation cleanup - #185

Merged
solidpixel merged 1 commit into
ARM-software:mainfrom
Rob-Hughes-Arm:fix/creation-lifetime
Oct 22, 2026
Merged

solidpixel merged 1 commit into
ARM-software:mainfrom
Rob-Hughes-Arm:fix/creation-lifetime

Conversation

@Rob-Hughes-Arm

@Rob-Hughes-Arm Rob-Hughes-Arm commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The shared creation paths have two failure-handling gaps:

  • VkInstanceCreateInfo::pApplicationInfo may legally be null, but the framework dereferences it when reading the API version and when updating the safe copy for version promotion. An explicit apiVersion of zero is also treated as version 0.0 instead of Vulkan 1.0.
  • After the underlying vkCreateDevice call succeeds, constructing the layer's Device wrapper or publishing it in the global store can throw. Without rollback, the underlying device remains alive without a usable layer wrapper, and the output handle is left populated.

Changes

  • Treat absent application info and API version zero as Vulkan 1.0.
  • Allocate application info in the owned safe copy before version promotion, leaving the caller's input unchanged.
  • Guard device-wrapper construction and publication. On failure, release the tracking lock, clean up remaining local wrapper state, destroy the underlying device with the original allocator, and clear the output handle.
  • Return VK_ERROR_OUT_OF_HOST_MEMORY for allocation failures and VK_ERROR_INITIALIZATION_FAILED for other construction/publication exceptions.

Successful device publication is unchanged. Driver destruction remains outside the tracking lock.

[AI-generated 🤖]

Accept omitted application info and treat API version zero as Vulkan 1.0.
Create application info in the owned safe copy before version promotion,
without modifying the caller's input.

If Device construction or publication fails after the Vulkan device has
been created, release the tracking lock, clean up the underlying device
with the original allocator, and clear the output handle. Translate
allocation failures to VK_ERROR_OUT_OF_HOST_MEMORY and other exceptions
to VK_ERROR_INITIALIZATION_FAILED.
@Rob-Hughes-Arm
Rob-Hughes-Arm marked this pull request as ready for review September 14, 2026 13:43
@solidpixel
solidpixel self-requested a review October 22, 2026 15:36
@solidpixel
solidpixel merged commit c2059c4 into ARM-software:main Oct 22, 2026
6 checks passed
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