Remove SDL_GL/Metal/Vulkan_GetDrawableSize().
SDL_GetWindowSizeInPixels supersedes those functions.main
parent
0d0a34f79f
commit
90795291e4
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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++ */
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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++ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -305,7 +305,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
SDL_GetWindowSize(state->windows[0], &dw, &dh);
|
||||
SDL_Log("Window Size : %d,%d\n", dw, dh);
|
||||
SDL_GL_GetDrawableSize(state->windows[0], &dw, &dh);
|
||||
SDL_GetWindowSizeInPixels(state->windows[0], &dw, &dh);
|
||||
SDL_Log("Draw Size : %d,%d\n", dw, dh);
|
||||
SDL_Log("\n");
|
||||
SDL_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR));
|
||||
|
@ -411,7 +411,7 @@ int main(int argc, char *argv[])
|
|||
if (update_swap_interval) {
|
||||
SDL_GL_SetSwapInterval(swap_interval);
|
||||
}
|
||||
SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
|
||||
SDL_GetWindowSizeInPixels(state->windows[i], &w, &h);
|
||||
ctx.glViewport(0, 0, w, h);
|
||||
Render();
|
||||
SDL_GL_SwapWindow(state->windows[i]);
|
||||
|
|
|
@ -539,7 +539,7 @@ render_window(int index)
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_GL_GetDrawableSize(state->windows[index], &w, &h);
|
||||
SDL_GetWindowSizeInPixels(state->windows[index], &w, &h);
|
||||
Render(w, h, &datas[index]);
|
||||
SDL_GL_SwapWindow(state->windows[index]);
|
||||
++frames;
|
||||
|
@ -792,7 +792,7 @@ int main(int argc, char *argv[])
|
|||
/* Continue for next window */
|
||||
continue;
|
||||
}
|
||||
SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
|
||||
SDL_GetWindowSizeInPixels(state->windows[i], &w, &h);
|
||||
ctx.glViewport(0, 0, w, h);
|
||||
|
||||
data = &datas[i];
|
||||
|
|
|
@ -365,7 +365,7 @@ void loop()
|
|||
break;
|
||||
}
|
||||
/* Change view port to the new window dimensions */
|
||||
SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
|
||||
SDL_GetWindowSizeInPixels(state->windows[i], &w, &h);
|
||||
ctx.glViewport(0, 0, w, h);
|
||||
state->window_w = event.window.data1;
|
||||
state->window_h = event.window.data2;
|
||||
|
@ -396,7 +396,7 @@ void loop()
|
|||
int w, h;
|
||||
SDL_Rect rs, rd;
|
||||
|
||||
SDL_GL_GetDrawableSize(state->windows[0], &w, &h);
|
||||
SDL_GetWindowSizeInPixels(state->windows[0], &w, &h);
|
||||
|
||||
rs.x = 0;
|
||||
rs.y = 0;
|
||||
|
@ -700,7 +700,7 @@ int main(int argc, char *argv[])
|
|||
GL_CHECK(ctx.glTexSubImage2D(g_texture_type, 0, 0 /* xoffset */, 0 /* yoffset */, g_surf_sdf->w, g_surf_sdf->h, format, type, g_surf_sdf->pixels));
|
||||
}
|
||||
|
||||
SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
|
||||
SDL_GetWindowSizeInPixels(state->windows[i], &w, &h);
|
||||
ctx.glViewport(0, 0, w, h);
|
||||
|
||||
data = &datas[i];
|
||||
|
|
|
@ -649,10 +649,10 @@ static SDL_bool createSwapchain(void)
|
|||
}
|
||||
|
||||
// get size
|
||||
SDL_Vulkan_GetDrawableSize(vulkanContext->window, &w, &h);
|
||||
SDL_GetWindowSizeInPixels(vulkanContext->window, &w, &h);
|
||||
|
||||
// Clamp the size to the allowable image extent.
|
||||
// SDL_Vulkan_GetDrawableSize()'s result it not always in this range (bug #3287)
|
||||
// SDL_GetWindowSizeInPixels()'s result it not always in this range (bug #3287)
|
||||
vulkanContext->swapchainSize.width = SDL_clamp((uint32_t)w,
|
||||
vulkanContext->surfaceCapabilities.minImageExtent.width,
|
||||
vulkanContext->surfaceCapabilities.maxImageExtent.width);
|
||||
|
@ -1070,7 +1070,7 @@ static SDL_bool render(void)
|
|||
getVulkanResultString(result));
|
||||
quit(2);
|
||||
}
|
||||
SDL_Vulkan_GetDrawableSize(vulkanContext->window, &w, &h);
|
||||
SDL_GetWindowSizeInPixels(vulkanContext->window, &w, &h);
|
||||
if (w != (int)vulkanContext->swapchainSize.width || h != (int)vulkanContext->swapchainSize.height) {
|
||||
return createNewSwapchainAndSwapchainSpecificStuff();
|
||||
}
|
||||
|
@ -1108,7 +1108,7 @@ int main(int argc, char **argv)
|
|||
SDL_Log("Screen BPP : %" SDL_PRIu32 "\n", SDL_BITSPERPIXEL(mode.format));
|
||||
SDL_GetWindowSize(state->windows[0], &dw, &dh);
|
||||
SDL_Log("Window Size : %d,%d\n", dw, dh);
|
||||
SDL_Vulkan_GetDrawableSize(state->windows[0], &dw, &dh);
|
||||
SDL_GetWindowSizeInPixels(state->windows[0], &dw, &dh);
|
||||
SDL_Log("Draw Size : %d,%d\n", dw, dh);
|
||||
SDL_Log("\n");
|
||||
|
||||
|
|
Loading…
Reference in New Issue