diff options
author | James Canete <use.less01@gmail.com> | 2012-11-07 00:06:51 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-12 21:24:46 +0000 |
commit | 22ac32c7a43deb902455e76446af933eba834479 (patch) | |
tree | 802774e2ade22e7cb3475b21319f07c12dffd690 /src/rend2/tr_shade.c | |
parent | db1ce00dc02fd8ddf7bb4bf57d64455288d58d21 (diff) |
When calling qglDrawRangeElementsEXT(), use proper start and end parameters.
Diffstat (limited to 'src/rend2/tr_shade.c')
-rw-r--r-- | src/rend2/tr_shade.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/rend2/tr_shade.c b/src/rend2/tr_shade.c index e0452d0c..ba2b8460 100644 --- a/src/rend2/tr_shade.c +++ b/src/rend2/tr_shade.c @@ -41,21 +41,22 @@ R_DrawElements ================== */ -void R_DrawElementsVBO( int numIndexes, int firstIndex ) +void R_DrawElementsVBO( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex, glIndex_t maxIndex ) { if (glRefConfig.drawRangeElements) - qglDrawRangeElementsEXT(GL_TRIANGLES, 0, numIndexes, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(GL_INDEX_TYPE))); + qglDrawRangeElementsEXT(GL_TRIANGLES, minIndex, maxIndex, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(GL_INDEX_TYPE))); else qglDrawElements(GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(GL_INDEX_TYPE))); } -static void R_DrawMultiElementsVBO( int multiDrawPrimitives, const GLvoid **multiDrawFirstIndex, GLsizei *multiDrawNumIndexes ) +static void R_DrawMultiElementsVBO( int multiDrawPrimitives, glIndex_t *multiDrawMinIndex, glIndex_t *multiDrawMaxIndex, + GLsizei *multiDrawNumIndexes, glIndex_t **multiDrawFirstIndex) { if (glRefConfig.multiDrawArrays) { - qglMultiDrawElementsEXT(GL_TRIANGLES, multiDrawNumIndexes, GL_INDEX_TYPE, multiDrawFirstIndex, multiDrawPrimitives); + qglMultiDrawElementsEXT(GL_TRIANGLES, multiDrawNumIndexes, GL_INDEX_TYPE, (const GLvoid **)multiDrawFirstIndex, multiDrawPrimitives); } else { @@ -65,7 +66,7 @@ static void R_DrawMultiElementsVBO( int multiDrawPrimitives, const GLvoid **mult { for (i = 0; i < multiDrawPrimitives; i++) { - qglDrawRangeElementsEXT(GL_TRIANGLES, 0, multiDrawNumIndexes[i], multiDrawNumIndexes[i], GL_INDEX_TYPE, multiDrawFirstIndex[i]); + qglDrawRangeElementsEXT(GL_TRIANGLES, multiDrawMinIndex[i], multiDrawMaxIndex[i], multiDrawNumIndexes[i], GL_INDEX_TYPE, multiDrawFirstIndex[i]); } } else @@ -153,11 +154,11 @@ static void DrawTris (shaderCommands_t *input) { if (input->multiDrawPrimitives) { - R_DrawMultiElementsVBO(input->multiDrawPrimitives, (const GLvoid **)input->multiDrawFirstIndex, input->multiDrawNumIndexes); + R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex); } else { - R_DrawElementsVBO(input->numIndexes, input->firstIndex); + R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex); } } @@ -404,11 +405,12 @@ static void ProjectDlightTexture( void ) { if (tess.multiDrawPrimitives) { - R_DrawMultiElementsVBO(tess.multiDrawPrimitives, (const GLvoid **)tess.multiDrawFirstIndex, tess.multiDrawNumIndexes); + shaderCommands_t *input = &tess; + R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex); } else { - R_DrawElementsVBO(tess.numIndexes, tess.firstIndex); + R_DrawElementsVBO(tess.numIndexes, tess.firstIndex, tess.minIndex, tess.maxIndex); } backEnd.pc.c_totalIndexes += tess.numIndexes; @@ -856,11 +858,11 @@ static void ForwardDlight( void ) { if (input->multiDrawPrimitives) { - R_DrawMultiElementsVBO(input->multiDrawPrimitives, (const GLvoid **)input->multiDrawFirstIndex, input->multiDrawNumIndexes); + R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex); } else { - R_DrawElementsVBO(input->numIndexes, input->firstIndex); + R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex); } backEnd.pc.c_totalIndexes += tess.numIndexes; @@ -1052,11 +1054,11 @@ static void ForwardSunlight( void ) { if (input->multiDrawPrimitives) { - R_DrawMultiElementsVBO(input->multiDrawPrimitives, (const GLvoid **)input->multiDrawFirstIndex, input->multiDrawNumIndexes); + R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex); } else { - R_DrawElementsVBO(input->numIndexes, input->firstIndex); + R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex); } backEnd.pc.c_totalIndexes += tess.numIndexes; @@ -1127,11 +1129,11 @@ static void ProjectPshadowVBOGLSL( void ) { if (input->multiDrawPrimitives) { - R_DrawMultiElementsVBO(input->multiDrawPrimitives, (const GLvoid **)input->multiDrawFirstIndex, input->multiDrawNumIndexes); + R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex); } else { - R_DrawElementsVBO(input->numIndexes, input->firstIndex); + R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex); } backEnd.pc.c_totalIndexes += tess.numIndexes; @@ -1197,11 +1199,12 @@ static void RB_FogPass( void ) { if (tess.multiDrawPrimitives) { - R_DrawMultiElementsVBO(tess.multiDrawPrimitives, (const GLvoid **)tess.multiDrawFirstIndex, tess.multiDrawNumIndexes); + shaderCommands_t *input = &tess; + R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex); } else { - R_DrawElementsVBO(tess.numIndexes, tess.firstIndex); + R_DrawElementsVBO(tess.numIndexes, tess.firstIndex, tess.minIndex, tess.maxIndex); } } @@ -1519,11 +1522,11 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) // if (input->multiDrawPrimitives) { - R_DrawMultiElementsVBO(input->multiDrawPrimitives, (const GLvoid **)input->multiDrawFirstIndex, input->multiDrawNumIndexes); + R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex); } else { - R_DrawElementsVBO(input->numIndexes, input->firstIndex); + R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex); } // allow skipping out to show just lightmaps during development @@ -1583,11 +1586,11 @@ static void RB_RenderShadowmap( shaderCommands_t *input ) if (input->multiDrawPrimitives) { - R_DrawMultiElementsVBO(input->multiDrawPrimitives, (const GLvoid **)input->multiDrawFirstIndex, input->multiDrawNumIndexes); + R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex); } else { - R_DrawElementsVBO(input->numIndexes, input->firstIndex); + R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex); } } } |