SDL: Remove SDL_GL/Metal/Vulkan_GetDrawableSize().

From 90795291e42805a3b376e711573d3b7479ac9a23 Mon Sep 17 00:00:00 2001
From: Sasha Szpakowski <[EMAIL REDACTED]>
Date: Sat, 28 Jan 2023 22:43:03 -0400
Subject: [PATCH] Remove SDL_GL/Metal/Vulkan_GetDrawableSize().

SDL_GetWindowSizeInPixels supersedes those functions.
---
 docs/README-ios.md                       |  6 ++---
 docs/README-migration.md                 |  8 ++++++
 include/SDL3/SDL_metal.h                 | 16 ------------
 include/SDL3/SDL_video.h                 | 32 ++++-------------------
 include/SDL3/SDL_vulkan.h                | 22 ----------------
 src/dynapi/SDL_dynapi.sym                |  3 ---
 src/dynapi/SDL_dynapi_overrides.h        |  3 ---
 src/dynapi/SDL_dynapi_procs.h            |  3 ---
 src/render/opengl/SDL_render_gl.c        |  4 +--
 src/render/opengles2/SDL_render_gles2.c  |  4 +--
 src/render/vitagxm/SDL_render_vita_gxm.c |  2 +-
 src/video/SDL_sysvideo.h                 |  3 ---
 src/video/SDL_video.c                    | 33 ------------------------
 src/video/cocoa/SDL_cocoametalview.h     |  1 -
 src/video/cocoa/SDL_cocoametalview.m     | 22 ----------------
 src/video/cocoa/SDL_cocoaopengles.h      |  2 --
 src/video/cocoa/SDL_cocoaopengles.m      | 20 --------------
 src/video/cocoa/SDL_cocoavideo.m         |  3 ---
 src/video/cocoa/SDL_cocoavulkan.h        |  2 --
 src/video/cocoa/SDL_cocoavulkan.m        |  5 ----
 src/video/kmsdrm/SDL_kmsdrmvideo.c       |  1 -
 src/video/kmsdrm/SDL_kmsdrmvulkan.c      | 11 --------
 src/video/kmsdrm/SDL_kmsdrmvulkan.h      |  1 -
 src/video/uikit/SDL_uikitmetalview.h     |  1 -
 src/video/uikit/SDL_uikitmetalview.m     | 21 ---------------
 src/video/uikit/SDL_uikitopengles.h      |  2 --
 src/video/uikit/SDL_uikitopengles.m      | 19 --------------
 src/video/uikit/SDL_uikitvideo.m         |  3 ---
 src/video/uikit/SDL_uikitvulkan.h        |  2 --
 src/video/uikit/SDL_uikitvulkan.m        |  5 ----
 test/testgl.c                            |  4 +--
 test/testgles2.c                         |  4 +--
 test/testgles2_sdf.c                     |  6 ++---
 test/testvulkan.c                        |  8 +++---
 34 files changed, 32 insertions(+), 250 deletions(-)

diff --git a/docs/README-ios.md b/docs/README-ios.md
index 52d765ada13f..d5e4914b5951 100644
--- a/docs/README-ios.md
+++ b/docs/README-ios.md
@@ -48,9 +48,9 @@ creating your window to enable high-dpi support.
 When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes
 will still be in "screen coordinates" rather than pixels, but the window will
 have a much greater pixel density when the device supports it, and the
-SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on
-whether raw OpenGL or the SDL_Render API is used) can be queried to determine
-the size in pixels of the drawable screen framebuffer.
+SDL_GetWindowSizeInPixels() or SDL_GetRendererOutputSize() functions (depending
+on whether the SDL_Render API is used) can be queried to determine the size in
+pixels of the drawable screen framebuffer.
 
 Some OpenGL ES functions such as glViewport expect sizes in pixels rather than
 sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 39079543b490..5b38038ad1fd 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -508,6 +508,10 @@ Furthermore, the different SDL_*RunApp() functions (SDL_WinRtRunApp, SDL_GDKRunA
 have been unified into just `int SDL_RunApp(int argc, char* argv[], void * reserved)` (which is also
 used by additional platforms that didn't have a SDL_RunApp-like function before).
 
+## SDL_metal.h
+
+SDL_Metal_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.
+
 ## SDL_mouse.h
 
 SDL_ShowCursor() has been split into three functions: SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()
@@ -974,6 +978,8 @@ SDL_GL_SwapWindow() returns 0 if the function succeeds or a negative error code
 
 SDL_GL_GetSwapInterval() takes the interval as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error.
 
+SDL_GL_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.
+
 The following functions have been renamed:
 * SDL_GetDisplayDPI() => SDL_GetDisplayPhysicalDPI()
 * SDL_GetPointDisplayIndex() => SDL_GetDisplayIndexForPoint()
@@ -992,3 +998,5 @@ SDL_Vulkan_GetInstanceExtensions() no longer takes a window parameter.
 
 SDL_Vulkan_GetVkGetInstanceProcAddr() now returns `SDL_FunctionPointer` instead of `void *`, and should be cast to PFN_vkGetInstanceProcAddr.
 
+SDL_Vulkan_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.
+
diff --git a/include/SDL3/SDL_metal.h b/include/SDL3/SDL_metal.h
index b5051d2d69f5..07d83e6ed661 100644
--- a/include/SDL3/SDL_metal.h
+++ b/include/SDL3/SDL_metal.h
@@ -86,22 +86,6 @@ extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
  */
 extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
 
-/**
- * Get the size of a window's underlying drawable in pixels (for use with
- * setting viewport, scissor & etc).
- *
- * \param window SDL_Window from which the drawable size should be queried
- * \param w Pointer to variable for storing the width in pixels, may be NULL
- * \param h Pointer to variable for storing the height in pixels, may be NULL
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_GetWindowSize
- * \sa SDL_CreateWindow
- */
-extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
-                                                       int *h);
-
 /* @} *//* Metal support functions */
 
 /* Ends C function definitions when using C++ */
diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h
index 1db122050b15..1d8255abb679 100644
--- a/include/SDL3/SDL_video.h
+++ b/include/SDL3/SDL_video.h
@@ -385,12 +385,10 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rec
  * **WARNING**: This reports the DPI that the hardware reports, and it is not
  * always reliable! It is almost always better to use SDL_GetWindowSize() to
  * find the window size, which might be in logical points instead of pixels,
- * and then SDL_GetWindowSizeInPixels(), SDL_GL_GetDrawableSize(),
- * SDL_Vulkan_GetDrawableSize(), SDL_Metal_GetDrawableSize(), or
- * SDL_GetRendererOutputSize(), and compare the two values to get an actual
- * scaling value between the two. We will be rethinking how high-dpi details
- * should be managed in SDL3 to make things more consistent, reliable, and
- * clear.
+ * and then SDL_GetWindowSizeInPixels() or SDL_GetRendererOutputSize(), and
+ * compare the two values to get an actual scaling value between the two. We
+ * will be rethinking how high-dpi details should be managed in SDL3 to make
+ * things more consistent, reliable, and clear.
  *
  * \param displayIndex the index of the display from which DPI information
  *                     should be queried
@@ -905,8 +903,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h)
  *
  * The window size in screen coordinates may differ from the size in pixels if
  * the window is on a high density display (one with an OS scaling factor).
- * Use SDL_GetWindowSizeInPixels(), SDL_GL_GetDrawableSize(),
- * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to get the
+ * Use SDL_GetWindowSizeInPixels() or SDL_GetRendererOutputSize() to get the
  * real client area size in pixels.
  *
  * \param window the window to query the width and height from
@@ -916,8 +913,6 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h)
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetWindowSizeInPixels
- * \sa SDL_GL_GetDrawableSize
- * \sa SDL_Vulkan_GetDrawableSize
  * \sa SDL_GetRendererOutputSize
  * \sa SDL_SetWindowSize
  */
@@ -1895,23 +1890,6 @@ extern DECLSPEC void SDLCALL SDL_EGL_SetEGLAttributeCallbacks(SDL_EGLAttribArray
                                                               SDL_EGLIntArrayCallback surfaceAttribCallback,
                                                               SDL_EGLIntArrayCallback contextAttribCallback);
 
-/**
- * Get the size of a window's underlying drawable in pixels.
- *
- * This returns info useful for calling glViewport().
- *
- * \param window the window from which the drawable size should be queried
- * \param w a pointer to variable for storing the width in pixels, may be NULL
- * \param h a pointer to variable for storing the height in pixels, may be
- *          NULL
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_CreateWindow
- * \sa SDL_GetWindowSize
- */
-extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window *window, int *w, int *h);
-
 /**
  * Set the swap interval for the current OpenGL context.
  *
diff --git a/include/SDL3/SDL_vulkan.h b/include/SDL3/SDL_vulkan.h
index 0266d9b34376..ce06e3a28d0e 100644
--- a/include/SDL3/SDL_vulkan.h
+++ b/include/SDL3/SDL_vulkan.h
@@ -179,33 +179,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(unsigned int *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_Vulkan_GetInstanceExtensions
- * \sa SDL_Vulkan_GetDrawableSize
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
                                                           VkInstance instance,
                                                           VkSurfaceKHR* surface);
 
-/**
- * Get the size of the window's underlying drawable dimensions in pixels.
- *
- * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
- * drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a
- * platform with high-DPI support (Apple calls this "Retina"), and not
- * disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint.
- *
- * \param window an SDL_Window for which the size is to be queried
- * \param w Pointer to the variable to write the width to or NULL
- * \param h Pointer to the variable to write the height to or NULL
- *
- * \since This function is available since SDL 3.0.0.
- *
- * \sa SDL_GetWindowSize
- * \sa SDL_CreateWindow
- * \sa SDL_Vulkan_CreateSurface
- */
-extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
-                                                        int *w, int *h);
-
 /* @} *//* Vulkan support functions */
 
 /* Ends C function definitions when using C++ */
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 295b5810d928..11f0f2477d72 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -119,7 +119,6 @@ SDL3_0.0.0 {
     SDL_GL_GetAttribute;
     SDL_GL_GetCurrentContext;
     SDL_GL_GetCurrentWindow;
-    SDL_GL_GetDrawableSize;
     SDL_GL_GetProcAddress;
     SDL_GL_GetSwapInterval;
     SDL_GL_LoadLibrary;
@@ -473,7 +472,6 @@ SDL3_0.0.0 {
     SDL_MemoryBarrierReleaseFunction;
     SDL_Metal_CreateView;
     SDL_Metal_DestroyView;
-    SDL_Metal_GetDrawableSize;
     SDL_Metal_GetLayer;
     SDL_MinimizeWindow;
     SDL_MixAudioFormat;
@@ -670,7 +668,6 @@ SDL3_0.0.0 {
     SDL_UpdateWindowSurfaceRects;
     SDL_UpdateYUVTexture;
     SDL_Vulkan_CreateSurface;
-    SDL_Vulkan_GetDrawableSize;
     SDL_Vulkan_GetInstanceExtensions;
     SDL_Vulkan_GetVkGetInstanceProcAddr;
     SDL_Vulkan_LoadLibrary;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index b7e92e9c4f94..831d5c486dba 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -144,7 +144,6 @@
 #define SDL_GL_GetAttribute SDL_GL_GetAttribute_REAL
 #define SDL_GL_GetCurrentContext SDL_GL_GetCurrentContext_REAL
 #define SDL_GL_GetCurrentWindow SDL_GL_GetCurrentWindow_REAL
-#define SDL_GL_GetDrawableSize SDL_GL_GetDrawableSize_REAL
 #define SDL_GL_GetProcAddress SDL_GL_GetProcAddress_REAL
 #define SDL_GL_GetSwapInterval SDL_GL_GetSwapInterval_REAL
 #define SDL_GL_LoadLibrary SDL_GL_LoadLibrary_REAL
@@ -498,7 +497,6 @@
 #define SDL_MemoryBarrierReleaseFunction SDL_MemoryBarrierReleaseFunction_REAL
 #define SDL_Metal_CreateView SDL_Metal_CreateView_REAL
 #define SDL_Metal_DestroyView SDL_Metal_DestroyView_REAL
-#define SDL_Metal_GetDrawableSize SDL_Metal_GetDrawableSize_REAL
 #define SDL_Metal_GetLayer SDL_Metal_GetLayer_REAL
 #define SDL_MinimizeWindow SDL_MinimizeWindow_REAL
 #define SDL_MixAudioFormat SDL_MixAudioFormat_REAL
@@ -695,7 +693,6 @@
 #define SDL_UpdateWindowSurfaceRects SDL_UpdateWindowSurfaceRects_REAL
 #define SDL_UpdateYUVTexture SDL_UpdateYUVTexture_REAL
 #define SDL_Vulkan_CreateSurface SDL_Vulkan_CreateSurface_REAL
-#define SDL_Vulkan_GetDrawableSize SDL_Vulkan_GetDrawableSize_REAL
 #define SDL_Vulkan_GetInstanceExtensions SDL_Vulkan_GetInstanceExtensions_REAL
 #define SDL_Vulkan_GetVkGetInstanceProcAddr SDL_Vulkan_GetVkGetInstanceProcAddr_REAL
 #define SDL_Vulkan_LoadLibrary SDL_Vulkan_LoadLibrary_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 0dde18dfdaac..2f8b178106ea 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -219,7 +219,6 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GL_ExtensionSupported,(const char *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GL_GetAttribute,(SDL_GLattr a, int *b),(a,b),return)
 SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_GetCurrentContext,(void),(),return)
 SDL_DYNAPI_PROC(SDL_Window*,SDL_GL_GetCurrentWindow,(void),(),return)
-SDL_DYNAPI_PROC(void,SDL_GL_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
 SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_GL_GetProcAddress,(const char *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GL_GetSwapInterval,(int *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GL_LoadLibrary,(const char *a),(a),return)
@@ -557,7 +556,6 @@ SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),)
 SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),)
 SDL_DYNAPI_PROC(SDL_MetalView,SDL_Metal_CreateView,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_Metal_DestroyView,(SDL_MetalView a),(a),)
-SDL_DYNAPI_PROC(void,SDL_Metal_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
 SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_MinimizeWindow,(SDL_Window *a),(a),)
 SDL_DYNAPI_PROC(void,SDL_MixAudioFormat,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, int e),(a,b,c,d,e),)
@@ -748,7 +746,6 @@ SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurface,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return)
 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,(unsigned int *a, const char **b),(a,b),return)
 SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return)
 SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 1b14ea34ae03..4310710fe2cb 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -333,7 +333,7 @@ static void GL_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
 
 static int GL_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
 {
-    SDL_GL_GetDrawableSize(renderer->window, w, h);
+    SDL_GetWindowSizeInPixels(renderer->window, w, h);
     return 0;
 }
 
@@ -1184,7 +1184,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
     data->drawstate.target = renderer->target;
     if (!data->drawstate.target) {
         int w, h;
-        SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+        SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
         if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
             data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
             data->drawstate.cliprect_dirty = SDL_TRUE;
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 9612060df58a..9a7e6daa4ebc 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -313,7 +313,7 @@ static void GLES2_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *eve
 
 static int GLES2_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
 {
-    SDL_GL_GetDrawableSize(renderer->window, w, h);
+    SDL_GetWindowSizeInPixels(renderer->window, w, h);
     return 0;
 }
 
@@ -1173,7 +1173,7 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
     data->drawstate.target = renderer->target;
     if (!data->drawstate.target) {
         int w, h;
-        SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+        SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
         if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
             data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
             data->drawstate.cliprect_dirty = SDL_TRUE;
diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index 6580c76d079b..e661e53f2043 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -937,7 +937,7 @@ static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *c
     data->drawstate.target = renderer->target;
     if (!data->drawstate.target) {
         int w, h;
-        SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+        SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
         if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
             data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
             data->drawstate.cliprect_dirty = SDL_TRUE;
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index 12d0f5c43573..4caef3ff111c 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -269,7 +269,6 @@ struct SDL_VideoDevice
     void (*GL_UnloadLibrary)(_THIS);
     SDL_GLContext (*GL_CreateContext)(_THIS, SDL_Window *window);
     int (*GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context);
-    void (*GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h);
     SDL_EGLSurface (*GL_GetEGLSurface)(_THIS, SDL_Window *window);
     int (*GL_SetSwapInterval)(_THIS, int interval);
     int (*GL_GetSwapInterval)(_THIS, int *interval);
@@ -285,7 +284,6 @@ struct SDL_VideoDevice
     void (*Vulkan_UnloadLibrary)(_THIS);
     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);
 
     /* * * */
     /*
@@ -294,7 +292,6 @@ struct SDL_VideoDevice
     SDL_MetalView (*Metal_CreateView)(_THIS, SDL_Window *window);
     void (*Metal_DestroyView)(_THIS, SDL_MetalView view);
     void *(*Metal_GetLayer)(_THIS, SDL_MetalView view);
-    void (*Metal_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h);
 
     /* * * */
     /*
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index db4824e02bda..8918428c9d91 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -4148,17 +4148,6 @@ SDL_EGLConfig SDL_EGL_GetWindowEGLSurface(SDL_Window *window)
 #endif
 }
 
-void SDL_GL_GetDrawableSize(SDL_Window *window, int *w, int *h)
-{
-    CHECK_WINDOW_MAGIC(window, );
-
-    if (_this->GL_GetDrawableSize) {
-        _this->GL_GetDrawableSize(_this, window, w, h);
-    } else {
-        SDL_GetWindowSizeInPixels(window, w, h);
-    }
-}
-
 int SDL_GL_SetSwapInterval(int interval)
 {
     if (_this == NULL) {
@@ -4820,17 +4809,6 @@ SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,
     return _this->Vulkan_CreateSurface(_this, window, instance, surface);
 }
 
-void SDL_Vulkan_GetDrawableSize(SDL_Window *window, int *w, int *h)
-{
-    CHECK_WINDOW_MAGIC(window, );
-
-    if (_this->Vulkan_GetDrawableSize) {
-        _this->Vulkan_GetDrawableSize(_this, window, w, h);
-    } else {
-        SDL_GetWindowSizeInPixels(window, w, h);
-    }
-}
-
 SDL_MetalView SDL_Metal_CreateView(SDL_Window *window)
 {
     CHECK_WINDOW_MAGIC(window, NULL);
@@ -4872,14 +4850,3 @@ void *SDL_Metal_GetLayer(SDL_MetalView view)
         return NULL;
     }
 }
-
-void SDL_Metal_GetDrawableSize(SDL_Window *window, int *w, int *h)
-{
-    CHECK_WINDOW_MAGIC(window, );
-
-    if (_this->Metal_GetDrawableSize) {
-        _this->Metal_GetDrawableSize(_this, window, w, h);
-    } else {
-        SDL_GetWindowSizeInPixels(window, w, h);
-    }
-}
diff --git a/src/video/cocoa/SDL_cocoametalview.h b/src/video/cocoa/SDL_cocoametalview.h
index 3e8b0e86975d..d53fc30f9ec8 100644
--- a/src/video/cocoa/SDL_cocoametalview.h
+++ b/src/video/cocoa/SDL_cocoametalview.h
@@ -59,7 +59,6 @@
 SDL_MetalView Cocoa_Metal_CreateView(_THIS, SDL_Window *window);
 void Cocoa_Metal_DestroyView(_THIS, SDL_MetalView view);
 void *Cocoa_Metal_GetLayer(_THIS, SDL_MetalView view);
-void Cocoa_Metal_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
 
 #endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) */
 
diff --git a/src/video/cocoa/SDL_cocoametalview.m b/src/video/cocoa/SDL_cocoametalview.m
index 841d6eb37ab6..a6f187b9d05d 100644
--- a/src/video/cocoa/SDL_cocoametalview.m
+++ b/src/video/cocoa/SDL_cocoametalview.m
@@ -173,26 +173,4 @@ void Cocoa_Metal_DestroyView(_THIS, SDL_MetalView view)
     }
 }
 
-void Cocoa_Metal_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
-{
-    @autoreleasepool {
-        SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
-        NSView *contentView = data.sdlContentView;
-        SDL_cocoametalview *metalview = [contentView viewWithTag:SDL_METALVIEW_TAG];
-        if (metalview) {
-            CAMetalLayer *layer = (CAMetalLayer *)metalview.layer;
-            SDL_assert(layer != NULL);
-            if (w) {
-                *w = layer.drawableSize.width;
-            }
-            if (h) {
-                *h = layer.drawableSize.height;
-            }
-        } else {
-            /* Fall back to the viewport size. */
-            SDL_GetWindowSizeInPixels(window, w, h);
-        }
-    }
-}
-
 #endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) */
diff --git a/src/video/cocoa/SDL_cocoaopengles.h b/src/video/cocoa/SDL_cocoaopengles.h
index cf3d15ff89b8..2b89e10a5d11 100644
--- a/src/video/cocoa/SDL_cocoaopengles.h
+++ b/src/video/cocoa/SDL_cocoaopengles.h
@@ -39,8 +39,6 @@ extern int Cocoa_GLES_LoadLibrary(_THIS, const char *path);
 extern SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window *window);
 extern int Cocoa_GLES_SwapWindow(_THIS, SDL_Window *window);
 extern int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
-extern void Cocoa_GLES_GetDrawableSize(_THIS, SDL_Window *window,
-                                       int *w, int *h);
 extern void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context);
 extern int Cocoa_GLES_SetupWindow(_THIS, SDL_Window *window);
 extern SDL_EGLSurface Cocoa_GLES_GetEGLSurface(_THIS, SDL_Window *window);
diff --git a/src/video/cocoa/SDL_cocoaopengles.m b/src/video/cocoa/SDL_cocoaopengles.m
index 473502d9825d..2fce9410665e 100644
--- a/src/video/cocoa/SDL_cocoaopengles.m
+++ b/src/video/cocoa/SDL_cocoaopengles.m
@@ -114,26 +114,6 @@ int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
     }
 }
 
-void Cocoa_GLES_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
-{
-    @autoreleasepool {
-        SDL_WindowData *windata = (__bridge SDL_WindowData *)window->driverdata;
-        NSView *contentView = windata.nswindow.contentView;
-        CALayer *layer = [contentView layer];
-
-        int width = layer.bounds.size.width * layer.contentsScale;
-        int height = layer.bounds.size.height * layer.contentsScale;
-
-        if (w) {
-            *w = width;
-        }
-
-        if (h) {
-            *h = height;
-        }
-    }
-}
-
 int Cocoa_GLES_SetupWindow(_THIS, SDL_Window *window)
 {
     @autoreleasepool {
diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m
index 9e20914175cd..5bc47b44fa83 100644
--- a/src/video/cocoa/SDL_cocoavideo.m
+++ b/src/video/cocoa/SDL_cocoavideo.m
@@ -145,7 +145,6 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice *device)
             device->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary;
             device->GL_CreateContext = Cocoa_GLES_CreateContext;
             device->GL_MakeCurrent = Cocoa_GLES_MakeCurrent;
-            device->GL_GetDrawableSize = Cocoa_GLES_GetDrawableSize;
             device->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval;
             device->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval;
             device->GL_SwapWindow = Cocoa_GLES_SwapWindow;
@@ -161,14 +160,12 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice *device)
         device->Vulkan_UnloadLibrary = Cocoa_Vulkan_UnloadLibrary;
         device->Vulkan_GetInstanceExtensions = Cocoa_Vulkan_GetInstanceExtensions;
         device->Vulkan_CreateSurface = Cocoa_Vulkan_CreateSurface;
-        device->Vulkan_GetDrawableSize = Cocoa_Vulkan_GetDrawableSize;
 #endif
 
 #if SDL_VIDEO_METAL
         device->Metal_CreateView = Cocoa_Metal_CreateView;
         device->Metal_DestroyView = Cocoa_Metal_DestroyView;
         device->Metal_GetLayer = Cocoa_Metal_GetLayer;
-        device->Metal_GetDrawableSize = Cocoa_Metal_GetDrawableSize;
 #endif
 
         device->StartTextInput = Cocoa_StartTextInput;
diff --git a/src/video/cocoa/SDL_cocoavulkan.h b/src/video/cocoa/SDL_cocoavulkan.h
index 39db6b1a6c4b..7aa848c667ef 100644
--- a/src/video/cocoa/SDL_cocoavulkan.h
+++ b/src/video/cocoa/SDL_cocoavulkan.h
@@ -44,8 +44,6 @@ SDL_bool Cocoa_Vulkan_CreateSurface(_THIS,
                                     VkInstance instance,
                                     VkSurfaceKHR *surface);
 
-void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
-
 #endif
 
 #endif /* SDL_cocoavulkan_h_ */
diff --git a/src/video/cocoa/SDL_cocoavulkan.m b/src/video/cocoa/SDL_cocoavulkan.m
index e0905315e4ca..a28e1284548e 100644
--- a/src/video/cocoa/SDL_cocoavulkan.m
+++ b/src/video/cocoa/SDL_cocoavulkan.m
@@ -301,11 +301,6 @@ SDL_bool Cocoa_Vulkan_CreateSurface(_THIS,
     return SDL_TRUE;
 }
 
-void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
-{
-    Cocoa_Metal_GetDrawableSize(_this, window, w, h);
-}
-
 #endif
 
 /* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 70cbd1faac86..a528a8d15d03 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -314,7 +314,6 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void)
     device->Vulkan_UnloadLibrary = KMSDRM_Vulkan_UnloadLibrary;
     device->Vulkan_GetInstanceExtensions = KMSDRM_Vulkan_GetInstanceExtensions;
     device->Vulkan_CreateSurface = KMSDRM_Vulkan_CreateSurface;
-    device->Vulkan_GetDrawableSize = KMSDRM_Vulkan_GetDrawableSize;
 #endif
 
     device->PumpEvents = KMSDRM_PumpEvents;
diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/src/video/kmsdrm/SDL_kmsdrmvulkan.c
index fcdf10892971..74d013e56b23 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvulkan.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.c
@@ -156,17 +156,6 @@ SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(_THIS,
         extensionsForKMSDRM);
 }
 
-void KMSDRM_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
-{
-    if (w) {
-        *w = window->w;
-    }
-
-    if (h) {
-        *h = window->h;
-    }
-}
-
 /***********************************************************************/
 /* First thing to know is that we don't call vkCreateInstance() here.  */
 /* Instead, programs using SDL and Vulkan create their Vulkan instance */
diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.h b/src/video/kmsdrm/SDL_kmsdrmvulkan.h
index 9384f463e2dc..6c0f6ba2815b 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvulkan.h
+++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.h
@@ -39,7 +39,6 @@ void KMSDRM_Vulkan_UnloadLibrary(_THIS);
 SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(_THIS,
                                              unsigned *count,
                                              const char **names);
-void KMSDRM_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
 SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
                                      SDL_Window *window,
                                      VkInstance instance,
diff --git a/src/video/uikit/SDL_uikitmetalview.h b/src/video/uikit/SDL_uikitmetalview.h
index 6b7af3fb86d8..30514755dfcc 100644
--- a/src/video/uikit/SDL_uikitmetalview.h
+++ b/src/video/uikit/SDL_uikitmetalview.h
@@ -48,7 +48,6 @@
 SDL_MetalView UIKit_Metal_CreateView(_THIS, SDL_Window *window);
 void UIKit_Metal_DestroyView(_THIS, SDL_MetalView view);
 void *UIKit_Metal_GetLayer(_THIS, SDL_MetalView view);
-void UIKit_Metal_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
 
 #endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) */
 
diff --git a/src/video/uikit/SDL_uikitmetalview.m b/src/video/uikit/SDL_uikitmetalview.m
index cdb3b80e1ec6..c7628b85748f 100644
--- a/src/video/uikit/SDL_uikitmetalview.m
+++ b/src/video/uikit/SDL_uikitmetalview.m
@@ -124,25 +124,4 @@ void UIKit_Metal_DestroyView(_THIS, SDL_MetalView view)
     }
 }
 
-void UIKit_Metal_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
-{
-    @autoreleasepool {
-        SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
-        SDL_uikitview *view = (SDL_uikitview *)data.uiwindow.rootViewController.view;
-        SDL_uikitmetalview *metalview = [view viewWithTag:SDL_METALVIEW_TAG];
-        if (metalview) {
-            CAMetalLayer *layer = (CAMetalLayer *)metalview.layer;
-            assert(layer != NULL);
-            if (w) {
-                *w = layer.drawableSize.width;
-            }
-            if (h) {
-                *h = layer.drawableSize.height;
-            }
-        } else {
-            SDL_GetWindowSize(window, w, h);
-        }
-    }
-}
-
 #endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) */
diff --git a/src/video/uikit/SDL_uikitopengles.h b/src/video/uikit/SDL_uikitopengles.h
index efd795259965..7c2ff158d28a 100644
--- a/src/video/uikit/SDL_uikitopengles.h
+++ b/src/video/uikit/SDL_uikitopengles.h
@@ -27,8 +27,6 @@
 
 extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window *window,
                                 SDL_GLContext context);
-extern void UIKit_GL_GetDrawableSize(_THIS, SDL_Window *window,
-                                     int *w, int *h);
 extern int UIKit_GL_SwapWindow(_THIS, SDL_Window *window);
 extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window);
 extern void UIKit_GL_DeleteContext(_THIS, SDL_GLC

(Patch may be truncated, please check the link at the top of this post.)