Remove SDL_GL/Metal/Vulkan_GetDrawableSize().
SDL_GetWindowSizeInPixels supersedes those functions.
This commit is contained in:
committed by
Sam Lantinga
parent
0d0a34f79f
commit
90795291e4
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
/* * * */
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) */
|
||||
|
||||
|
||||
@@ -173,26 +173,4 @@ Cocoa_Metal_GetLayer(_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) */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -145,7 +145,6 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void)
|
||||
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 SDL_VideoDevice *Cocoa_CreateDevice(void)
|
||||
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;
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -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: */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) */
|
||||
|
||||
|
||||
@@ -124,25 +124,4 @@ UIKit_Metal_GetLayer(_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) */
|
||||
|
||||
@@ -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_GLContext context);
|
||||
|
||||
@@ -79,25 +79,6 @@ int UIKit_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UIKit_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
|
||||
{
|
||||
@autoreleasepool {
|
||||
SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
|
||||
UIView *view = data.viewcontroller.view;
|
||||
if ([view isKindOfClass:[SDL_uikitopenglview class]]) {
|
||||
SDL_uikitopenglview *glview = (SDL_uikitopenglview *)view;
|
||||
if (w) {
|
||||
*w = glview.backingWidth;
|
||||
}
|
||||
if (h) {
|
||||
*h = glview.backingHeight;
|
||||
}
|
||||
} else {
|
||||
SDL_GetWindowSize(window, w, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int UIKit_GL_LoadLibrary(_THIS, const char *path)
|
||||
{
|
||||
/* We shouldn't pass a path to this function, since we've already loaded the
|
||||
|
||||
@@ -111,7 +111,6 @@ static SDL_VideoDevice *UIKit_CreateDevice(void)
|
||||
/* OpenGL (ES) functions */
|
||||
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||
device->GL_MakeCurrent = UIKit_GL_MakeCurrent;
|
||||
device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize;
|
||||
device->GL_SwapWindow = UIKit_GL_SwapWindow;
|
||||
device->GL_CreateContext = UIKit_GL_CreateContext;
|
||||
device->GL_DeleteContext = UIKit_GL_DeleteContext;
|
||||
@@ -125,14 +124,12 @@ static SDL_VideoDevice *UIKit_CreateDevice(void)
|
||||
device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary;
|
||||
device->Vulkan_GetInstanceExtensions = UIKit_Vulkan_GetInstanceExtensions;
|
||||
device->Vulkan_CreateSurface = UIKit_Vulkan_CreateSurface;
|
||||
device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize;
|
||||
#endif
|
||||
|
||||
#if SDL_VIDEO_METAL
|
||||
device->Metal_CreateView = UIKit_Metal_CreateView;
|
||||
device->Metal_DestroyView = UIKit_Metal_DestroyView;
|
||||
device->Metal_GetLayer = UIKit_Metal_GetLayer;
|
||||
device->Metal_GetDrawableSize = UIKit_Metal_GetDrawableSize;
|
||||
#endif
|
||||
|
||||
device->gl_config.accelerated = 1;
|
||||
|
||||
@@ -44,8 +44,6 @@ SDL_bool UIKit_Vulkan_CreateSurface(_THIS,
|
||||
VkInstance instance,
|
||||
VkSurfaceKHR *surface);
|
||||
|
||||
void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* SDL_uikitvulkan_h_ */
|
||||
|
||||
@@ -260,9 +260,4 @@ SDL_bool UIKit_Vulkan_CreateSurface(_THIS,
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
|
||||
{
|
||||
UIKit_Metal_GetDrawableSize(_this, window, w, h);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user