From 576a7cda0d88d77b8bfd7a4e1127bf06b36edd78 Mon Sep 17 00:00:00 2001 From: Manuel Alfayate Corchete Date: Sat, 1 Feb 2020 20:27:47 +0100 Subject: [PATCH] Fix SDL2 with GLES2 compilation (#235) --- src/gapi/gl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gapi/gl.h b/src/gapi/gl.h index 0581f4e..33c3b7a 100644 --- a/src/gapi/gl.h +++ b/src/gapi/gl.h @@ -66,7 +66,6 @@ #include #if defined(_GAPI_GLES) - #define GL_GLEXT_PROTOTYPES 1 #include #include @@ -94,6 +93,8 @@ #define GL_TEXTURE_WRAP_R 0 #define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES #define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES + //We need this on GLES2, too. + #define GL_TEXTURE_MAX_LEVEL GL_TEXTURE_MAX_LEVEL_APPLE #define glTexImage3D(...) 0 #ifndef GL_TEXTURE_3D // WUUUUUT!? @@ -108,7 +109,6 @@ #define glGetProgramBinary(...) #define glProgramBinary(...) #else - #define GL_GLEXT_PROTOTYPES 1 #include #include #endif @@ -1483,7 +1483,9 @@ namespace GAPI { if (count) { #ifdef _OS_ANDROID glInvalidateFramebuffer(GL_FRAMEBUFFER, count, discard); - #else + #elif !defined(__SDL2__) + /* SDL2 typically uses MESA which does not have glDiscardFramebufferEXT() implemented + for some drivers, like Gallium VC4. */ glDiscardFramebufferEXT(GL_FRAMEBUFFER, count, discard); #endif }