SDL_GL_SwapWindow() returns an error code

main
Sylvain 2022-12-29 16:27:42 +01:00 committed by Sam Lantinga
parent abd051f89e
commit 88630b85f5
7 changed files with 12 additions and 14 deletions

View File

@ -827,6 +827,8 @@ Programs which have access to shaders can implement more robust versions of thos
Removed 'SDL_GL_CONTEXT_EGL' from OpenGL configuration attributes
You can instead use 'SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);'
'SDL_GL_SwapWindow()' returns an error code.
SDL_VideoInit() and SDL_VideoQuit() have been removed. Instead you can call SDL_InitSubSytem() and SDL_QuitSubSytem() with SDL_INIT_VIDEO, which will properly refcount the subsystems. You can choose a specific audio driver using SDL_VIDEO_DRIVER hint.
'SDL_WINDOW_SHOW' flag has been removed. It's activated by default, and can be unactivated by using SDL_WINDOW_HIDDEN

View File

@ -2013,9 +2013,12 @@ extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
*
* \param window the window to change
*
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
/**
* Delete an OpenGL context.

View File

@ -230,7 +230,7 @@ SDL_DYNAPI_PROC(int,SDL_GL_MakeCurrent,(SDL_Window *a, SDL_GLContext b),(a,b),re
SDL_DYNAPI_PROC(void,SDL_GL_ResetAttributes,(void),(),)
SDL_DYNAPI_PROC(int,SDL_GL_SetAttribute,(SDL_GLattr a, int b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GL_SetSwapInterval,(int a),(a),return)
SDL_DYNAPI_PROC(void,SDL_GL_SwapWindow,(SDL_Window *a),(a),)
SDL_DYNAPI_PROC(int,SDL_GL_SwapWindow,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GL_UnbindTexture,(SDL_Texture *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_GL_UnloadLibrary,(void),(),)
SDL_DYNAPI_PROC(SDL_GUID,SDL_GUIDFromString,(const char *a),(a),return)

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
#include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult and SDL_RecreateWindow */
#include "../../video/SDL_sysvideo.h" /* For SDL_RecreateWindow */
#include <SDL3/SDL_opengl.h>
#include "../SDL_sysrender.h"
#include "SDL_shaders_gl.h"
@ -1480,7 +1480,7 @@ static int GL_RenderPresent(SDL_Renderer *renderer)
{
GL_ActivateRenderer(renderer);
return SDL_GL_SwapWindowWithResult(renderer->window);
return SDL_GL_SwapWindow(renderer->window);
}
static void GL_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)

View File

@ -22,7 +22,7 @@
#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED
#include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult and SDL_RecreateWindow */
#include "../../video/SDL_sysvideo.h" /* For SDL_RecreateWindow */
#include <SDL3/SDL_opengles2.h>
#include "../SDL_sysrender.h"
#include "../../video/SDL_blit.h"
@ -1956,7 +1956,7 @@ static int GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
static int GLES2_RenderPresent(SDL_Renderer *renderer)
{
/* Tell the video driver to swap buffers */
return SDL_GL_SwapWindowWithResult(renderer->window);
return SDL_GL_SwapWindow(renderer->window);
}
static int GLES2_SetVSync(SDL_Renderer *renderer, const int vsync)

View File

@ -515,6 +515,4 @@ extern void SDL_ToggleDragAndDropSupport(void);
extern int SDL_GetDisplayIndexForPoint(const SDL_Point *point);
extern int SDL_GL_SwapWindowWithResult(SDL_Window *window);
#endif /* SDL_sysvideo_h_ */

View File

@ -4066,7 +4066,7 @@ int SDL_GL_GetSwapInterval(void)
}
}
int SDL_GL_SwapWindowWithResult(SDL_Window *window)
int SDL_GL_SwapWindow(SDL_Window *window)
{
CHECK_WINDOW_MAGIC(window, -1);
@ -4081,11 +4081,6 @@ int SDL_GL_SwapWindowWithResult(SDL_Window *window)
return _this->GL_SwapWindow(_this, window);
}
void SDL_GL_SwapWindow(SDL_Window *window)
{
SDL_GL_SwapWindowWithResult(window);
}
void SDL_GL_DeleteContext(SDL_GLContext context)
{
if (_this == NULL || !context) {