skip zero triangle batches, for good measure
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 13 Nov 2010 12:39:52 +0000 (12:39 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 13 Nov 2010 12:39:52 +0000 (12:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10594 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index e5dea7c..e44489b 100644 (file)
@@ -12192,6 +12192,12 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const
 
 void RSurf_DrawBatch(void)
 {
+       // sometimes a zero triangle surface (usually a degenerate patch) makes it
+       // through the pipeline, killing it earlier in the pipeline would have
+       // per-surface overhead rather than per-batch overhead, so it's best to
+       // reject it here, before it hits glDraw.
+       if (rsurface.batchnumtriangles == 0)
+               return;
 #if 0
        // batch debugging code
        if (r_test.integer && rsurface.entity == r_refdef.scene.worldentity && rsurface.batchvertex3f == r_refdef.scene.worldentity->model->surfmesh.data_vertex3f)