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

Summary: WIN_Vulkan_CreateSurface hardcodes NULL for VkAllocationCallbacks parameter
Product: SDL Reporter: bjc <scashews>
Component: videoAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.13   
Hardware: x86_64   
OS: Windows 10   

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).