[iortcw] 236/497: All: Rend2: Fix missing surfaces with r_mergeMultidraws 2
Simon McVittie
smcv at debian.org
Wed Sep 21 19:48:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit 0ffa776511ff8ed4fc6cb3ff2806f6843e2070d4
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Thu Oct 16 14:49:56 2014 +0000
All: Rend2: Fix missing surfaces with r_mergeMultidraws 2
---
MP/code/rend2/tr_surface.c | 20 +++++++++++++-------
SP/code/rend2/tr_surface.c | 20 +++++++++++++-------
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/MP/code/rend2/tr_surface.c b/MP/code/rend2/tr_surface.c
index 602f975..a166f89 100644
--- a/MP/code/rend2/tr_surface.c
+++ b/MP/code/rend2/tr_surface.c
@@ -457,17 +457,14 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
firstIndexOffset = BUFFER_OFFSET(firstIndex * sizeof(glIndex_t));
lastIndexOffset = BUFFER_OFFSET((firstIndex + numIndexes) * sizeof(glIndex_t));
- if (r_mergeMultidraws->integer)
+ if (tess.multiDrawPrimitives && r_mergeMultidraws->integer)
{
i = 0;
if (r_mergeMultidraws->integer == 1)
{
// lazy merge, only check the last primitive
- if (tess.multiDrawPrimitives)
- {
- i = tess.multiDrawPrimitives - 1;
- }
+ i = tess.multiDrawPrimitives - 1;
}
for (; i < tess.multiDrawPrimitives; i++)
@@ -475,11 +472,17 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
if (tess.multiDrawLastIndex[i] == firstIndexOffset)
{
mergeBack = i;
+
+ if (mergeForward != -1)
+ break;
}
if (lastIndexOffset == tess.multiDrawFirstIndex[i])
{
mergeForward = i;
+
+ if (mergeBack != -1)
+ break;
}
}
}
@@ -504,7 +507,7 @@ 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[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.multiDrawMaxIndex[mergeBack] = MAX(tess.multiDrawMaxIndex[mergeBack], MAX(tess.multiDrawMaxIndex[mergeForward], maxIndex));
tess.multiDrawPrimitives--;
@@ -513,10 +516,13 @@ 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];
}
backEnd.pc.c_multidrawsMerged += 2;
}
- else if (mergeBack == -1 && mergeForward == -1)
+ else //if (mergeBack == -1 && mergeForward == -1)
{
tess.multiDrawNumIndexes[tess.multiDrawPrimitives] = numIndexes;
tess.multiDrawFirstIndex[tess.multiDrawPrimitives] = firstIndexOffset;
diff --git a/SP/code/rend2/tr_surface.c b/SP/code/rend2/tr_surface.c
index 79253e5..12ceecc 100644
--- a/SP/code/rend2/tr_surface.c
+++ b/SP/code/rend2/tr_surface.c
@@ -457,17 +457,14 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
firstIndexOffset = BUFFER_OFFSET(firstIndex * sizeof(glIndex_t));
lastIndexOffset = BUFFER_OFFSET((firstIndex + numIndexes) * sizeof(glIndex_t));
- if (r_mergeMultidraws->integer)
+ if (tess.multiDrawPrimitives && r_mergeMultidraws->integer)
{
i = 0;
if (r_mergeMultidraws->integer == 1)
{
// lazy merge, only check the last primitive
- if (tess.multiDrawPrimitives)
- {
- i = tess.multiDrawPrimitives - 1;
- }
+ i = tess.multiDrawPrimitives - 1;
}
for (; i < tess.multiDrawPrimitives; i++)
@@ -475,11 +472,17 @@ static qboolean RB_SurfaceVao(vao_t *vao, int numVerts, int numIndexes, int firs
if (tess.multiDrawLastIndex[i] == firstIndexOffset)
{
mergeBack = i;
+
+ if (mergeForward != -1)
+ break;
}
if (lastIndexOffset == tess.multiDrawFirstIndex[i])
{
mergeForward = i;
+
+ if (mergeBack != -1)
+ break;
}
}
}
@@ -504,7 +507,7 @@ 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[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.multiDrawMaxIndex[mergeBack] = MAX(tess.multiDrawMaxIndex[mergeBack], MAX(tess.multiDrawMaxIndex[mergeForward], maxIndex));
tess.multiDrawPrimitives--;
@@ -513,10 +516,13 @@ 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];
}
backEnd.pc.c_multidrawsMerged += 2;
}
- else if (mergeBack == -1 && mergeForward == -1)
+ else //if (mergeBack == -1 && mergeForward == -1)
{
tess.multiDrawNumIndexes[tess.multiDrawPrimitives] = numIndexes;
tess.multiDrawFirstIndex[tess.multiDrawPrimitives] = firstIndexOffset;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list