Experimental restoration of GLES2 support. It *might* compile.
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 22 Jul 2020 13:58:22 +0000 (13:58 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 22 Jul 2020 13:58:22 +0000 (13:58 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12861 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
gl_backend.c
gl_rmain.c
glquake.h
makefile.inc
vid_sdl.c
vid_shared.c

index bdce682..fd4976b 100644 (file)
@@ -2634,7 +2634,7 @@ void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup)
 
 #ifdef USE_GLES2
        SCR_DrawLoadingScreen_SharedSetup(clear);
-       SCR_DrawLoadingScreen(clear);
+       SCR_DrawLoadingScreen();
 #else
        SCR_DrawLoadingScreen_SharedSetup(clear);
        if (vid.stereobuffer)
index c8ef04a..f5317e0 100644 (file)
@@ -264,11 +264,13 @@ static void gl_backend_start(void)
 
        switch(vid.renderpath)
        {
+#ifndef USE_GLES2
        case RENDERPATH_GL32:
                // GL3.2 Core requires that we have a VAO bound - but using more than one has no performance benefit so this is just placeholder
                qglGenVertexArrays(1, &gl_state.defaultvao);
                qglBindVertexArray(gl_state.defaultvao);
                // fall through
+#endif //USE_GLES2
        case RENDERPATH_GLES2:
                // fetch current fbo here (default fbo is not 0 on some GLES devices)
                CHECKGLERROR
@@ -1102,6 +1104,7 @@ static void GL_Backend_ResetState(void)
        case RENDERPATH_GL32:
        case RENDERPATH_GLES2:
                // set up debug output early
+#ifdef DEBUGGL
                if (vid.support.arb_debug_output)
                {
                        GLuint unused = 0;
@@ -1120,6 +1123,7 @@ static void GL_Backend_ResetState(void)
                                qglDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, &unused, GL_FALSE);
                        qglDebugMessageCallbackARB(GL_DebugOutputCallback, NULL);
                }
+#endif //DEBUGGL
                CHECKGLERROR
                qglColorMask(1, 1, 1, 1);CHECKGLERROR
                qglBlendFunc(gl_state.blendfunc1, gl_state.blendfunc2);CHECKGLERROR
@@ -1496,7 +1500,7 @@ void GL_Clear(int mask, const float *colorvalue, float depthvalue, int stencilva
                if (mask & GL_DEPTH_BUFFER_BIT)
                {
 #ifdef USE_GLES2
-                       qglClearDepthf(depthvalue);CHECKGLERROR
+                       //qglClearDepthf(depthvalue);CHECKGLERROR
 #else
                        qglClearDepth(depthvalue);CHECKGLERROR
 #endif
index e0b60b2..5e97574 100644 (file)
@@ -3097,7 +3097,9 @@ static void gl_main_start(void)
        R_BuildBlankTextures();
        R_BuildNoTexture();
        R_BuildWhiteCube();
+#ifndef USE_GLES2
        R_BuildNormalizationCube();
+#endif //USE_GLES2
        r_texture_fogattenuation = NULL;
        r_texture_fogheighttexture = NULL;
        r_texture_gammaramps = NULL;
index 248f5f9..2c8b1c3 100644 (file)
--- a/glquake.h
+++ b/glquake.h
@@ -8,7 +8,7 @@
 #else
 //#include <SDL_opengl.h>
 //#include <SDL_opengl_glext.h>
-#endif
+#endif //USE_GLES2
 
 // disable data conversion warnings
 
 //#pragma warning(disable : 4100) // LadyHavoc: MSVC++ 2008 x86, unreferenced formal parameter
 //#pragma warning(disable : 4055) // LadyHavoc: MSVC++ 2008 x86, 'type cast' from data pointer   to function pointer
 //#pragma warning(disable : 4054) // LadyHavoc: MSVC++ 2008 x86, 'type cast' from function pointer   to data pointer
-#endif
+#endif //_MSC_VER
 
 
 //====================================================
 
-#define DEBUGGL
+//#define DEBUGGL
 
 #ifdef DEBUGGL
 #ifdef USE_GLES2
 #define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);gl_errornumber = glGetError();if (gl_errornumber) GL_PrintError(gl_errornumber, __FILE__, __LINE__);}}
 #else
 #define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);gl_errornumber = qglGetError ? qglGetError() : 0;if (gl_errornumber) GL_PrintError(gl_errornumber, __FILE__, __LINE__);}}
-#endif
+#endif //USE_GLES2
 extern int gl_errornumber;
 void GL_PrintError(int errornumber, const char *filename, int linenumber);
 #else
 #define CHECKGLERROR
-#endif
+#endif //DEBUGGL
 
 #ifndef USE_GLES2
 // this is defined if the SDL_opengl.h is included
@@ -49,12 +49,12 @@ void GL_PrintError(int errornumber, const char *filename, int linenumber);
 // on Windows this is WINAPI
 #ifndef APIENTRY
 #define APIENTRY
-#endif
+#endif //APIENTRY
 
 // for platforms (wgl) that do not use GLAPIENTRY
 #ifndef GLAPIENTRY
 #define GLAPIENTRY APIENTRY
-#endif
+#endif //GLAPIENTRY
 
 typedef unsigned int GLenum;
 typedef unsigned char GLboolean;
@@ -264,7 +264,6 @@ typedef void (GLAPIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id,
 #define GL_PACK_IMAGE_HEIGHT                   0x806C
 #define GL_UNPACK_SKIP_IMAGES                  0x806D
 #define GL_UNPACK_IMAGE_HEIGHT                 0x806E
-#define GL_TEXTURE_3D                          0x806F
 #define GL_PROXY_TEXTURE_3D                    0x8070
 #define GL_TEXTURE_DEPTH                       0x8071
 #define GL_TEXTURE_WRAP_R                      0x8072
@@ -364,22 +363,6 @@ typedef void (GLAPIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id,
 #define GL_UNSIGNED_NORMALIZED                           0x8C17
 #define GL_FRAMEBUFFER_DEFAULT                           0x8218
 #define GL_INDEX                                         0x8222
-#define GL_COLOR_ATTACHMENT0                0x8CE0
-#define GL_COLOR_ATTACHMENT1                0x8CE1
-#define GL_COLOR_ATTACHMENT2                0x8CE2
-#define GL_COLOR_ATTACHMENT3                0x8CE3
-#define GL_COLOR_ATTACHMENT4                0x8CE4
-#define GL_COLOR_ATTACHMENT5                0x8CE5
-#define GL_COLOR_ATTACHMENT6                0x8CE6
-#define GL_COLOR_ATTACHMENT7                0x8CE7
-#define GL_COLOR_ATTACHMENT8                0x8CE8
-#define GL_COLOR_ATTACHMENT9                0x8CE9
-#define GL_COLOR_ATTACHMENT10               0x8CEA
-#define GL_COLOR_ATTACHMENT11               0x8CEB
-#define GL_COLOR_ATTACHMENT12               0x8CEC
-#define GL_COLOR_ATTACHMENT13               0x8CED
-#define GL_COLOR_ATTACHMENT14               0x8CEE
-#define GL_COLOR_ATTACHMENT15               0x8CEF
 #define GL_DEPTH_ATTACHMENT                 0x8D00
 #define GL_STENCIL_ATTACHMENT               0x8D20
 #define GL_DEPTH_STENCIL_ATTACHMENT         0x821A
@@ -422,20 +405,6 @@ typedef void (GLAPIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id,
 #define GL_DRAW_BUFFER14                                 0x8833
 #define GL_DRAW_BUFFER15                                 0x8834
 
-#define GL_RGBA32F                                       0x8814
-#define GL_RGB32F                                        0x8815
-#define GL_ALPHA32F                                      0x8816
-#define GL_INTENSITY32F                                  0x8817
-#define GL_LUMINANCE32F                                  0x8818
-#define GL_LUMINANCE_ALPHA32F                            0x8819
-#define GL_RGBA16F                                       0x881A
-#define GL_RGB16F                                        0x881B
-#define GL_ALPHA16F                                      0x881C
-#define GL_INTENSITY16F                                  0x881D
-#define GL_LUMINANCE16F                                  0x881E
-#define GL_LUMINANCE_ALPHA16F                            0x881F
-
-#define GL_HALF_FLOAT                                    0x140B
 
 #define GL_SRGB                                          0x8C40
 #define GL_SRGB8                                         0x8C41
@@ -632,8 +601,7 @@ typedef void (GLAPIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id,
 #define GL_DEBUG_SEVERITY_MEDIUM_ARB      0x9147
 #define GL_DEBUG_SEVERITY_LOW_ARB         0x9148
 
-#define GL_NUM_EXTENSIONS                 0x821D
-#endif
+#endif //GL_ZERO
 
 extern GLboolean(GLAPIENTRY *qglIsBuffer) (GLuint buffer);
 extern GLboolean(GLAPIENTRY *qglIsEnabled)(GLenum cap);
@@ -1045,6 +1013,40 @@ extern void (GLAPIENTRY *qglViewport)(GLint x, GLint y, GLsizei width, GLsizei h
 #define qglVertexAttrib4usv glVertexAttrib4usv
 #define qglVertexAttribPointer glVertexAttribPointer
 #define qglViewport glViewport
-#endif
+#endif //USE_GLES2
+
+#endif //DEBUGGL
+#define GL_COLOR_ATTACHMENT0                0x8CE0
+#define GL_COLOR_ATTACHMENT1                0x8CE1
+#define GL_COLOR_ATTACHMENT2                0x8CE2
+#define GL_COLOR_ATTACHMENT3                0x8CE3
+#define GL_COLOR_ATTACHMENT4                0x8CE4
+#define GL_COLOR_ATTACHMENT5                0x8CE5
+#define GL_COLOR_ATTACHMENT6                0x8CE6
+#define GL_COLOR_ATTACHMENT7                0x8CE7
+#define GL_COLOR_ATTACHMENT8                0x8CE8
+#define GL_COLOR_ATTACHMENT9                0x8CE9
+#define GL_COLOR_ATTACHMENT10               0x8CEA
+#define GL_COLOR_ATTACHMENT11               0x8CEB
+#define GL_COLOR_ATTACHMENT12               0x8CEC
+#define GL_COLOR_ATTACHMENT13               0x8CED
+#define GL_COLOR_ATTACHMENT14               0x8CEE
+#define GL_COLOR_ATTACHMENT15               0x8CEF
 
-#endif
+#define GL_RGBA32F                                       0x8814
+#define GL_RGB32F                                        0x8815
+#define GL_ALPHA32F                                      0x8816
+#define GL_INTENSITY32F                                  0x8817
+#define GL_LUMINANCE32F                                  0x8818
+#define GL_LUMINANCE_ALPHA32F                            0x8819
+#define GL_RGBA16F                                       0x881A
+#define GL_RGB16F                                        0x881B
+#define GL_ALPHA16F                                      0x881C
+#define GL_INTENSITY16F                                  0x881D
+#define GL_LUMINANCE16F                                  0x881E
+#define GL_LUMINANCE_ALPHA16F                            0x881F
+
+#define GL_TEXTURE_3D                          0x806F
+
+#define GL_HALF_FLOAT                                    0x140B
+#define GL_NUM_EXTENSIONS                 0x821D
index 251c061..34bdf69 100644 (file)
@@ -239,7 +239,7 @@ LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
 LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lxmp
 CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD
 
-LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS)
+LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) #-lGLESv2
 EXE_UNIXSV=darkplaces-dedicated
 EXE_UNIXSDL=darkplaces-sdl
 EXE_UNIXSVNEXUIZ=nexuiz-dedicated
index 7c13bb9..9b25807 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -1475,8 +1475,8 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode)
        // https://trello.com/c/j56vUcwZ/81-centered-vs-undefined-window-position
        int xPos = SDL_WINDOWPOS_UNDEFINED;
        int yPos = SDL_WINDOWPOS_UNDEFINED;
-#ifndef USE_GLES2
        int i;
+#ifndef USE_GLES2
        const char *drivername;
 #endif
 
index a031fd3..0e523ed 100644 (file)
@@ -655,6 +655,7 @@ qboolean GL_CheckExtension(const char *name, const char *disableparm, int silent
                return false;
        }
 
+#ifndef USE_GLES2
        for (func = openglfuncs; func && func->name != NULL; func++)
        {
                if (!*func->funcvariable && !strcmp(name, func->extension))
@@ -664,6 +665,7 @@ qboolean GL_CheckExtension(const char *name, const char *disableparm, int silent
                        failed = true;
                }
        }
+#endif //USE_GLES2
        // delay the return so it prints all missing functions
        if (failed)
                return false;
@@ -707,6 +709,7 @@ void GL_Setup(void)
        Con_Printf("GL_RENDERER: %s\n", gl_renderer);
        Con_Printf("GL_VERSION: %s\n", gl_version);
 
+#ifndef USE_GLES2
        qglGetIntegerv(GL_NUM_EXTENSIONS, &numextensions);
        Con_DPrint("GL_EXTENSIONS:\n");
        for (j = 0; j < numextensions; j++)
@@ -717,6 +720,7 @@ void GL_Setup(void)
                        Con_DPrintf("\n");
        }
        Con_DPrint("\n");
+#endif //USE_GLES2
 
 #ifndef USE_GLES2
        missingfuncs[0] = 0;