]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
get rid of calculating vertexmesh animcache buffers if we do not need the vertexmesh...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Aug 2010 07:28:24 +0000 (07:28 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Aug 2010 07:28:24 +0000 (07:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10431 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 52e68fac0e005d4e141aaba5753fc74d4e565fca..9ea8719f8f5c9ec33beb2f9851a381f21c63b8e7 100644 (file)
@@ -7761,14 +7761,52 @@ void R_AnimCache_ClearCache(void)
 void R_AnimCache_UpdateEntityMeshBuffers(entity_render_t *ent, int numvertices)
 {
        int i;
+
+       // identical memory layout, so no need to allocate...
+       // this also provides the vertexposition structure to everything, e.g.
+       // depth masked rendering currently uses it even if having separate
+       // arrays
+       // NOTE: get rid of this optimization if changing it to e.g. 4f
+       ent->animcache_vertexposition = (r_vertexposition_t *)ent->animcache_vertex3f;
+
+       // TODO:
+       // get rid of following uses of VERTEXPOSITION, change to the array:
+       // R_DrawTextureSurfaceList_Sky if skyrendermasked
+       // R_DrawSurface_TransparentCallback if r_transparentdepthmasking.integer
+       // R_DrawTextureSurfaceList_DepthOnly
+       // R_Q1BSP_DrawShadowMap
+
+       switch(vid.renderpath)
+       {
+       case RENDERPATH_GL20:
+       case RENDERPATH_CGGL:
+               // need the meshbuffers if !gl_mesh_separatearrays.integer
+               if (gl_mesh_separatearrays.integer)
+                       return;
+               break;
+       case RENDERPATH_D3D9:
+       case RENDERPATH_D3D10:
+       case RENDERPATH_D3D11:
+               // always need the meshbuffers
+               break;
+       case RENDERPATH_GL13:
+       case RENDERPATH_GL11:
+               // never need the meshbuffers
+               return;
+       }
+
        if (!ent->animcache_vertexmesh && ent->animcache_normal3f)
                ent->animcache_vertexmesh = (r_vertexmesh_t *)R_FrameData_Alloc(sizeof(r_vertexmesh_t)*numvertices);
+       /*
        if (!ent->animcache_vertexposition)
                ent->animcache_vertexposition = (r_vertexposition_t *)R_FrameData_Alloc(sizeof(r_vertexposition_t)*numvertices);
+       */
        if (ent->animcache_vertexposition)
        {
+               /*
                for (i = 0;i < numvertices;i++)
                        VectorCopy(ent->animcache_vertex3f + 3*i, ent->animcache_vertexposition[i].vertex3f);
+               */
                // TODO: upload vertex buffer?
        }
        if (ent->animcache_vertexmesh)