From: havoc Date: Sun, 5 Aug 2018 21:29:44 +0000 (+0000) Subject: Fix UI corruption caused by poor handling of missing VBO with firstvertex > 0. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ab2e285e252663c0b7ab9128eb5ef753419f276e;p=xonotic%2Fdarkplaces.git Fix UI corruption caused by poor handling of missing VBO with firstvertex > 0. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12450 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index fafb9d73..b9cde18c 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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) {