now calls GL_LockArrays manually around each R_Mesh_Draw call instead of locking...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 10 Mar 2004 21:40:02 +0000 (21:40 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 10 Mar 2004 21:40:02 +0000 (21:40 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4005 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c
gl_draw.c
gl_models.c
gl_rsurf.c
r_explosion.c
r_lightning.c
r_shadow.c
r_sky.c
todo

index e598d0f..7b21ec7 100644 (file)
@@ -597,7 +597,7 @@ void GL_LockArrays(int first, int count)
                        qglUnlockArraysEXT();
                        CHECKGLERROR
                }
-               if (count && gl_supportslockarrays && gl_lockarrays.integer)
+               if (count && gl_supportslockarrays && gl_lockarrays.integer && r_render.integer)
                {
                        gl_state.lockrange_first = first;
                        gl_state.lockrange_count = count;
@@ -679,6 +679,7 @@ void R_Mesh_Draw(int numverts, int numtriangles, const int *elements)
                Con_Printf("R_Mesh_Draw(%d, %d, %08p);\n", numverts, numtriangles, elements);
                return;
        }
+       CHECKGLERROR
        if (r_showtrispass)
        {
                R_Mesh_Draw_ShowTris(numverts, numtriangles, elements);
@@ -686,48 +687,46 @@ void R_Mesh_Draw(int numverts, int numtriangles, const int *elements)
        }
        c_meshs++;
        c_meshelements += numelements;
-       CHECKGLERROR
-       if (r_render.integer)
+       if (gl_paranoid.integer)
        {
-               if (gl_paranoid.integer)
+               int i, j, size;
+               const int *p;
+               if (!qglIsEnabled(GL_VERTEX_ARRAY))
+                       Con_Print("R_Mesh_Draw: vertex array not enabled\n");
+               for (j = 0, size = numverts * (int)sizeof(float[3]), p = gl_state.pointer_vertex;j < size;j += sizeof(int), p++)
+                       paranoidblah += *p;
+               if (gl_state.pointer_color)
                {
-                       int i, j, size;
-                       const int *p;
-                       if (!qglIsEnabled(GL_VERTEX_ARRAY))
-                               Con_Print("R_Mesh_Draw: vertex array not enabled\n");
-                       for (j = 0, size = numverts * (int)sizeof(float[3]), p = gl_state.pointer_vertex;j < size;j += sizeof(int), p++)
+                       if (!qglIsEnabled(GL_COLOR_ARRAY))
+                               Con_Print("R_Mesh_Draw: color array set but not enabled\n");
+                       for (j = 0, size = numverts * (int)sizeof(float[4]), p = gl_state.pointer_color;j < size;j += sizeof(int), p++)
                                paranoidblah += *p;
-                       if (gl_state.pointer_color)
+               }
+               for (i = 0;i < backendunits;i++)
+               {
+                       if (gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap || gl_state.units[i].arrayenabled)
                        {
-                               if (!qglIsEnabled(GL_COLOR_ARRAY))
-                                       Con_Print("R_Mesh_Draw: color array set but not enabled\n");
-                               for (j = 0, size = numverts * (int)sizeof(float[4]), p = gl_state.pointer_color;j < size;j += sizeof(int), p++)
+                               if (gl_state.units[i].arrayenabled && !(gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap))
+                                       Con_Print("R_Mesh_Draw: array enabled but no texture bound\n");
+                               GL_ActiveTexture(i);
+                               if (!qglIsEnabled(GL_TEXTURE_COORD_ARRAY))
+                                       Con_Print("R_Mesh_Draw: texcoord array set but not enabled\n");
+                               for (j = 0, size = numverts * ((gl_state.units[i].t3d || gl_state.units[i].tcubemap) ? (int)sizeof(float[3]) : (int)sizeof(float[2])), p = gl_state.units[i].pointer_texcoord;j < size;j += sizeof(int), p++)
                                        paranoidblah += *p;
                        }
-                       for (i = 0;i < backendunits;i++)
-                       {
-                               if (gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap || gl_state.units[i].arrayenabled)
-                               {
-                                       if (gl_state.units[i].arrayenabled && !(gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap))
-                                               Con_Print("R_Mesh_Draw: array enabled but no texture bound\n");
-                                       GL_ActiveTexture(i);
-                                       if (!qglIsEnabled(GL_TEXTURE_COORD_ARRAY))
-                                               Con_Print("R_Mesh_Draw: texcoord array set but not enabled\n");
-                                       for (j = 0, size = numverts * ((gl_state.units[i].t3d || gl_state.units[i].tcubemap) ? (int)sizeof(float[3]) : (int)sizeof(float[2])), p = gl_state.units[i].pointer_texcoord;j < size;j += sizeof(int), p++)
-                                               paranoidblah += *p;
-                               }
-                       }
-                       for (i = 0;i < numtriangles * 3;i++)
+               }
+               for (i = 0;i < numtriangles * 3;i++)
+               {
+                       if (elements[i] < 0 || elements[i] >= numverts)
                        {
-                               if (elements[i] < 0 || elements[i] >= numverts)
-                               {
-                                       Con_Printf("R_Mesh_Draw: invalid vertex index %i (outside range 0 - %i) in elements list\n", elements[i], numverts);
-                                       return;
-                               }
+                               Con_Printf("R_Mesh_Draw: invalid vertex index %i (outside range 0 - %i) in elements list\n", elements[i], numverts);
+                               return;
                        }
                }
                CHECKGLERROR
-               GL_LockArrays(0, numverts);
+       }
+       if (r_render.integer)
+       {
                CHECKGLERROR
                if (gl_mesh_testmanualfeeding.integer)
                {
@@ -799,8 +798,6 @@ void R_Mesh_Draw(int numverts, int numtriangles, const int *elements)
                        qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, elements);CHECKGLERROR
                }
                CHECKGLERROR
-               GL_LockArrays(0, 0);
-               CHECKGLERROR
        }
 }
 
index 13a695f..22bdfc0 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -498,7 +498,9 @@ void R_DrawQueue(void)
                                        batchcount++;
                                        if (batchcount >= 128)
                                        {
+                                               GL_LockArrays(0, batchcount * 4);
                                                R_Mesh_Draw(batchcount * 4, batchcount * 2, quadelements);
+                                               GL_LockArrays(0, 0);
                                                batchcount = 0;
                                                at = varray_texcoord2f[0];
                                                av = varray_vertex3f;
@@ -507,7 +509,11 @@ void R_DrawQueue(void)
                                x += w;
                        }
                        if (batchcount > 0)
+                       {
+                               GL_LockArrays(0, batchcount * 4);
                                R_Mesh_Draw(batchcount * 4, batchcount * 2, quadelements);
+                               GL_LockArrays(0, 0);
+                       }
                        break;
                case DRAWQUEUE_MESH:
                        mesh = (void *)(dq + 1);
@@ -516,7 +522,9 @@ void R_DrawQueue(void)
                        m.tex[0] = R_GetTexture(mesh->texture);
                        m.pointer_texcoord[0] = mesh->data_texcoord2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, mesh->num_vertices);
                        R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+                       GL_LockArrays(0, 0);
                        m.pointer_color = NULL;
                        currentpic = "\0";
                        break;
index 7f18bcc..6670647 100644 (file)
@@ -278,7 +278,9 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                        }
                }
                R_Mesh_State(&m);
+               GL_LockArrays(0, mesh->num_vertices);
                R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+               GL_LockArrays(0, 0);
        }
 }
 
@@ -756,7 +758,9 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
        else
                GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);
        R_Mesh_State(&mstate);
+       GL_LockArrays(0, numverts);
        R_Mesh_Draw(numverts, numtriangles, elements);
+       GL_LockArrays(0, 0);
        c_alias_polys += numtriangles;
 
        if (fog)
@@ -775,7 +779,9 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
                GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha * fog);
                ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->alias.zymdata_vertbonecounts, ent->model->alias.zymdata_verts);
                R_Mesh_State(&mstate);
+               GL_LockArrays(0, numverts);
                R_Mesh_Draw(numverts, numtriangles, elements);
+               GL_LockArrays(0, 0);
                c_alias_polys += numtriangles;
        }
 }
index 976f7e4..77673e3 100644 (file)
@@ -769,7 +769,9 @@ static void RSurfShader_Sky(const entity_render_t *ent, const texture_t *texture
                {
                        m.pointer_vertex = surf->mesh.data_vertex3f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
        GL_ColorMask(1,1,1,1);
@@ -855,7 +857,9 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
        m.pointer_texcoord[1] = surf->mesh.data_texcoordtexture2f;
        m.texcombinergb[1] = GL_REPLACE;
        R_Mesh_State(&m);
+       GL_LockArrays(0, surf->mesh.num_vertices);
        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+       GL_LockArrays(0, 0);
 
        if (gl_textureshader && r_watershader.value && !fogenabled)
        {
@@ -875,7 +879,9 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
                m.pointer_color = varray_color4f;
                R_Mesh_State(&m);
                RSurf_FogPassColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], alpha, 1, surf->mesh.num_vertices, modelorg);
+               GL_LockArrays(0, surf->mesh.num_vertices);
                R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+               GL_LockArrays(0, 0);
        }
 
        if ((gl_textureshader && r_watershader.value && !fogenabled) || r_waterscroll.value)
@@ -953,7 +959,9 @@ static void RSurfShader_Wall_Pass_BaseVertex(const entity_render_t *ent, const m
                        RSurf_AddLightmapToVertexColors_Color4f(surf->mesh.data_lightmapoffsets, varray_color4f,surf->mesh.num_vertices, surf->samples, ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3, surf->styles);
        }
        RSurf_FogColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, colorscale, surf->mesh.num_vertices, modelorg);
+       GL_LockArrays(0, surf->mesh.num_vertices);
        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurface_t *surf, const texture_t *texture, int rendertype, float currentalpha)
@@ -973,7 +981,9 @@ static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurfac
                m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
        R_Mesh_State(&m);
        RSurf_FoggedColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, 1, 1, 1, currentalpha, 1, surf->mesh.num_vertices, modelorg);
+       GL_LockArrays(0, surf->mesh.num_vertices);
        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface_t *surf, const texture_t *texture, int rendertype, float currentalpha)
@@ -993,7 +1003,9 @@ static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface
                m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
        R_Mesh_State(&m);
        RSurf_FogPassColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], currentalpha, 1, surf->mesh.num_vertices, modelorg);
+       GL_LockArrays(0, surf->mesh.num_vertices);
        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetailGlow(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
@@ -1032,7 +1044,9 @@ static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetailGlow(co
                        m.pointer_texcoord[2] = surf->mesh.data_texcoorddetail2f;
                        m.pointer_texcoord[3] = surf->mesh.data_texcoordtexture2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1067,7 +1081,9 @@ static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetail(const
                        m.pointer_texcoord[1] = surf->mesh.data_texcoordlightmap2f;
                        m.pointer_texcoord[2] = surf->mesh.data_texcoorddetail2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1098,7 +1114,9 @@ static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmap(const entity
                        m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
                        m.pointer_texcoord[1] = surf->mesh.data_texcoordlightmap2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1123,7 +1141,9 @@ static void RSurfShader_OpaqueWall_Pass_BaseTexture(const entity_render_t *ent,
                        m.pointer_vertex = surf->mesh.data_vertex3f;
                        m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1148,7 +1168,9 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmap(const entity_render_t *ent,
                        m.pointer_vertex = surf->mesh.data_vertex3f;
                        m.pointer_texcoord[0] = surf->mesh.data_texcoordlightmap2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1173,7 +1195,9 @@ static void RSurfShader_OpaqueWall_Pass_Fog(const entity_render_t *ent, const te
                                m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
                        R_Mesh_State(&m);
                        RSurf_FogPassColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], 1, 1, surf->mesh.num_vertices, modelorg);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1195,7 +1219,9 @@ static void RSurfShader_OpaqueWall_Pass_BaseDetail(const entity_render_t *ent, c
                        m.pointer_vertex = surf->mesh.data_vertex3f;
                        m.pointer_texcoord[0] = surf->mesh.data_texcoorddetail2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1217,7 +1243,9 @@ static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const t
                        m.pointer_vertex = surf->mesh.data_vertex3f;
                        m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1242,7 +1270,9 @@ static void RSurfShader_OpaqueWall_Pass_OpaqueGlow(const entity_render_t *ent, c
                        m.pointer_vertex = surf->mesh.data_vertex3f;
                        m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1271,7 +1301,9 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmapOnly(const entity_render_t *
                        m.pointer_vertex = surf->mesh.data_vertex3f;
                        m.pointer_texcoord[0] = surf->mesh.data_texcoordlightmap2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, surf->mesh.num_vertices);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+                       GL_LockArrays(0, 0);
                }
        }
 }
@@ -1538,7 +1570,9 @@ static void R_DrawPortal_Callback(const void *calldata1, int calldata2)
        else
                for (i = 0, v = varray_vertex3f;i < portal->numpoints;i++, v += 3)
                        VectorCopy(portal->points[i].position, v);
+       GL_LockArrays(0, portal->numpoints);
        R_Mesh_Draw(portal->numpoints, portal->numpoints - 2, polygonelements);
+       GL_LockArrays(0, 0);
 }
 
 // LordHavoc: this is just a nice debugging tool, very slow
@@ -2016,7 +2050,9 @@ void R_DrawCollisionBrush(colbrushf_t *brush)
        R_Mesh_State(&m);
        i = ((int)brush) / sizeof(colbrushf_t);
        GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
+       GL_LockArrays(0, brush->numpoints);
        R_Mesh_Draw(brush->numpoints, brush->numtriangles, brush->elements);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawCollisionFace(entity_render_t *ent, q3mface_t *face)
@@ -2030,7 +2066,9 @@ void R_Q3BSP_DrawCollisionFace(entity_render_t *ent, q3mface_t *face)
        R_Mesh_State(&m);
        i = ((int)face) / sizeof(q3mface_t);
        GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
+       GL_LockArrays(0, face->num_collisionvertices);
        R_Mesh_Draw(face->num_collisionvertices, face->num_collisiontriangles, face->data_collisionelement3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawSkyFace(entity_render_t *ent, q3mface_t *face)
@@ -2069,7 +2107,9 @@ void R_Q3BSP_DrawSkyFace(entity_render_t *ent, q3mface_t *face)
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
 
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
        GL_ColorMask(1,1,1,1);
 }
 
@@ -2090,7 +2130,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_OpaqueGlow(entity_render_t *ent, q3mface_t
                GL_Color(0, 0, 0, 1);
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureLightmapCombine(entity_render_t *ent, q3mface_t *face)
@@ -2108,7 +2150,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureLightmapCombine(entity_render_t *en
        GL_Color(1, 1, 1, 1);
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_Texture(entity_render_t *ent, q3mface_t *face)
@@ -2123,7 +2167,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Texture(entity_render_t *ent, q3mface_t *f
        GL_Color(1, 1, 1, 1);
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(entity_render_t *ent, q3mface_t *face)
@@ -2138,7 +2184,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(entity_render_t *ent, q3mface_t *
        GL_Color(1, 1, 1, 1);
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_LightmapOnly(entity_render_t *ent, q3mface_t *face)
@@ -2156,7 +2204,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_LightmapOnly(entity_render_t *ent, q3mface
                GL_Color(1, 1, 1, 1);
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(entity_render_t *ent, q3mface_t *face)
@@ -2176,7 +2226,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(entity_render_t *ent, q3mface_t *face
                GL_Color(0, 0, 0, 1);
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(entity_render_t *ent, q3mface_t *face)
@@ -2213,7 +2265,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(entity_render_t *ent, q3mfac
        }
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_VertexOnly(entity_render_t *ent, q3mface_t *face)
@@ -2243,7 +2297,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_VertexOnly(entity_render_t *ent, q3mface_t
        }
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_AddTextureAmbient(entity_render_t *ent, q3mface_t *face)
@@ -2258,7 +2314,9 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_AddTextureAmbient(entity_render_t *ent, q3
        GL_Color(r_ambient.value * (1.0f / 128.0f), r_ambient.value * (1.0f / 128.0f), r_ambient.value * (1.0f / 128.0f), 1);
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
 }
 
 void R_Q3BSP_DrawFace_TransparentCallback(const void *voident, int facenumber)
@@ -2319,7 +2377,9 @@ void R_Q3BSP_DrawFace_TransparentCallback(const void *voident, int facenumber)
        m.pointer_vertex = face->data_vertex3f;
        R_Mesh_State(&m);
        qglDisable(GL_CULL_FACE);
+       GL_LockArrays(0, face->num_vertices);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+       GL_LockArrays(0, 0);
        qglEnable(GL_CULL_FACE);
 }
 
index 10b65b8..bf336b6 100644 (file)
@@ -197,7 +197,9 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
 
        GL_Color(alpha, alpha, alpha, 1);
 
+       GL_LockArrays(0, numverts);
        R_Mesh_Draw(numverts, numtriangles, explosiontris[0]);
+       GL_LockArrays(0, 0);
 }
 
 void R_MoveExplosion(explosion_t *e)
index 18207a6..e80216e 100644 (file)
@@ -320,7 +320,9 @@ void R_DrawLightningBeamCallback(const void *calldata1, int calldata2)
        R_Mesh_State(&m);
 
        // draw the 3 polygons as one batch of 6 triangles using the 12 vertices
+       GL_LockArrays(0, 12);
        R_Mesh_Draw(12, 6, r_lightningbeamelements);
+       GL_LockArrays(0, 0);
 }
 
 void R_DrawLightningBeams(void)
index 572b756..b469908 100644 (file)
@@ -542,6 +542,7 @@ void R_Shadow_RenderVolume(int numvertices, int numtriangles, const float *verte
        memset(&m, 0, sizeof(m));
        m.pointer_vertex = vertex3f;
        R_Mesh_State(&m);
+       GL_LockArrays(0, numvertices);
        if (r_shadowstage == SHADOWSTAGE_STENCIL)
        {
                // decrement stencil if frontface is behind depthbuffer
@@ -557,6 +558,7 @@ void R_Shadow_RenderVolume(int numvertices, int numtriangles, const float *verte
        R_Mesh_Draw(numvertices, numtriangles, element3i);
        c_rt_shadowmeshes++;
        c_rt_shadowtris += numtriangles;
+       GL_LockArrays(0, 0);
 }
 
 void R_Shadow_RenderShadowMeshVolume(shadowmesh_t *firstmesh)
@@ -568,6 +570,7 @@ void R_Shadow_RenderShadowMeshVolume(shadowmesh_t *firstmesh)
        {
                m.pointer_vertex = mesh->vertex3f;
                R_Mesh_State(&m);
+               GL_LockArrays(0, mesh->numverts);
                if (r_shadowstage == SHADOWSTAGE_STENCIL)
                {
                        // decrement stencil if frontface is behind depthbuffer
@@ -583,6 +586,7 @@ void R_Shadow_RenderShadowMeshVolume(shadowmesh_t *firstmesh)
                R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->element3i);
                c_rtcached_shadowmeshes++;
                c_rtcached_shadowtris += mesh->numtriangles;
+               GL_LockArrays(0, 0);
        }
 }
 
@@ -1210,7 +1214,9 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        GL_BlendFunc(GL_ONE, GL_ZERO);
                        R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
                        R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2], numverts, vertex3f, matrix_modeltoattenuationxyz);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1225,6 +1231,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
                        }
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        GL_ColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
@@ -1238,6 +1245,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
                        }
+                       GL_LockArrays(0, 0);
                }
                else if (r_shadow_texture3d.integer && r_textureunits.integer >= 2 && lightcubemap)
                {
@@ -1250,7 +1258,9 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        GL_ColorMask(0,0,0,1);
                        GL_BlendFunc(GL_ONE, GL_ZERO);
                        R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1265,7 +1275,9 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        R_Mesh_State(&m);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                        R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1280,6 +1292,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
                        }
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        GL_ColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
@@ -1293,6 +1306,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
                        }
+                       GL_LockArrays(0, 0);
                }
                else if (r_shadow_texture3d.integer && r_textureunits.integer >= 2 && !lightcubemap)
                {
@@ -1309,7 +1323,9 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        GL_ColorMask(0,0,0,1);
                        GL_BlendFunc(GL_ONE, GL_ZERO);
                        R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1320,6 +1336,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        m.pointer_texcoord[0] = texcoord2f;
                        m.pointer_texcoord[1] = varray_texcoord3f[1];
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        GL_ColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
@@ -1334,6 +1351,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
                        }
+                       GL_LockArrays(0, 0);
                }
                else if (r_textureunits.integer >= 4)
                {
@@ -1356,7 +1374,9 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
                        R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2], numverts, vertex3f, matrix_modeltoattenuationxyz);
                        R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[3], numverts, vertex3f, matrix_modeltoattenuationz);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1371,6 +1391,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
                        }
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        GL_ColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
@@ -1384,6 +1405,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
                        }
+                       GL_LockArrays(0, 0);
                }
                else
                {
@@ -1399,7 +1421,9 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        GL_BlendFunc(GL_ONE, GL_ZERO);
                        R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
                        R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1414,7 +1438,9 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        R_Mesh_State(&m);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                        R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1429,6 +1455,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
                        }
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        GL_ColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
@@ -1442,6 +1469,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
                        }
+                       GL_LockArrays(0, 0);
                }
        }
        else
@@ -1463,6 +1491,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
                }
                R_Mesh_State(&m);
+               GL_LockArrays(0, numverts);
                for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
                {
                        color[0] = bound(0, color2[0], 1);
@@ -1476,6 +1505,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
                }
+               GL_LockArrays(0, 0);
        }
 }
 
@@ -1511,13 +1541,16 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        // this squares the result
                        GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
                        R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
                        memset(&m, 0, sizeof(m));
                        m.pointer_vertex = vertex3f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        // square alpha in framebuffer a few times to make it shiny
                        GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
                        // these comments are a test run through this math for intensity 0.5
@@ -1530,6 +1563,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        R_Mesh_Draw(numverts, numtriangles, elements);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
+                       GL_LockArrays(0, 0);
 
                        memset(&m, 0, sizeof(m));
                        m.pointer_vertex = vertex3f;
@@ -1538,7 +1572,9 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        R_Mesh_State(&m);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                        R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1553,6 +1589,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        }
                        m.pointer_texcoord[0] = texcoord2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        GL_ColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        VectorScale(lightcolor, colorscale, color2);
@@ -1566,6 +1603,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
                        }
+                       GL_LockArrays(0, 0);
                }
                else if (r_shadow_texture3d.integer && r_textureunits.integer >= 2 && !lightcubemap /*&& gl_support_blendsquare*/) // FIXME: detect blendsquare!
                {
@@ -1582,13 +1620,16 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        // this squares the result
                        GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
                        R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
                        memset(&m, 0, sizeof(m));
                        m.pointer_vertex = vertex3f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        // square alpha in framebuffer a few times to make it shiny
                        GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
                        // these comments are a test run through this math for intensity 0.5
@@ -1601,6 +1642,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        R_Mesh_Draw(numverts, numtriangles, elements);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
+                       GL_LockArrays(0, 0);
 
                        memset(&m, 0, sizeof(m));
                        m.pointer_vertex = vertex3f;
@@ -1609,6 +1651,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        m.pointer_texcoord[0] = texcoord2f;
                        m.pointer_texcoord[1] = varray_texcoord3f[1];
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        GL_ColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
@@ -1623,6 +1666,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
                        }
+                       GL_LockArrays(0, 0);
                }
                else if (r_textureunits.integer >= 2 /*&& gl_support_blendsquare*/) // FIXME: detect blendsquare!
                {
@@ -1639,13 +1683,16 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        // this squares the result
                        GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
                        R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
                        memset(&m, 0, sizeof(m));
                        m.pointer_vertex = vertex3f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        // square alpha in framebuffer a few times to make it shiny
                        GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
                        // these comments are a test run through this math for intensity 0.5
@@ -1658,6 +1705,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        R_Mesh_Draw(numverts, numtriangles, elements);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
+                       GL_LockArrays(0, 0);
 
                        memset(&m, 0, sizeof(m));
                        m.pointer_vertex = vertex3f;
@@ -1669,7 +1717,9 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
                        R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
                        R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+                       GL_LockArrays(0, numverts);
                        R_Mesh_Draw(numverts, numtriangles, elements);
+                       GL_LockArrays(0, 0);
                        c_rt_lightmeshes++;
                        c_rt_lighttris += numtriangles;
 
@@ -1684,6 +1734,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                        }
                        m.pointer_texcoord[0] = texcoord2f;
                        R_Mesh_State(&m);
+                       GL_LockArrays(0, numverts);
                        GL_ColorMask(1,1,1,0);
                        GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
                        VectorScale(lightcolor, colorscale, color2);
@@ -1697,6 +1748,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                                c_rt_lightmeshes++;
                                c_rt_lighttris += numtriangles;
                        }
+                       GL_LockArrays(0, 0);
                }
        }
 }
diff --git a/r_sky.c b/r_sky.c
index 110407c..bb3f8dd 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -238,12 +238,14 @@ static void R_SkyBox(void)
        GL_DepthTest(false); // don't modify or read zbuffer
        m.pointer_vertex = skyboxvertex3f;
        m.pointer_texcoord[0] = skyboxtexcoord2f;
+       GL_LockArrays(0, 6*4);
        for (i = 0;i < 6;i++)
        {
                m.tex[0] = R_GetTexture(skyboxside[i]);
                R_Mesh_State(&m);
                R_Mesh_Draw(6*4, 2, skyboxelements + i * 6);
        }
+       GL_LockArrays(0, 0);
 }
 
 #define skygridx 32
@@ -343,20 +345,26 @@ static void R_SkySphere(void)
                m.pointer_texcoord[1] = skysphere_texcoord2f;
                R_Mesh_State(&m);
                R_Mesh_TextureMatrix(1, &scroll2matrix);
+               GL_LockArrays(0, skysphere_numverts);
                R_Mesh_Draw(skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+               GL_LockArrays(0, 0);
                R_Mesh_TextureMatrix(1, &identitymatrix);
        }
        else
        {
                // two pass
                R_Mesh_State(&m);
+               GL_LockArrays(0, skysphere_numverts);
                R_Mesh_Draw(skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+               GL_LockArrays(0, 0);
 
                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                m.tex[0] = R_GetTexture(alphaskytexture);
                R_Mesh_State(&m);
                R_Mesh_TextureMatrix(0, &scroll2matrix);
+               GL_LockArrays(0, skysphere_numverts);
                R_Mesh_Draw(skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+               GL_LockArrays(0, 0);
        }
        R_Mesh_TextureMatrix(0, &identitymatrix);
 }
diff --git a/todo b/todo
index c7b6924..01be3b5 100644 (file)
--- a/todo
+++ b/todo
@@ -45,6 +45,7 @@
 -n darkplaces: write a readme (Antti)
 -n dpmod: make grapple off-hand (joe hill)
 -n darkplaces: add DP_SV_ROTATINGBMODEL extension to explain that MOVETYPE_PUSH/SOLID_BSP support rotation in darkplaces and a demonstration of how to use it without qc modifications (Uffe, Supajoe)
+2 darkplaces: shadow volume rendering should not unlock the arrays between renders (Mercury) 
 3 darkplaces: add Draw2D function to model struct to make it easy to draw models without an entity (Tomaz)
 0 darkplaces: add GL_EXT_stencil_two_side support to shadow rendering (fuh)
 0 darkplaces: add Mem_AllocNoClear function, and use it where possible, if developer is on it should clear with random garbage