Revert "Speedup VBO"

This reverts commit 22890e13a6.
This commit is contained in:
Simon 2022-03-24 18:51:43 +00:00
parent 56d1334007
commit 0c52a61cf6

View file

@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// tr_vbo.c // tr_vbo.c
#include "tr_local.h" #include "tr_local.h"
//#define GL_BUFFER_RECYCLING
void R_VaoPackTangent(int16_t *out, vec4_t v) void R_VaoPackTangent(int16_t *out, vec4_t v)
{ {
@ -393,17 +391,18 @@ void R_BindNullVao(void)
if(glState.currentVao) if(glState.currentVao)
{ {
#ifdef GL_BUFFER_RECYCLING
if (glRefConfig.vertexArrayObject) if (glRefConfig.vertexArrayObject)
{ {
qglBindVertexArray(0); qglBindVertexArray(0);
// why you no save GL_ELEMENT_ARRAY_BUFFER binding, Intel?
if (1) qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
} }
else else
{ {
qglBindBuffer(GL_ARRAY_BUFFER, 0); qglBindBuffer(GL_ARRAY_BUFFER, 0);
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
} }
#endif
glState.currentVao = NULL; glState.currentVao = NULL;
} }
@ -606,6 +605,9 @@ void RB_UpdateTessVao(unsigned int attribBits)
R_BindVao(tess.vao); R_BindVao(tess.vao);
// orphan old vertex buffer so we don't stall on it
qglBufferData(GL_ARRAY_BUFFER, tess.vao->vertexesSize, NULL, GL_DYNAMIC_DRAW);
// if nothing to set, set everything // if nothing to set, set everything
if(!(attribBits & ATTR_BITS)) if(!(attribBits & ATTR_BITS))
attribBits = ATTR_BITS; attribBits = ATTR_BITS;
@ -651,8 +653,10 @@ void RB_UpdateTessVao(unsigned int attribBits)
} }
} }
#define VAOCACHE_QUEUE_MAX_SURFACES MAX_POLYS // FIXME: This sets a limit of 65536 verts/262144 indexes per static surface
#define VAOCACHE_QUEUE_MAX_VERTEXES MAX_POLYVERTS // This is higher than the old vq3 limits but is worth noting
#define VAOCACHE_QUEUE_MAX_SURFACES (1 << 10)
#define VAOCACHE_QUEUE_MAX_VERTEXES (1 << 16)
#define VAOCACHE_QUEUE_MAX_INDEXES (VAOCACHE_QUEUE_MAX_VERTEXES * 4) #define VAOCACHE_QUEUE_MAX_INDEXES (VAOCACHE_QUEUE_MAX_VERTEXES * 4)
typedef struct queuedSurface_s typedef struct queuedSurface_s
@ -929,19 +933,15 @@ void VaoCache_CheckAdd(qboolean *endSurface, qboolean *recycleVertexBuffer, qboo
void VaoCache_RecycleVertexBuffer(void) void VaoCache_RecycleVertexBuffer(void)
{ {
#ifdef GL_BUFFER_RECYCLING
qglBindBuffer(GL_ARRAY_BUFFER, vc.vao->vertexesVBO); qglBindBuffer(GL_ARRAY_BUFFER, vc.vao->vertexesVBO);
qglBufferData(GL_ARRAY_BUFFER, vc.vao->vertexesSize, NULL, GL_DYNAMIC_DRAW); qglBufferData(GL_ARRAY_BUFFER, vc.vao->vertexesSize, NULL, GL_DYNAMIC_DRAW);
#endif
vc.vertexOffset = 0; vc.vertexOffset = 0;
} }
void VaoCache_RecycleIndexBuffer(void) void VaoCache_RecycleIndexBuffer(void)
{ {
#ifdef GL_BUFFER_RECYCLING
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vc.vao->indexesIBO); qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vc.vao->indexesIBO);
qglBufferData(GL_ELEMENT_ARRAY_BUFFER, vc.vao->indexesSize, NULL, GL_DYNAMIC_DRAW); qglBufferData(GL_ELEMENT_ARRAY_BUFFER, vc.vao->indexesSize, NULL, GL_DYNAMIC_DRAW);
#endif
vc.indexOffset = 0; vc.indexOffset = 0;
vc.numSurfaces = 0; vc.numSurfaces = 0;
vc.numBatches = 0; vc.numBatches = 0;