summaryrefslogtreecommitdiff
path: root/src/renderergl2
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderergl2')
-rw-r--r--src/renderergl2/tr_local.h3
-rw-r--r--src/renderergl2/tr_shade.c2
-rw-r--r--src/renderergl2/tr_surface.c7
3 files changed, 3 insertions, 9 deletions
diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h
index ca8c789f..a4f0e5ea 100644
--- a/src/renderergl2/tr_local.h
+++ b/src/renderergl2/tr_local.h
@@ -2007,7 +2007,7 @@ typedef struct stageVars
vec2_t texcoords[NUM_TEXTURE_BUNDLES][SHADER_MAX_VERTEXES];
} stageVars_t;
-#define MAX_MULTIDRAW_PRIMITIVES 16384
+#define MAX_MULTIDRAW_PRIMITIVES 256
typedef struct shaderCommands_s
{
@@ -2047,7 +2047,6 @@ typedef struct shaderCommands_s
int multiDrawPrimitives;
GLsizei multiDrawNumIndexes[MAX_MULTIDRAW_PRIMITIVES];
glIndex_t *multiDrawFirstIndex[MAX_MULTIDRAW_PRIMITIVES];
- glIndex_t *multiDrawLastIndex[MAX_MULTIDRAW_PRIMITIVES];
glIndex_t multiDrawMinIndex[MAX_MULTIDRAW_PRIMITIVES];
glIndex_t multiDrawMaxIndex[MAX_MULTIDRAW_PRIMITIVES];
diff --git a/src/renderergl2/tr_shade.c b/src/renderergl2/tr_shade.c
index b66fb10d..5752c4ff 100644
--- a/src/renderergl2/tr_shade.c
+++ b/src/renderergl2/tr_shade.c
@@ -55,7 +55,7 @@ void R_DrawElementsVao( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex
static void R_DrawMultiElementsVao( int multiDrawPrimitives, glIndex_t *multiDrawMinIndex, glIndex_t *multiDrawMaxIndex,
GLsizei *multiDrawNumIndexes, glIndex_t **multiDrawFirstIndex)
{
- if (glRefConfig.multiDrawArrays)
+ if (glRefConfig.multiDrawArrays && multiDrawPrimitives > 1)
{
qglMultiDrawElementsEXT(GL_TRIANGLES, multiDrawNumIndexes, GL_INDEX_TYPE, (const GLvoid **)multiDrawFirstIndex, multiDrawPrimitives);
}
diff --git a/src/renderergl2/tr_surface.c b/src/renderergl2/tr_surface.c
index b74ba369..a07484ca 100644
--- a/src/renderergl2/tr_surface.c
+++ b/src/renderergl2/tr_surface.c
@@ -442,7 +442,7 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
for (; i < tess.multiDrawPrimitives; i++)
{
- if (tess.multiDrawLastIndex[i] == firstIndexOffset)
+ if (firstIndexOffset == tess.multiDrawFirstIndex[i] + tess.multiDrawNumIndexes[i])
{
mergeBack = i;
@@ -463,7 +463,6 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
if (mergeBack != -1 && mergeForward == -1)
{
tess.multiDrawNumIndexes[mergeBack] += numIndexes;
- tess.multiDrawLastIndex[mergeBack] = tess.multiDrawFirstIndex[mergeBack] + tess.multiDrawNumIndexes[mergeBack];
tess.multiDrawMinIndex[mergeBack] = MIN(tess.multiDrawMinIndex[mergeBack], minIndex);
tess.multiDrawMaxIndex[mergeBack] = MAX(tess.multiDrawMaxIndex[mergeBack], maxIndex);
backEnd.pc.c_multidrawsMerged++;
@@ -472,7 +471,6 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
{
tess.multiDrawNumIndexes[mergeForward] += numIndexes;
tess.multiDrawFirstIndex[mergeForward] = firstIndexOffset;
- tess.multiDrawLastIndex[mergeForward] = tess.multiDrawFirstIndex[mergeForward] + tess.multiDrawNumIndexes[mergeForward];
tess.multiDrawMinIndex[mergeForward] = MIN(tess.multiDrawMinIndex[mergeForward], minIndex);
tess.multiDrawMaxIndex[mergeForward] = MAX(tess.multiDrawMaxIndex[mergeForward], maxIndex);
backEnd.pc.c_multidrawsMerged++;
@@ -480,7 +478,6 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
else if (mergeBack != -1 && mergeForward != -1)
{
tess.multiDrawNumIndexes[mergeBack] += numIndexes + tess.multiDrawNumIndexes[mergeForward];
- tess.multiDrawLastIndex[mergeBack] = tess.multiDrawFirstIndex[mergeForward] + tess.multiDrawNumIndexes[mergeForward];
tess.multiDrawMinIndex[mergeBack] = MIN(tess.multiDrawMinIndex[mergeBack], MIN(tess.multiDrawMinIndex[mergeForward], minIndex));
tess.multiDrawMaxIndex[mergeBack] = MAX(tess.multiDrawMaxIndex[mergeBack], MAX(tess.multiDrawMaxIndex[mergeForward], maxIndex));
tess.multiDrawPrimitives--;
@@ -489,7 +486,6 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
{
tess.multiDrawNumIndexes[mergeForward] = tess.multiDrawNumIndexes[tess.multiDrawPrimitives];
tess.multiDrawFirstIndex[mergeForward] = tess.multiDrawFirstIndex[tess.multiDrawPrimitives];
- tess.multiDrawLastIndex[mergeForward] = tess.multiDrawLastIndex[tess.multiDrawPrimitives];
tess.multiDrawMinIndex[mergeForward] = tess.multiDrawMinIndex[tess.multiDrawPrimitives];
tess.multiDrawMaxIndex[mergeForward] = tess.multiDrawMaxIndex[tess.multiDrawPrimitives];
}
@@ -499,7 +495,6 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
{
tess.multiDrawNumIndexes[tess.multiDrawPrimitives] = numIndexes;
tess.multiDrawFirstIndex[tess.multiDrawPrimitives] = firstIndexOffset;
- tess.multiDrawLastIndex[tess.multiDrawPrimitives] = lastIndexOffset;
tess.multiDrawMinIndex[tess.multiDrawPrimitives] = minIndex;
tess.multiDrawMaxIndex[tess.multiDrawPrimitives] = maxIndex;
tess.multiDrawPrimitives++;