From f110cbb375d2793b1f7117b360c098ff23622dde Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 6 Nov 2023 13:30:24 -0500
Subject: [PATCH] vulkan: Updated for SDL3 change to SDL_Vulkan_CreateSurface.
---
src/sdl2_compat.c | 7 +++++++
src/sdl3_syms.h | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 3e162ce..05630ab 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -5146,6 +5146,13 @@ SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned int *puiCount, con
return SDL_Vulkan_GetInstanceExtensions_Helper(puiCount, pNames, (unsigned int) ui32count, extensions);
}
+/* SDL3 added a VkAllocationCallbacks* argument; SDL2 always uses the default (NULL) allocator */
+DECLSPEC SDL_bool SDLCALL
+SDL_Vulkan_CreateSurface(SDL_Window *window, VkInstance vkinst, VkSurfaceKHR *psurf)
+{
+ return SDL3_Vulkan_CreateSurface(window, vkinst, NULL, psurf);
+}
+
/* SDL3 doesn't have 3dNow or RDTSC. */
static int
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index bb5f452..b198d65 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -557,7 +557,7 @@ SDL3_SYM_PASSTHROUGH(int,Vulkan_LoadLibrary,(const char *a),(a),return)
SDL3_SYM_PASSTHROUGH(void*,Vulkan_GetVkGetInstanceProcAddr,(void),(),return)
SDL3_SYM_PASSTHROUGH(void,Vulkan_UnloadLibrary,(void),(),)
SDL3_SYM(char const* const* ,Vulkan_GetInstanceExtensions,(Uint32 *a),(a),return)
-SDL3_SYM_PASSTHROUGH(SDL_bool,Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return)
+SDL3_SYM(SDL_bool,Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, const struct VkAllocationCallbacks *c, VkSurfaceKHR *d),(a,b,c,d),return)
SDL3_SYM_PASSTHROUGH(void,GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),)
SDL3_SYM_PASSTHROUGH(int,SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return)
SDL3_SYM_PASSTHROUGH(int,GetNumAllocations,(void),(),return)