mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-24 05:10:42 -04:00
Fix egl backend not behaving properly after resize
This commit is contained in:
parent
219a8e9cf9
commit
874509d5df
@ -994,13 +994,12 @@ static FUNC_GLBUFFERDATA _glBufferData;
|
|||||||
static FUNC_GLBUFFERSUBDATA _glBufferSubData;
|
static FUNC_GLBUFFERSUBDATA _glBufferSubData;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GL_TEXTURE_MAX_LEVEL 0x813D
|
#if defined CC_BUILD_WEB || defined CC_BUILD_ANDROID
|
||||||
#ifndef CC_BUILD_WEB
|
|
||||||
#define PIXEL_FORMAT 0x80E1 /* GL_BGRA_EXT */
|
|
||||||
#else
|
|
||||||
#define PIXEL_FORMAT GL_RGBA
|
#define PIXEL_FORMAT GL_RGBA
|
||||||
|
#else
|
||||||
|
#define PIXEL_FORMAT 0x80E1 /* GL_BGRA_EXT */
|
||||||
#endif
|
#endif
|
||||||
static int gl_compare[8] = { GL_ALWAYS, GL_NOTEQUAL, GL_NEVER, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER };
|
#define GL_TEXTURE_MAX_LEVEL 0x813D
|
||||||
|
|
||||||
typedef void (*GL_SetupVBFunc)(void);
|
typedef void (*GL_SetupVBFunc)(void);
|
||||||
typedef void (*GL_SetupVBRangeFunc)(int startVertex);
|
typedef void (*GL_SetupVBRangeFunc)(int startVertex);
|
||||||
|
15
src/Window.c
15
src/Window.c
@ -2880,8 +2880,6 @@ static void JNICALL java_processSurfaceDestroyed(JNIEnv* env, jobject o) {
|
|||||||
if (win_handle) ANativeWindow_release(win_handle);
|
if (win_handle) ANativeWindow_release(win_handle);
|
||||||
|
|
||||||
win_handle = NULL;
|
win_handle = NULL;
|
||||||
Window_Focused = false;
|
|
||||||
Event_RaiseVoid(&WindowEvents.FocusChanged);
|
|
||||||
/* TODO: Do we Window_Close() here */
|
/* TODO: Do we Window_Close() here */
|
||||||
/* TODO: Gfx Lose context */
|
/* TODO: Gfx Lose context */
|
||||||
JavaCallVoid(env, "processedSurfaceDestroyed", "()V", NULL);
|
JavaCallVoid(env, "processedSurfaceDestroyed", "()V", NULL);
|
||||||
@ -3567,6 +3565,12 @@ static void GLContext_InitSurface(void) {
|
|||||||
eglMakeCurrent(ctx_display, ctx_surface, ctx_surface, ctx_context);
|
eglMakeCurrent(ctx_display, ctx_surface, ctx_surface, ctx_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GLContext_FreeSurface(void) {
|
||||||
|
eglMakeCurrent(ctx_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
eglDestroySurface(ctx_display, ctx_surface);
|
||||||
|
ctx_surface = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void GLContext_Init(struct GraphicsMode* mode) {
|
void GLContext_Init(struct GraphicsMode* mode) {
|
||||||
static EGLint contextAttribs[3] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
|
static EGLint contextAttribs[3] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
|
||||||
static EGLint attribs[19] = {
|
static EGLint attribs[19] = {
|
||||||
@ -3593,9 +3597,7 @@ void GLContext_Init(struct GraphicsMode* mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GLContext_Update(void) {
|
void GLContext_Update(void) {
|
||||||
eglMakeCurrent(ctx_display, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx_context);
|
GLContext_FreeSurface();
|
||||||
eglDestroySurface(ctx_display, ctx_surface);
|
|
||||||
ctx_surface = NULL;
|
|
||||||
GLContext_InitSurface();
|
GLContext_InitSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3605,9 +3607,8 @@ bool GLContext_TryRestore(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GLContext_Free(void) {
|
void GLContext_Free(void) {
|
||||||
eglMakeCurrent(ctx_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
GLContext_FreeSurface();
|
||||||
eglDestroyContext(ctx_display, ctx_context);
|
eglDestroyContext(ctx_display, ctx_context);
|
||||||
eglDestroySurface(ctx_display, ctx_surface);
|
|
||||||
eglTerminate(ctx_display);
|
eglTerminate(ctx_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user