]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix UI corruption caused by poor handling of missing VBO with firstvertex > 0.
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Aug 2018 21:29:44 +0000 (21:29 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Aug 2018 21:29:44 +0000 (21:29 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12450 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index fafb9d7360bde760bab7fca04fbb081adcf1e70e..b9cde18ced5ef40ef57affa5487dcb6a970bb688 100644 (file)
@@ -7458,6 +7458,7 @@ float RSurf_FogVertex(const float *v)
 void RSurf_UploadBuffersForBatch(void)
 {
        // upload buffer data for generated vertex data (dynamicvertex case) or index data (copytriangles case) and models that lack it to begin with (e.g. DrawQ_FlushUI)
+       // note that if rsurface.batchvertex3f_vertexbuffer is NULL, dynamicvertex is forced as we don't account for the proper base vertex here.
        if (rsurface.batchvertex3f && !rsurface.batchvertex3f_vertexbuffer)
                rsurface.batchvertex3f_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(float[3]), rsurface.batchvertex3f, R_BUFFERDATA_VERTEX, &rsurface.batchvertex3f_bufferoffset);
        if (rsurface.batchsvector3f && !rsurface.batchsvector3f_vertexbuffer)
@@ -7570,6 +7571,14 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const
        // check if any dynamic vertex processing must occur
        dynamicvertex = false;
 
+       // we must use vertexbuffers for rendering, we can upload vertex buffers
+       // easily enough but if the basevertex is non-zero it becomes more
+       // difficult, so force dynamicvertex path in that case - it's suboptimal
+       // but the most optimal case is to have the geometry sources provide their
+       // own anyway.
+       if (!rsurface.modelvertex3f_vertexbuffer && firstvertex != 0)
+               dynamicvertex = true;
+
        // a cvar to force the dynamic vertex path to be taken, for debugging
        if (r_batch_debugdynamicvertexpath.integer)
        {