From 8c215d5236b730b87168ff735e47a2d61f88976c Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 18 Apr 2011 16:09:41 +0000 Subject: [PATCH] added RENDERPATH_GLES1 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11066 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_backend.c | 63 ++++++++++++++++++++-- gl_draw.c | 7 ++- gl_rmain.c | 147 +++++++++++++++++++++++++++----------------------- gl_textures.c | 13 +++++ model_brush.c | 1 + r_shadow.c | 29 ++++++---- vid.h | 1 + vid_glx.c | 1 + vid_sdl.c | 1 + vid_shared.c | 3 +- vid_wgl.c | 1 + 11 files changed, 185 insertions(+), 82 deletions(-) diff --git a/gl_backend.c b/gl_backend.c index bb1d6b16..dc46cc71 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -275,6 +275,7 @@ static void R_Mesh_SetUseVBO(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: gl_state.usevbo_staticvertex = (vid.support.arb_vertex_buffer_object && gl_vbo.integer) || vid.forcevbo; gl_state.usevbo_staticindex = (vid.support.arb_vertex_buffer_object && (gl_vbo.integer == 1 || gl_vbo.integer == 3)) || vid.forcevbo; gl_state.usevbo_dynamicvertex = (vid.support.arb_vertex_buffer_object && gl_vbo_dynamicvertex.integer) || vid.forcevbo; @@ -325,6 +326,7 @@ static void gl_backend_start(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: // fetch current fbo here (default fbo is not 0 on some GLES devices) if (vid.support.ext_framebuffer_object) @@ -357,6 +359,7 @@ static void gl_backend_shutdown(void) case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -402,6 +405,7 @@ static void gl_backend_devicelost(void) case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -429,6 +433,7 @@ static void gl_backend_devicelost(void) case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -461,6 +466,7 @@ static void gl_backend_devicerestored(void) case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -550,6 +556,7 @@ void GL_Finish(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglFinish(); break; @@ -711,6 +718,7 @@ qboolean R_ScissorForBBox(const float *mins, const float *maxs, int *scissor) case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; } @@ -794,6 +802,7 @@ void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -1044,6 +1053,7 @@ void R_Viewport_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatri case RENDERPATH_GL13: case RENDERPATH_GL11: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -1079,6 +1089,7 @@ void R_SetViewport(const r_viewport_t *v) { case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GLES1: CHECKGLERROR qglViewport(v->x, v->y, v->width, v->height);CHECKGLERROR // Load the projection matrix into OpenGL @@ -1155,6 +1166,7 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (!vid.support.ext_framebuffer_object) return 0; @@ -1183,6 +1195,7 @@ void R_Mesh_DestroyFramebufferObject(int fbo) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (fbo) qglDeleteFramebuffersEXT(1, (GLuint*)&fbo); @@ -1239,6 +1252,7 @@ void R_Mesh_ResetRenderTargets(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (gl_state.framebufferobject) { @@ -1282,6 +1296,7 @@ void R_Mesh_SetRenderTargets(int fbo, rtexture_t *depthtexture, rtexture_t *colo case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (gl_state.framebufferobject != fbo) { @@ -1414,8 +1429,9 @@ static void GL_Backend_ResetState(void) case RENDERPATH_D3D11: Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: CHECKGLERROR qglColorMask(1, 1, 1, 1);CHECKGLERROR @@ -1556,6 +1572,7 @@ void GL_ActiveTexture(unsigned int num) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (qglActiveTexture) { @@ -1583,6 +1600,7 @@ void GL_ClientActiveTexture(unsigned int num) { case RENDERPATH_GL11: case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (qglActiveTexture) { CHECKGLERROR @@ -1616,6 +1634,7 @@ void GL_BlendFunc(int blendfunc1, int blendfunc2) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR qglBlendFunc(gl_state.blendfunc1, gl_state.blendfunc2);CHECKGLERROR @@ -1689,6 +1708,7 @@ void GL_DepthMask(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR qglDepthMask(gl_state.depthmask);CHECKGLERROR @@ -1721,6 +1741,7 @@ void GL_DepthTest(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR if (gl_state.depthtest) @@ -1760,6 +1781,7 @@ void GL_DepthFunc(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR qglDepthFunc(gl_state.depthfunc);CHECKGLERROR @@ -1793,6 +1815,7 @@ void GL_DepthRange(float nearfrac, float farfrac) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglDepthRange(gl_state.depthrange[0], gl_state.depthrange[1]); break; @@ -1830,6 +1853,7 @@ void R_SetStencilSeparate(qboolean enable, int writemask, int frontfail, int fro case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR if (enable) @@ -1896,6 +1920,7 @@ void R_SetStencil(qboolean enable, int writemask, int fail, int zfail, int zpass case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR if (enable) @@ -1952,6 +1977,7 @@ void GL_PolygonOffset(float planeoffset, float depthoffset) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglPolygonOffset(gl_state.polygonoffset[0], gl_state.polygonoffset[1]); break; @@ -1990,6 +2016,7 @@ void GL_SetMirrorState(qboolean state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglCullFace(gl_state.cullface);CHECKGLERROR break; @@ -2026,6 +2053,7 @@ void GL_CullFace(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR @@ -2100,6 +2128,7 @@ void GL_AlphaTest(int state) { case RENDERPATH_GL11: case RENDERPATH_GL13: + case RENDERPATH_GLES1: // only fixed function uses alpha test, other paths use pixel kill capability in shaders CHECKGLERROR if (gl_state.alphatest) @@ -2142,6 +2171,7 @@ void GL_ColorMask(int r, int g, int b, int a) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR qglColorMask((GLboolean)r, (GLboolean)g, (GLboolean)b, (GLboolean)a);CHECKGLERROR @@ -2176,6 +2206,7 @@ void GL_Color(float cr, float cg, float cb, float ca) { case RENDERPATH_GL11: case RENDERPATH_GL13: + case RENDERPATH_GLES1: CHECKGLERROR qglColor4f(gl_state.color4f[0], gl_state.color4f[1], gl_state.color4f[2], gl_state.color4f[3]); CHECKGLERROR @@ -2203,6 +2234,7 @@ void GL_Scissor (int x, int y, int width, int height) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR qglScissor(x, y,width,height); @@ -2242,6 +2274,7 @@ void GL_ScissorTest(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR if(gl_state.scissortest) @@ -2284,6 +2317,7 @@ void GL_Clear(int mask, const float *colorvalue, float depthvalue, int stencilva case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR if (mask & GL_COLOR_BUFFER_BIT) @@ -2327,6 +2361,7 @@ void GL_ReadPixelsBGRA(int x, int y, int width, int height, unsigned char *outpi case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR qglReadPixels(x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, outpixels);CHECKGLERROR @@ -2537,6 +2572,7 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtri case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: // check if the user specified to ignore static index buffers if (!gl_state.usevbo_staticindex || (gl_vbo.integer == 3 && !vid.forcevbo && (element3i_bufferoffset || element3s_bufferoffset))) @@ -2879,6 +2915,7 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtri case RENDERPATH_SOFT: DPSOFTRAST_DrawTriangles(firstvertex, numvertices, numtriangles, element3i, element3s); break; + case RENDERPATH_GLES1: case RENDERPATH_GLES2: // GLES does not have glDrawRangeElements, and generally // underperforms with index buffers, so this code path is @@ -2974,6 +3011,7 @@ void R_Mesh_UpdateMeshBuffer(r_meshbuffer_t *buffer, const void *data, size_t si case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (!buffer->bufferobject) qglGenBuffersARB(1, (GLuint *)&buffer->bufferobject); @@ -3055,6 +3093,7 @@ void R_Mesh_DestroyMeshBuffer(r_meshbuffer_t *buffer) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglDeleteBuffersARB(1, (GLuint *)&buffer->bufferobject); break; @@ -3110,6 +3149,7 @@ void R_Mesh_VertexPointer(int components, int gltype, size_t stride, const void { case RENDERPATH_GL11: case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (gl_state.pointer_vertex_components != components || gl_state.pointer_vertex_gltype != gltype || gl_state.pointer_vertex_stride != stride || gl_state.pointer_vertex_pointer != pointer || gl_state.pointer_vertex_vertexbuffer != vertexbuffer || gl_state.pointer_vertex_offset != bufferoffset) { int bufferobject = vertexbuffer ? vertexbuffer->bufferobject : 0; @@ -3156,6 +3196,7 @@ void R_Mesh_ColorPointer(int components, int gltype, size_t stride, const void * { case RENDERPATH_GL11: case RENDERPATH_GL13: + case RENDERPATH_GLES1: CHECKGLERROR if (pointer) { @@ -3250,6 +3291,7 @@ void R_Mesh_TexCoordPointer(unsigned int unitnum, int components, int gltype, si { case RENDERPATH_GL11: case RENDERPATH_GL13: + case RENDERPATH_GLES1: CHECKGLERROR if (pointer) { @@ -3350,6 +3392,7 @@ void R_Mesh_CopyToTexture(rtexture_t *tex, int tx, int ty, int sx, int sy, int w case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: R_Mesh_TexBind(0, tex); GL_ActiveTexture(0);CHECKGLERROR @@ -3443,8 +3486,9 @@ void R_Mesh_TexBind(unsigned int unitnum, rtexture_t *tex) case GL_TEXTURE_CUBE_MAP_ARB: if (unit->tcubemap != texnum) {GL_ActiveTexture(unitnum);unit->tcubemap = texnum;qglBindTexture(GL_TEXTURE_CUBE_MAP_ARB, unit->tcubemap);CHECKGLERROR}break; } break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: unit->texture = tex; tex2d = 0; tex3d = 0; @@ -3591,6 +3635,7 @@ void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (matrix && matrix->m[3][3]) { @@ -3643,6 +3688,7 @@ void R_Mesh_TexCombine(unsigned int unitnum, int combinergb, int combinealpha, i // do nothing break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: // GL_ARB_texture_env_combine if (!combinergb) combinergb = GL_MODULATE; @@ -3737,8 +3783,9 @@ void R_Mesh_ResetTextureState(void) case RENDERPATH_D3D11: case RENDERPATH_SOFT: break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: for (unitnum = 0;unitnum < vid.texunits;unitnum++) { R_Mesh_TexCombine(unitnum, GL_MODULATE, GL_MODULATE, 1, 1); @@ -3797,6 +3844,7 @@ static void R_Mesh_InitVertexDeclarations(void) case RENDERPATH_GL20: case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -3870,6 +3918,7 @@ void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, con } break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (vertexbuffer) { R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, vertexbuffer, 0); @@ -3973,8 +4022,9 @@ void R_Mesh_PrepareVertices_Generic_Arrays(int numvertices, const float *vertex3 return; } break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (!vid.useinterleavedarrays) { R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, NULL, 0); @@ -4062,6 +4112,7 @@ void R_Mesh_PrepareVertices_Generic(int numvertices, const r_vertexgeneric_t *ve } break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (vertexbuffer) { R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex)); @@ -4165,8 +4216,9 @@ void R_Mesh_PrepareVertices_Mesh_Arrays(int numvertices, const float *vertex3f, return; } break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (!vid.useinterleavedarrays) { R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, NULL, 0); @@ -4265,6 +4317,7 @@ void R_Mesh_PrepareVertices_Mesh(int numvertices, const r_vertexmesh_t *vertex, } break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (vertexbuffer) { R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex)); diff --git a/gl_draw.c b/gl_draw.c index 5e76d3d6..9850142f 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -1940,6 +1940,7 @@ void DrawQ_LineLoop (drawqueuemesh_t *mesh, int flags) case RENDERPATH_SOFT: //Con_DPrintf("FIXME SOFT %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); break; + case RENDERPATH_GLES1: case RENDERPATH_GLES2: //Con_DPrintf("FIXME GLES2 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); return; @@ -1984,6 +1985,7 @@ void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, f case RENDERPATH_SOFT: //Con_DPrintf("FIXME SOFT %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); break; + case RENDERPATH_GLES1: case RENDERPATH_GLES2: //Con_DPrintf("FIXME GLES2 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); return; @@ -2031,6 +2033,7 @@ void DrawQ_Lines (float width, int numlines, const float *vertex3f, const float case RENDERPATH_SOFT: //Con_DPrintf("FIXME SOFT %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); break; + case RENDERPATH_GLES1: case RENDERPATH_GLES2: //Con_DPrintf("FIXME GLES2 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); return; @@ -2053,6 +2056,7 @@ void DrawQ_SetClipArea(float x, float y, float width, float height) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: case RENDERPATH_SOFT: GL_Scissor(ix, vid.height - iy - ih, iw, ih); @@ -2102,11 +2106,12 @@ void R_DrawGamma(void) if (vid_usinghwgamma || v_glslgamma.integer) return; break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: if (vid_usinghwgamma) return; break; + case RENDERPATH_GLES1: case RENDERPATH_SOFT: return; } diff --git a/gl_rmain.c b/gl_rmain.c index e566d1e9..bd81b6ef 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1853,8 +1853,9 @@ void R_GLSL_Restart_f(void) memset(r_glsl_permutationhash, 0, sizeof(r_glsl_permutationhash)); } break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: break; case RENDERPATH_SOFT: break; @@ -1927,6 +1928,7 @@ void R_SetupShader_Generic(rtexture_t *first, rtexture_t *second, int texturemod R_Mesh_TexBind(r_glsl_permutation->tex_Texture_Second, second); break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: R_Mesh_TexBind(0, first ); R_Mesh_TexCombine(0, GL_MODULATE, GL_MODULATE, 1, 1); R_Mesh_TexBind(1, second); @@ -1964,6 +1966,7 @@ void R_SetupShader_DepthOrShadow(void) R_SetupShader_SetPermutationGLSL(SHADERMODE_DEPTH_OR_SHADOW, 0); break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: R_Mesh_TexBind(0, 0); R_Mesh_TexBind(1, 0); break; @@ -1996,6 +1999,7 @@ void R_SetupShader_ShowDepth(void) R_SetupShader_SetPermutationGLSL(SHADERMODE_SHOWDEPTH, 0); break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: break; case RENDERPATH_GL11: break; @@ -2736,8 +2740,9 @@ void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting, if (r_glsl_permutation->tex_Texture_BounceGrid >= 0) R_Mesh_TexBind(r_glsl_permutation->tex_Texture_BounceGrid, r_shadow_bouncegridtexture); CHECKGLERROR break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: break; case RENDERPATH_SOFT: RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_VECTOR | (rsurface.modellightmapcolor4f ? BATCHNEED_ARRAY_VERTEXCOLOR : 0) | BATCHNEED_ARRAY_TEXCOORD | (rsurface.uselightmaptexture ? BATCHNEED_ARRAY_LIGHTMAP : 0), texturenumsurfaces, texturesurfacelist); @@ -2971,8 +2976,9 @@ void R_SetupShader_DeferredLight(const rtlight_t *rtlight) if (r_glsl_permutation->tex_Texture_ShadowMap2D >= 0) R_Mesh_TexBind(r_glsl_permutation->tex_Texture_ShadowMap2D , r_shadow_shadowmap2dtexture ); if (r_glsl_permutation->tex_Texture_CubeProjection >= 0) R_Mesh_TexBind(r_glsl_permutation->tex_Texture_CubeProjection , r_shadow_shadowmapvsdcttexture ); break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: break; case RENDERPATH_SOFT: R_SetupShader_SetPermutationGLSL(mode, permutation); @@ -3846,6 +3852,7 @@ void gl_main_start(void) r_loadfog = false; break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: Cvar_SetValueQuick(&r_textureunits, vid.texunits); Cvar_SetValueQuick(&gl_combine, 1); Cvar_SetValueQuick(&r_glsl, 0); @@ -3922,6 +3929,7 @@ void gl_main_shutdown(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (r_maxqueries) qglDeleteQueriesARB(r_maxqueries, r_queries); @@ -4570,8 +4578,9 @@ void R_AnimCache_CacheVisibleEntities(void) case RENDERPATH_D3D11: case RENDERPATH_GLES2: break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: wanttangents = false; break; case RENDERPATH_SOFT: @@ -4934,6 +4943,7 @@ static void R_View_SetFrustum(const int *scissor) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: // non-flipped y coordinates fny = -1.0 + 2.0 * (scissor[1] - r_refdef.view.viewport.y) / (double) (r_refdef.view.viewport.height); @@ -5211,8 +5221,9 @@ void R_EntityMatrix(const matrix4x4_t *matrix) case RENDERPATH_D3D11: Con_DPrintf("FIXME D3D11 shader %s:%i\n", __FILE__, __LINE__); break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: qglLoadMatrixf(gl_modelview16f);CHECKGLERROR break; case RENDERPATH_SOFT: @@ -5255,6 +5266,7 @@ void R_ResetViewRendering2D(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglEnable(GL_POLYGON_OFFSET_FILL);CHECKGLERROR break; @@ -5290,6 +5302,7 @@ void R_ResetViewRendering3D(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglEnable(GL_POLYGON_OFFSET_FILL);CHECKGLERROR break; @@ -5339,8 +5352,9 @@ static void R_Water_StartFrame(void) case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: return; } @@ -5727,8 +5741,9 @@ void R_Bloom_StartFrame(void) case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: return; } @@ -5780,12 +5795,13 @@ void R_Bloom_StartFrame(void) if (r_viewfbo.integer == 3) textype = TEXTYPE_COLORBUFFER32F; } break; + case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: case RENDERPATH_SOFT: - case RENDERPATH_GL13: - case RENDERPATH_GL11: break; } @@ -5877,6 +5893,7 @@ void R_Bloom_StartFrame(void) case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -5923,8 +5940,9 @@ void R_Bloom_CopyBloomTexture(float colorscale) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: + case RENDERPATH_SOFT: R_Mesh_PrepareVertices_Generic_Arrays(4, r_screenvertex3f, NULL, r_bloomstate.screentexcoord2f); break; case RENDERPATH_D3D9: @@ -6156,8 +6174,9 @@ static void R_BlendView(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: + case RENDERPATH_SOFT: R_Mesh_PrepareVertices_Generic_Arrays(4, r_screenvertex3f, NULL, r_bloomstate.screentexcoord2f); break; case RENDERPATH_D3D9: @@ -6284,8 +6303,9 @@ static void R_BlendView(void) R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0); r_refdef.stats.bloom_drawpixels += r_refdef.view.width * r_refdef.view.height; break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (r_refdef.viewblend[3] >= (1.0f / 256.0f)) { // apply a color tint to the whole view @@ -6467,8 +6487,9 @@ void R_UpdateVariables(void) // remove GLSL gamma texture } break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: break; } } @@ -9891,6 +9912,7 @@ static void R_DrawWorldTextureSurfaceList(int texturenumsurfaces, const msurface R_DrawTextureSurfaceList_GL20(texturenumsurfaces, texturesurfacelist, writedepth, prepass); break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: R_DrawTextureSurfaceList_GL13(texturenumsurfaces, texturesurfacelist, writedepth); break; case RENDERPATH_GL11: @@ -9920,6 +9942,7 @@ static void R_DrawModelTextureSurfaceList(int texturenumsurfaces, const msurface R_DrawTextureSurfaceList_GL20(texturenumsurfaces, texturesurfacelist, writedepth, prepass); break; case RENDERPATH_GL13: + case RENDERPATH_GLES1: R_DrawTextureSurfaceList_GL13(texturenumsurfaces, texturesurfacelist, writedepth); break; case RENDERPATH_GL11: @@ -9957,8 +9980,9 @@ static void R_DrawSurface_TransparentCallback(const entity_render_t *ent, const case RENDERPATH_GLES2: RSurf_ActiveModelEntity(ent, true, true, false); break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: RSurf_ActiveModelEntity(ent, true, false, false); break; } @@ -11023,29 +11047,6 @@ void R_DrawDebugModel(void) rsurface.texture = NULL; } - switch(vid.renderpath) - { - case RENDERPATH_GL11: - case RENDERPATH_GL13: - case RENDERPATH_GL20: - break; - case RENDERPATH_D3D9: - //Con_DPrintf("FIXME D3D9 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - return; - case RENDERPATH_D3D10: - Con_DPrintf("FIXME D3D10 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - return; - case RENDERPATH_D3D11: - Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - return; - case RENDERPATH_SOFT: - //Con_DPrintf("FIXME SOFT %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - return; - case RENDERPATH_GLES2: - //Con_DPrintf("FIXME GLES2 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); - return; - } - flagsmask = MATERIALFLAG_SKY | MATERIALFLAG_WALL; // R_Mesh_ResetTextureState(); @@ -11105,7 +11106,7 @@ void R_DrawDebugModel(void) GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset); - if (r_showtris.integer || (r_shownormals.value != 0)) + if (r_showtris.integer && qglPolygonMode) { if (r_showdisabledepthtest.integer) { @@ -11117,6 +11118,7 @@ void R_DrawDebugModel(void) GL_BlendFunc(GL_ONE, GL_ZERO); GL_DepthMask(true); } + qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);CHECKGLERROR for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++) { if (ent == r_refdef.scene.worldentity && !r_refdef.viewcache.world_surfacevisible[j]) @@ -11125,23 +11127,43 @@ void R_DrawDebugModel(void) if ((rsurface.texture->currentmaterialflags & flagsmask) && surface->num_triangles) { RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_VECTOR | BATCHNEED_NOGAPS, 1, &surface); - if (r_showtris.value > 0) - { - if (!rsurface.texture->currentlayers->depthmask) - GL_Color(r_refdef.view.colorscale, 0, 0, r_showtris.value); - else if (ent == r_refdef.scene.worldentity) - GL_Color(r_refdef.view.colorscale, r_refdef.view.colorscale, r_refdef.view.colorscale, r_showtris.value); - else - GL_Color(0, r_refdef.view.colorscale, 0, r_showtris.value); - R_Mesh_PrepareVertices_Generic_Arrays(rsurface.batchnumvertices, rsurface.batchvertex3f, NULL, NULL); - qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - RSurf_DrawBatch(); - qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - CHECKGLERROR - } + if (!rsurface.texture->currentlayers->depthmask) + GL_Color(r_refdef.view.colorscale, 0, 0, r_showtris.value); + else if (ent == r_refdef.scene.worldentity) + GL_Color(r_refdef.view.colorscale, r_refdef.view.colorscale, r_refdef.view.colorscale, r_showtris.value); + else + GL_Color(0, r_refdef.view.colorscale, 0, r_showtris.value); + R_Mesh_PrepareVertices_Generic_Arrays(rsurface.batchnumvertices, rsurface.batchvertex3f, NULL, NULL); + RSurf_DrawBatch(); + } + } + qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);CHECKGLERROR + rsurface.texture = NULL; + } + + if (r_shownormals.value != 0 && qglBegin) + { + if (r_showdisabledepthtest.integer) + { + GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + GL_DepthMask(false); + } + else + { + GL_BlendFunc(GL_ONE, GL_ZERO); + GL_DepthMask(true); + } + for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++) + { + if (ent == r_refdef.scene.worldentity && !r_refdef.viewcache.world_surfacevisible[j]) + continue; + rsurface.texture = R_GetCurrentTexture(surface->texture); + if ((rsurface.texture->currentmaterialflags & flagsmask) && surface->num_triangles) + { + RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_VECTOR | BATCHNEED_NOGAPS, 1, &surface); + qglBegin(GL_LINES); if (r_shownormals.value < 0) { - qglBegin(GL_LINES); for (k = 0, l = rsurface.batchfirstvertex;k < rsurface.batchnumvertices;k++, l++) { VectorCopy(rsurface.batchvertex3f + l * 3, v); @@ -11151,12 +11173,9 @@ void R_DrawDebugModel(void) GL_Color(r_refdef.view.colorscale, r_refdef.view.colorscale, r_refdef.view.colorscale, 1); qglVertex3f(v[0], v[1], v[2]); } - qglEnd(); - CHECKGLERROR } if (r_shownormals.value > 0 && rsurface.batchsvector3f) { - qglBegin(GL_LINES); for (k = 0, l = rsurface.batchfirstvertex;k < rsurface.batchnumvertices;k++, l++) { VectorCopy(rsurface.batchvertex3f + l * 3, v); @@ -11166,9 +11185,6 @@ void R_DrawDebugModel(void) GL_Color(r_refdef.view.colorscale, r_refdef.view.colorscale, r_refdef.view.colorscale, 1); qglVertex3f(v[0], v[1], v[2]); } - qglEnd(); - CHECKGLERROR - qglBegin(GL_LINES); for (k = 0, l = rsurface.batchfirstvertex;k < rsurface.batchnumvertices;k++, l++) { VectorCopy(rsurface.batchvertex3f + l * 3, v); @@ -11178,9 +11194,6 @@ void R_DrawDebugModel(void) GL_Color(r_refdef.view.colorscale, r_refdef.view.colorscale, r_refdef.view.colorscale, 1); qglVertex3f(v[0], v[1], v[2]); } - qglEnd(); - CHECKGLERROR - qglBegin(GL_LINES); for (k = 0, l = rsurface.batchfirstvertex;k < rsurface.batchnumvertices;k++, l++) { VectorCopy(rsurface.batchvertex3f + l * 3, v); @@ -11190,9 +11203,9 @@ void R_DrawDebugModel(void) GL_Color(r_refdef.view.colorscale, r_refdef.view.colorscale, r_refdef.view.colorscale, 1); qglVertex3f(v[0], v[1], v[2]); } - qglEnd(); - CHECKGLERROR } + qglEnd(); + CHECKGLERROR } } rsurface.texture = NULL; @@ -11336,8 +11349,9 @@ void R_DrawModelSurfaces(entity_render_t *ent, qboolean skysurfaces, qboolean wr case RENDERPATH_GLES2: RSurf_ActiveModelEntity(ent, model->wantnormals, model->wanttangents, false); break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: RSurf_ActiveModelEntity(ent, model->wantnormals, false, false); break; } @@ -11354,8 +11368,9 @@ void R_DrawModelSurfaces(entity_render_t *ent, qboolean skysurfaces, qboolean wr case RENDERPATH_GLES2: RSurf_ActiveModelEntity(ent, true, true, false); break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: RSurf_ActiveModelEntity(ent, true, false, false); break; } diff --git a/gl_textures.c b/gl_textures.c index f86ddc44..976128e5 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -316,6 +316,7 @@ void R_FreeTexture(rtexture_t *rt) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (glt->texnum) { @@ -469,6 +470,7 @@ static void GL_TextureMode_f (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: // change all the existing mipmap texture objects // FIXME: force renderer(/client/something?) restart instead? @@ -597,6 +599,7 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int miplevel, i case RENDERPATH_D3D10: case RENDERPATH_D3D11: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -714,6 +717,7 @@ static void r_textures_start(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: // LordHavoc: allow any alignment CHECKGLERROR @@ -781,6 +785,7 @@ static void r_textures_devicelost(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -823,6 +828,7 @@ static void r_textures_devicerestored(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -933,6 +939,7 @@ void R_Textures_Frame (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR GL_ActiveTexture(0); @@ -1088,6 +1095,7 @@ static void R_UploadPartialTexture(gltexture_t *glt, const unsigned char *data, case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: { int oldbindtexnum; @@ -1201,6 +1209,7 @@ static void R_UploadFullTexture(gltexture_t *glt, const unsigned char *data) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR @@ -1670,6 +1679,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR qglGenTextures(1, (GLuint *)&glt->texnum);CHECKGLERROR @@ -2306,6 +2316,7 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR GL_ActiveTexture(0); @@ -2358,6 +2369,7 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (bytesperblock) { @@ -2414,6 +2426,7 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (dds_miplevels >= 1 && !mipcomplete) { diff --git a/model_brush.c b/model_brush.c index 2bb27183..7f7a2e14 100644 --- a/model_brush.c +++ b/model_brush.c @@ -5836,6 +5836,7 @@ static void Mod_Q3BSP_LightPoint(dp_model_t *model, const vec3_t p, vec3_t ambie break; case RENDERPATH_GL11: case RENDERPATH_GL13: + case RENDERPATH_GLES1: stylescale = r_refdef.scene.rtlightstylevalue[0]; break; } diff --git a/r_shadow.c b/r_shadow.c index b2a619ac..004b0c40 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -486,10 +486,9 @@ void R_Shadow_SetShadowMode(void) r_shadow_shadowmappcf = 1; r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAP2D; break; - case RENDERPATH_GL13: - break; case RENDERPATH_GL11: - break; + case RENDERPATH_GL13: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; } @@ -1988,8 +1987,9 @@ void R_Shadow_RenderMode_Begin(void) case RENDERPATH_GLES2: r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_GLSL; break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: if (r_textureunits.integer >= 2 && vid.texunits >= 2 && r_shadow_texture3d.integer && r_shadow_attenuation3dtexture) r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_VERTEX3DATTEN; else if (r_textureunits.integer >= 3 && vid.texunits >= 3) @@ -2184,6 +2184,7 @@ init_done: case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: GL_CullFace(r_refdef.view.cullface_back); // OpenGL lets us scissor larger than the viewport, so go ahead and clear all views at once @@ -2390,6 +2391,7 @@ static void R_Shadow_UpdateBounceGridTexture(void) // these renderpaths do not currently have the code to display the bouncegrid, so disable it on them... case RENDERPATH_GL11: case RENDERPATH_GL13: + case RENDERPATH_GLES1: case RENDERPATH_SOFT: case RENDERPATH_D3D9: case RENDERPATH_D3D10: @@ -3358,6 +3360,7 @@ void R_Shadow_RenderLighting(int texturenumsurfaces, const msurface_t **textures case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT); break; @@ -3404,6 +3407,7 @@ void R_Shadow_RenderLighting(int texturenumsurfaces, const msurface_t **textures case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglBlendEquationEXT(GL_FUNC_ADD_EXT); break; @@ -4657,8 +4661,9 @@ void R_Shadow_PrepareLights(void) } } break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: r_shadow_usingdeferredprepass = false; break; } @@ -4985,6 +4990,7 @@ void R_DrawModelShadowMaps(void) case RENDERPATH_GL13: case RENDERPATH_GL20: case RENDERPATH_SOFT: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -5158,9 +5164,10 @@ void R_BeginCoronaQuery(rtlight_t *rtlight, float scale, qboolean usequery) switch(vid.renderpath) { - case RENDERPATH_GL20: - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR // NOTE: GL_DEPTH_TEST must be enabled or ATI won't count samples, so use GL_DepthFunc instead @@ -5206,9 +5213,10 @@ void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale) { switch(vid.renderpath) { - case RENDERPATH_GL20: - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR qglGetQueryObjectivARB(rtlight->corona_queryindex_visiblepixels, GL_QUERY_RESULT_ARB, &visiblepixels); @@ -5253,6 +5261,7 @@ void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT); break; @@ -5282,6 +5291,7 @@ void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: qglBlendEquationEXT(GL_FUNC_ADD_EXT); break; @@ -5330,6 +5340,7 @@ void R_Shadow_DrawCoronas(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: usequery = vid.support.arb_occlusion_query && r_coronas_occlusionquery.integer; if (usequery) diff --git a/vid.h b/vid.h index ff691aac..aca91a1e 100644 --- a/vid.h +++ b/vid.h @@ -37,6 +37,7 @@ typedef enum renderpath_e RENDERPATH_D3D10, RENDERPATH_D3D11, RENDERPATH_SOFT, + RENDERPATH_GLES1, RENDERPATH_GLES2 } renderpath_t; diff --git a/vid_glx.c b/vid_glx.c index 1be956e6..293fdd45 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -922,6 +922,7 @@ void VID_Finish (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (vid_usingvsync != vid_usevsync) { diff --git a/vid_sdl.c b/vid_sdl.c index 17fb8ba1..9b946555 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -2492,6 +2492,7 @@ void VID_Finish (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: CHECKGLERROR if (r_speeds.integer == 2 || gl_finish.integer) diff --git a/vid_shared.c b/vid_shared.c index 81f6feef..06e400d1 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1072,8 +1072,9 @@ void VID_UpdateGamma(qboolean force, int rampsize) if (v_glslgamma.integer) wantgamma = 0; break; - case RENDERPATH_GL13: case RENDERPATH_GL11: + case RENDERPATH_GL13: + case RENDERPATH_GLES1: break; } if(!vid_activewindow) diff --git a/vid_wgl.c b/vid_wgl.c index 37b4a112..960c14c0 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -313,6 +313,7 @@ void VID_Finish (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (vid_usingvsync != vid_usevsync) { -- 2.39.2