From 09533679677ff3d62331a0fefa2a78638d92a724 Mon Sep 17 00:00:00 2001 From: Hunter Kvalevog <91440203+hkva@users.noreply.github.com> Date: Sat, 7 Jan 2023 10:51:58 -0600 Subject: [PATCH] SDL_Vulkan_GetInstanceExtensions: Remove window Remove the unused `window` parameter from SDL_Vulkan_GetInstanceExtensions, which is never used by any of the backends. --- include/SDL3/SDL_vulkan.h | 11 +---------- src/dynapi/SDL_dynapi_procs.h | 2 +- src/video/SDL_sysvideo.h | 2 +- src/video/SDL_video.c | 13 ++----------- src/video/android/SDL_androidvulkan.c | 1 - src/video/android/SDL_androidvulkan.h | 1 - src/video/cocoa/SDL_cocoavulkan.h | 1 - src/video/cocoa/SDL_cocoavulkan.m | 1 - src/video/kmsdrm/SDL_kmsdrmvulkan.c | 1 - src/video/kmsdrm/SDL_kmsdrmvulkan.h | 1 - src/video/uikit/SDL_uikitvulkan.h | 1 - src/video/uikit/SDL_uikitvulkan.m | 1 - src/video/vivante/SDL_vivantevulkan.c | 1 - src/video/vivante/SDL_vivantevulkan.h | 1 - src/video/wayland/SDL_waylandvulkan.c | 1 - src/video/wayland/SDL_waylandvulkan.h | 1 - src/video/windows/SDL_windowsvulkan.c | 1 - src/video/windows/SDL_windowsvulkan.h | 1 - src/video/x11/SDL_x11vulkan.c | 1 - src/video/x11/SDL_x11vulkan.h | 1 - test/testvulkan.c | 4 ++-- 21 files changed, 7 insertions(+), 41 deletions(-) diff --git a/include/SDL3/SDL_vulkan.h b/include/SDL3/SDL_vulkan.h index 6f5087fb0..55c8d1ab6 100644 --- a/include/SDL3/SDL_vulkan.h +++ b/include/SDL3/SDL_vulkan.h @@ -59,9 +59,6 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ /** * \name Vulkan support functions - * - * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API - * is compatable with Tizen's implementation of Vulkan in SDL. */ /* @{ */ @@ -142,11 +139,6 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * required extensions, SDL_FALSE will be returned instead of SDL_TRUE, to * indicate that not all the required extensions were returned. * - * The `window` parameter is currently needed to be valid as of SDL 2.0.8, - * however, this parameter will likely be removed in future releases - * - * \param window A window for which the required Vulkan instance extensions - * should be retrieved (will be deprecated in a future release) * \param pCount A pointer to an unsigned int corresponding to the number of * extensions to be returned * \param pNames NULL or a pointer to an array to be filled with required @@ -157,8 +149,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * * \sa SDL_Vulkan_CreateSurface */ -extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, - unsigned int *pCount, +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(unsigned int *pCount, const char **pNames); /** diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 9401e94ae..b005a51ce 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -754,7 +754,7 @@ SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect SDL_DYNAPI_PROC(int,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h),(a,b,c,d,e,f,g,h),return) SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_Vulkan_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(SDL_Window *a, unsigned int *b, const char **c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(unsigned int *a, const char **b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),) diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 5450a6697..119f07d08 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -282,7 +282,7 @@ struct SDL_VideoDevice */ int (*Vulkan_LoadLibrary)(_THIS, const char *path); void (*Vulkan_UnloadLibrary)(_THIS); - SDL_bool (*Vulkan_GetInstanceExtensions)(_THIS, SDL_Window *window, unsigned *count, const char **names); + SDL_bool (*Vulkan_GetInstanceExtensions)(_THIS, unsigned *count, const char **names); SDL_bool (*Vulkan_CreateSurface)(_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface); void (*Vulkan_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 3466d2f5e..7a38b4379 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4687,23 +4687,14 @@ void SDL_Vulkan_UnloadLibrary(void) } } -SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names) +SDL_bool SDL_Vulkan_GetInstanceExtensions(unsigned *count, const char **names) { - if (window) { - CHECK_WINDOW_MAGIC(window, SDL_FALSE); - - if (!(window->flags & SDL_WINDOW_VULKAN)) { - SDL_SetError(NOT_A_VULKAN_WINDOW); - return SDL_FALSE; - } - } - if (count == NULL) { SDL_InvalidParamError("count"); return SDL_FALSE; } - return _this->Vulkan_GetInstanceExtensions(_this, window, count, names); + return _this->Vulkan_GetInstanceExtensions(_this, count, names); } SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window, diff --git a/src/video/android/SDL_androidvulkan.c b/src/video/android/SDL_androidvulkan.c index 00d5a2f67..930af204f 100644 --- a/src/video/android/SDL_androidvulkan.c +++ b/src/video/android/SDL_androidvulkan.c @@ -111,7 +111,6 @@ void Android_Vulkan_UnloadLibrary(_THIS) } SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names) { diff --git a/src/video/android/SDL_androidvulkan.h b/src/video/android/SDL_androidvulkan.h index 28fcedd02..3935b5350 100644 --- a/src/video/android/SDL_androidvulkan.h +++ b/src/video/android/SDL_androidvulkan.h @@ -37,7 +37,6 @@ int Android_Vulkan_LoadLibrary(_THIS, const char *path); void Android_Vulkan_UnloadLibrary(_THIS); SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names); SDL_bool Android_Vulkan_CreateSurface(_THIS, diff --git a/src/video/cocoa/SDL_cocoavulkan.h b/src/video/cocoa/SDL_cocoavulkan.h index 3ed96cad2..34f9b510d 100644 --- a/src/video/cocoa/SDL_cocoavulkan.h +++ b/src/video/cocoa/SDL_cocoavulkan.h @@ -37,7 +37,6 @@ int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path); void Cocoa_Vulkan_UnloadLibrary(_THIS); SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names); SDL_bool Cocoa_Vulkan_CreateSurface(_THIS, diff --git a/src/video/cocoa/SDL_cocoavulkan.m b/src/video/cocoa/SDL_cocoavulkan.m index 14213f098..ca7c74a90 100644 --- a/src/video/cocoa/SDL_cocoavulkan.m +++ b/src/video/cocoa/SDL_cocoavulkan.m @@ -165,7 +165,6 @@ void Cocoa_Vulkan_UnloadLibrary(_THIS) } SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names) { diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/src/video/kmsdrm/SDL_kmsdrmvulkan.c index c0a11392d..d8bfb7d17 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvulkan.c +++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.c @@ -142,7 +142,6 @@ void KMSDRM_Vulkan_UnloadLibrary(_THIS) /* vkCreateInstance(). */ /*********************************************************************/ SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names) { diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.h b/src/video/kmsdrm/SDL_kmsdrmvulkan.h index dc08b7d24..df9d058b7 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvulkan.h +++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.h @@ -37,7 +37,6 @@ int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path); void KMSDRM_Vulkan_UnloadLibrary(_THIS); SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names); void KMSDRM_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); diff --git a/src/video/uikit/SDL_uikitvulkan.h b/src/video/uikit/SDL_uikitvulkan.h index fc9a74c26..ec6fb079a 100644 --- a/src/video/uikit/SDL_uikitvulkan.h +++ b/src/video/uikit/SDL_uikitvulkan.h @@ -37,7 +37,6 @@ int UIKit_Vulkan_LoadLibrary(_THIS, const char *path); void UIKit_Vulkan_UnloadLibrary(_THIS); SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names); SDL_bool UIKit_Vulkan_CreateSurface(_THIS, diff --git a/src/video/uikit/SDL_uikitvulkan.m b/src/video/uikit/SDL_uikitvulkan.m index 5cb0ae1f4..ac9fa4738 100644 --- a/src/video/uikit/SDL_uikitvulkan.m +++ b/src/video/uikit/SDL_uikitvulkan.m @@ -171,7 +171,6 @@ void UIKit_Vulkan_UnloadLibrary(_THIS) } SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names) { diff --git a/src/video/vivante/SDL_vivantevulkan.c b/src/video/vivante/SDL_vivantevulkan.c index 94c408ba0..347bbde9b 100644 --- a/src/video/vivante/SDL_vivantevulkan.c +++ b/src/video/vivante/SDL_vivantevulkan.c @@ -118,7 +118,6 @@ void VIVANTE_Vulkan_UnloadLibrary(_THIS) } SDL_bool VIVANTE_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names) { diff --git a/src/video/vivante/SDL_vivantevulkan.h b/src/video/vivante/SDL_vivantevulkan.h index 6e505903f..a51d7b027 100644 --- a/src/video/vivante/SDL_vivantevulkan.h +++ b/src/video/vivante/SDL_vivantevulkan.h @@ -37,7 +37,6 @@ int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path); void VIVANTE_Vulkan_UnloadLibrary(_THIS); SDL_bool VIVANTE_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names); SDL_bool VIVANTE_Vulkan_CreateSurface(_THIS, diff --git a/src/video/wayland/SDL_waylandvulkan.c b/src/video/wayland/SDL_waylandvulkan.c index 706b996a0..96252188b 100644 --- a/src/video/wayland/SDL_waylandvulkan.c +++ b/src/video/wayland/SDL_waylandvulkan.c @@ -117,7 +117,6 @@ void Wayland_Vulkan_UnloadLibrary(_THIS) } SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names) { diff --git a/src/video/wayland/SDL_waylandvulkan.h b/src/video/wayland/SDL_waylandvulkan.h index 07a60b724..807278cb9 100644 --- a/src/video/wayland/SDL_waylandvulkan.h +++ b/src/video/wayland/SDL_waylandvulkan.h @@ -37,7 +37,6 @@ int Wayland_Vulkan_LoadLibrary(_THIS, const char *path); void Wayland_Vulkan_UnloadLibrary(_THIS); SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names); SDL_bool Wayland_Vulkan_CreateSurface(_THIS, diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c index a201e00e6..74cdb2131 100644 --- a/src/video/windows/SDL_windowsvulkan.c +++ b/src/video/windows/SDL_windowsvulkan.c @@ -112,7 +112,6 @@ void WIN_Vulkan_UnloadLibrary(_THIS) } SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names) { diff --git a/src/video/windows/SDL_windowsvulkan.h b/src/video/windows/SDL_windowsvulkan.h index 7b15c78ec..8c004b3c5 100644 --- a/src/video/windows/SDL_windowsvulkan.h +++ b/src/video/windows/SDL_windowsvulkan.h @@ -37,7 +37,6 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path); void WIN_Vulkan_UnloadLibrary(_THIS); SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names); SDL_bool WIN_Vulkan_CreateSurface(_THIS, diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c index a91ce8860..3f9baa626 100644 --- a/src/video/x11/SDL_x11vulkan.c +++ b/src/video/x11/SDL_x11vulkan.c @@ -141,7 +141,6 @@ void X11_Vulkan_UnloadLibrary(_THIS) } SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names) { diff --git a/src/video/x11/SDL_x11vulkan.h b/src/video/x11/SDL_x11vulkan.h index f342f33e3..e784cd2a3 100644 --- a/src/video/x11/SDL_x11vulkan.h +++ b/src/video/x11/SDL_x11vulkan.h @@ -33,7 +33,6 @@ typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy); int X11_Vulkan_LoadLibrary(_THIS, const char *path); void X11_Vulkan_UnloadLibrary(_THIS); SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS, - SDL_Window *window, unsigned *count, const char **names); SDL_bool X11_Vulkan_CreateSurface(_THIS, diff --git a/test/testvulkan.c b/test/testvulkan.c index 9edbbd014..ce3f90b37 100644 --- a/test/testvulkan.c +++ b/test/testvulkan.c @@ -227,7 +227,7 @@ static void createInstance(void) appInfo.apiVersion = VK_API_VERSION_1_0; instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instanceCreateInfo.pApplicationInfo = &appInfo; - if (!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, NULL)) { + if (!SDL_Vulkan_GetInstanceExtensions(&extensionCount, NULL)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Vulkan_GetInstanceExtensions(): %s\n", SDL_GetError()); @@ -238,7 +238,7 @@ static void createInstance(void) SDL_OutOfMemory(); quit(2); } - if (!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, extensions)) { + if (!SDL_Vulkan_GetInstanceExtensions(&extensionCount, extensions)) { SDL_free((void *)extensions); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Vulkan_GetInstanceExtensions(): %s\n",