mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-30 16:01:46 +00:00
OpenGL2: Fix missing surfaces with r_mergeMultidraws 2.
This commit is contained in:
parent
541d3a40c2
commit
e34972b110
1 changed files with 13 additions and 6 deletions
|
@ -436,22 +436,26 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
|
||||||
if (r_mergeMultidraws->integer == 1)
|
if (r_mergeMultidraws->integer == 1)
|
||||||
{
|
{
|
||||||
// lazy merge, only check the last primitive
|
// lazy merge, only check the last primitive
|
||||||
if (tess.multiDrawPrimitives)
|
// harmless if no multidraw primitives (i = -1 < 0)
|
||||||
{
|
|
||||||
i = tess.multiDrawPrimitives - 1;
|
i = tess.multiDrawPrimitives - 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (; i < tess.multiDrawPrimitives; i++)
|
for (; i < tess.multiDrawPrimitives; i++)
|
||||||
{
|
{
|
||||||
if (tess.multiDrawLastIndex[i] == firstIndexOffset)
|
if (tess.multiDrawLastIndex[i] == firstIndexOffset)
|
||||||
{
|
{
|
||||||
mergeBack = i;
|
mergeBack = i;
|
||||||
|
|
||||||
|
if (mergeForward != -1)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastIndexOffset == tess.multiDrawFirstIndex[i])
|
if (lastIndexOffset == tess.multiDrawFirstIndex[i])
|
||||||
{
|
{
|
||||||
mergeForward = i;
|
mergeForward = i;
|
||||||
|
|
||||||
|
if (mergeBack != -1)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,7 +480,7 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
|
||||||
else if (mergeBack != -1 && mergeForward != -1)
|
else if (mergeBack != -1 && mergeForward != -1)
|
||||||
{
|
{
|
||||||
tess.multiDrawNumIndexes[mergeBack] += numIndexes + tess.multiDrawNumIndexes[mergeForward];
|
tess.multiDrawNumIndexes[mergeBack] += numIndexes + tess.multiDrawNumIndexes[mergeForward];
|
||||||
tess.multiDrawLastIndex[mergeBack] = tess.multiDrawFirstIndex[mergeBack] + tess.multiDrawNumIndexes[mergeBack];
|
tess.multiDrawLastIndex[mergeBack] = tess.multiDrawFirstIndex[mergeForward] + tess.multiDrawNumIndexes[mergeForward];
|
||||||
tess.multiDrawMinIndex[mergeBack] = MIN(tess.multiDrawMinIndex[mergeBack], MIN(tess.multiDrawMinIndex[mergeForward], minIndex));
|
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.multiDrawMaxIndex[mergeBack] = MAX(tess.multiDrawMaxIndex[mergeBack], MAX(tess.multiDrawMaxIndex[mergeForward], maxIndex));
|
||||||
tess.multiDrawPrimitives--;
|
tess.multiDrawPrimitives--;
|
||||||
|
@ -485,10 +489,13 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
|
||||||
{
|
{
|
||||||
tess.multiDrawNumIndexes[mergeForward] = tess.multiDrawNumIndexes[tess.multiDrawPrimitives];
|
tess.multiDrawNumIndexes[mergeForward] = tess.multiDrawNumIndexes[tess.multiDrawPrimitives];
|
||||||
tess.multiDrawFirstIndex[mergeForward] = tess.multiDrawFirstIndex[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];
|
||||||
}
|
}
|
||||||
backEnd.pc.c_multidrawsMerged += 2;
|
backEnd.pc.c_multidrawsMerged += 2;
|
||||||
}
|
}
|
||||||
else if (mergeBack == -1 && mergeForward == -1)
|
else //if (mergeBack == -1 && mergeForward == -1)
|
||||||
{
|
{
|
||||||
tess.multiDrawNumIndexes[tess.multiDrawPrimitives] = numIndexes;
|
tess.multiDrawNumIndexes[tess.multiDrawPrimitives] = numIndexes;
|
||||||
tess.multiDrawFirstIndex[tess.multiDrawPrimitives] = firstIndexOffset;
|
tess.multiDrawFirstIndex[tess.multiDrawPrimitives] = firstIndexOffset;
|
||||||
|
|
Loading…
Reference in a new issue