Fundamentals, Object Lifetime reads:
Applications can free or destroy objects in any order, except that parent objects must be freed only after all child objects are freed. An object is the parent of another child object if the parent was used as the first object parameter in the creation of the child.
A reader may now conclude that they do not need to worry about destruction order, except for the parent–child relationship. For example, they may conclude that they may destroy an image before destroying an image view created from the image, as the parent–child relationships are device–image and device–image-view.
But there is another exception to the "any order" permission, through Fundamentals, Valid Usage for Object Handles:
Any input parameter to a command that is an object handle must be a valid object handle, unless otherwise specified. An object handle is valid if:
- Any objects used by that object, either as part of creation or execution, must also be valid.
together with VUID-vkDestroyFooBar-fooBar-parameter, such as for image views:
VUID-vkDestroyImageView-imageView-parameter
If imageView is not VK_NULL_HANDLE, imageView must be a valid VkImageView handle
As such, Fundamentals, Object Lifetime should not suggest any order is allowed, because it is not.
Fundamentals, Object Lifetime reads:
A reader may now conclude that they do not need to worry about destruction order, except for the parent–child relationship. For example, they may conclude that they may destroy an image before destroying an image view created from the image, as the parent–child relationships are device–image and device–image-view.
But there is another exception to the "any order" permission, through Fundamentals, Valid Usage for Object Handles:
together with
VUID-vkDestroyFooBar-fooBar-parameter, such as for image views:As such, Fundamentals, Object Lifetime should not suggest any order is allowed, because it is not.