OpenGL2: Vertex array object support.
This commit is contained in:
parent
873a02bd3c
commit
84206c8598
19 changed files with 582 additions and 666 deletions
|
@ -41,7 +41,7 @@ R_DrawElements
|
|||
==================
|
||||
*/
|
||||
|
||||
void R_DrawElementsVBO( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex, glIndex_t maxIndex )
|
||||
void R_DrawElementsVao( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex, glIndex_t maxIndex )
|
||||
{
|
||||
if (glRefConfig.drawRangeElements)
|
||||
qglDrawRangeElementsEXT(GL_TRIANGLES, minIndex, maxIndex, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(glIndex_t)));
|
||||
|
@ -51,7 +51,7 @@ void R_DrawElementsVBO( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex
|
|||
}
|
||||
|
||||
|
||||
static void R_DrawMultiElementsVBO( int multiDrawPrimitives, glIndex_t *multiDrawMinIndex, glIndex_t *multiDrawMaxIndex,
|
||||
static void R_DrawMultiElementsVao( int multiDrawPrimitives, glIndex_t *multiDrawMinIndex, glIndex_t *multiDrawMaxIndex,
|
||||
GLsizei *multiDrawNumIndexes, glIndex_t **multiDrawFirstIndex)
|
||||
{
|
||||
if (glRefConfig.multiDrawArrays)
|
||||
|
@ -154,11 +154,11 @@ static void DrawTris (shaderCommands_t *input) {
|
|||
|
||||
if (input->multiDrawPrimitives)
|
||||
{
|
||||
R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
R_DrawMultiElementsVao(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
R_DrawElementsVao(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ void RB_BeginSurface( shader_t *shader, int fogNum, int cubemapIndex ) {
|
|||
tess.xstages = state->stages;
|
||||
tess.numPasses = state->numUnfoggedPasses;
|
||||
tess.currentStageIteratorFunc = state->optimalStageIteratorFunc;
|
||||
tess.useInternalVBO = qtrue;
|
||||
tess.useInternalVao = qtrue;
|
||||
|
||||
tess.shaderTime = backEnd.refdef.floatTime - tess.shader->timeOffset;
|
||||
if (tess.shader->clampTime && tess.shaderTime >= tess.shader->clampTime) {
|
||||
|
@ -429,11 +429,11 @@ static void ProjectDlightTexture( void ) {
|
|||
if (tess.multiDrawPrimitives)
|
||||
{
|
||||
shaderCommands_t *input = &tess;
|
||||
R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
R_DrawMultiElementsVao(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_DrawElementsVBO(tess.numIndexes, tess.firstIndex, tess.minIndex, tess.maxIndex);
|
||||
R_DrawElementsVao(tess.numIndexes, tess.firstIndex, tess.minIndex, tess.maxIndex);
|
||||
}
|
||||
|
||||
backEnd.pc.c_totalIndexes += tess.numIndexes;
|
||||
|
@ -873,11 +873,11 @@ static void ForwardDlight( void ) {
|
|||
|
||||
if (input->multiDrawPrimitives)
|
||||
{
|
||||
R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
R_DrawMultiElementsVao(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
R_DrawElementsVao(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
}
|
||||
|
||||
backEnd.pc.c_totalIndexes += tess.numIndexes;
|
||||
|
@ -949,11 +949,11 @@ static void ProjectPshadowVBOGLSL( void ) {
|
|||
|
||||
if (input->multiDrawPrimitives)
|
||||
{
|
||||
R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
R_DrawMultiElementsVao(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
R_DrawElementsVao(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
}
|
||||
|
||||
backEnd.pc.c_totalIndexes += tess.numIndexes;
|
||||
|
@ -1032,11 +1032,11 @@ static void RB_FogPass( void ) {
|
|||
if (tess.multiDrawPrimitives)
|
||||
{
|
||||
shaderCommands_t *input = &tess;
|
||||
R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
R_DrawMultiElementsVao(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_DrawElementsVBO(tess.numIndexes, tess.firstIndex, tess.minIndex, tess.maxIndex);
|
||||
R_DrawElementsVao(tess.numIndexes, tess.firstIndex, tess.minIndex, tess.maxIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1398,11 +1398,11 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
//
|
||||
if (input->multiDrawPrimitives)
|
||||
{
|
||||
R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
R_DrawMultiElementsVao(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
R_DrawElementsVao(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
}
|
||||
|
||||
// allow skipping out to show just lightmaps during development
|
||||
|
@ -1462,11 +1462,11 @@ static void RB_RenderShadowmap( shaderCommands_t *input )
|
|||
|
||||
if (input->multiDrawPrimitives)
|
||||
{
|
||||
R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
R_DrawMultiElementsVao(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
R_DrawElementsVao(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1489,20 +1489,20 @@ void RB_StageIteratorGeneric( void )
|
|||
return;
|
||||
}
|
||||
|
||||
if (tess.useInternalVBO)
|
||||
if (tess.useInternalVao)
|
||||
{
|
||||
RB_DeformTessGeometry();
|
||||
}
|
||||
|
||||
vertexAttribs = RB_CalcShaderVertexAttribs( input );
|
||||
|
||||
if (tess.useInternalVBO)
|
||||
if (tess.useInternalVao)
|
||||
{
|
||||
RB_UpdateTessVbo(vertexAttribs);
|
||||
RB_UpdateTessVao(vertexAttribs);
|
||||
}
|
||||
else
|
||||
{
|
||||
backEnd.pc.c_staticVboDraws++;
|
||||
backEnd.pc.c_staticVaoDraws++;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1543,7 +1543,10 @@ void RB_StageIteratorGeneric( void )
|
|||
//
|
||||
// Set vertex attribs and pointers
|
||||
//
|
||||
GLSL_VertexAttribsState(vertexAttribs);
|
||||
if (tess.useInternalVao)
|
||||
GLSL_VertexAttribsState(vertexAttribs);
|
||||
else if (glState.vertexAnimation)
|
||||
GLSL_VertexAttribPointers(vertexAttribs & (ATTR_POSITION | ATTR_POSITION2 | ATTR_NORMAL | ATTR_NORMAL2 | ATTR_TANGENT | ATTR_TANGENT2));
|
||||
|
||||
//
|
||||
// render depth if in depthfill mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue