We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5088 - WIN_Vulkan_CreateSurface hardcodes NULL for VkAllocationCallbacks parameter
Summary: WIN_Vulkan_CreateSurface hardcodes NULL for VkAllocationCallbacks parameter
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.13
Hardware: x86_64 Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-13 16:14 UTC by bjc
Modified: 2020-04-13 16:14 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bjc 2020-04-13 16:14:17 UTC
There is no way to provide SDL with a VkAllocationCallbacks struct that it can then pass to vkCreateWin32SurfaceKHR internally. This parameter is just hardcoded to NULL currently, in SDL_windowsvulkan.c. This is a problem when an application uses Vulkan custom memory allocation routines, because it violates Vulkan specification which states:

If no VkAllocationCallbacks were provided when surface was created, pAllocator must be NULL (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroySurfaceKHR-surface-01268)

Specifically, an application using custom memory allocation routines would provide the callbacks to vkDestroySurfaceKHR, but because they weren't *also* provided to the SDL call to vkCreateWin32SurfaceKHR, a spec violation occurs, which results in undefined behavior (and is also flagged by the Vulkan validation layers).