mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 23:02:01 +00:00
Merge pull request #34 from lvonasek/feature_opengl_speedup
Opengl speedup
This commit is contained in:
commit
550c25bf71
2 changed files with 11 additions and 11 deletions
|
@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// tr_vbo.c
|
||||
#include "tr_local.h"
|
||||
|
||||
//#define GL_BUFFER_RECYCLING
|
||||
|
||||
|
||||
void R_VaoPackTangent(int16_t *out, vec4_t v)
|
||||
{
|
||||
|
@ -391,18 +393,17 @@ void R_BindNullVao(void)
|
|||
|
||||
if(glState.currentVao)
|
||||
{
|
||||
#ifdef GL_BUFFER_RECYCLING
|
||||
if (glRefConfig.vertexArrayObject)
|
||||
{
|
||||
qglBindVertexArray(0);
|
||||
|
||||
// why you no save GL_ELEMENT_ARRAY_BUFFER binding, Intel?
|
||||
if (1) qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
qglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
#endif
|
||||
glState.currentVao = NULL;
|
||||
}
|
||||
|
||||
|
@ -605,9 +606,6 @@ void RB_UpdateTessVao(unsigned int attribBits)
|
|||
|
||||
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(!(attribBits & ATTR_BITS))
|
||||
attribBits = ATTR_BITS;
|
||||
|
@ -653,10 +651,8 @@ void RB_UpdateTessVao(unsigned int attribBits)
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: This sets a limit of 65536 verts/262144 indexes per static surface
|
||||
// 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_SURFACES MAX_POLYS
|
||||
#define VAOCACHE_QUEUE_MAX_VERTEXES MAX_POLYVERTS
|
||||
#define VAOCACHE_QUEUE_MAX_INDEXES (VAOCACHE_QUEUE_MAX_VERTEXES * 4)
|
||||
|
||||
typedef struct queuedSurface_s
|
||||
|
@ -933,15 +929,19 @@ void VaoCache_CheckAdd(qboolean *endSurface, qboolean *recycleVertexBuffer, qboo
|
|||
|
||||
void VaoCache_RecycleVertexBuffer(void)
|
||||
{
|
||||
#ifdef GL_BUFFER_RECYCLING
|
||||
qglBindBuffer(GL_ARRAY_BUFFER, vc.vao->vertexesVBO);
|
||||
qglBufferData(GL_ARRAY_BUFFER, vc.vao->vertexesSize, NULL, GL_DYNAMIC_DRAW);
|
||||
#endif
|
||||
vc.vertexOffset = 0;
|
||||
}
|
||||
|
||||
void VaoCache_RecycleIndexBuffer(void)
|
||||
{
|
||||
#ifdef GL_BUFFER_RECYCLING
|
||||
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vc.vao->indexesIBO);
|
||||
qglBufferData(GL_ELEMENT_ARRAY_BUFFER, vc.vao->indexesSize, NULL, GL_DYNAMIC_DRAW);
|
||||
#endif
|
||||
vc.indexOffset = 0;
|
||||
vc.numSurfaces = 0;
|
||||
vc.numBatches = 0;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define ENABLE_GL_DEBUG 1
|
||||
#define ENABLE_GL_DEBUG 0
|
||||
#define ENABLE_GL_DEBUG_VERBOSE 0
|
||||
#if ENABLE_GL_DEBUG
|
||||
#include <GLES3/gl32.h>
|
||||
|
|
Loading…
Reference in a new issue