Skip to content

Commit a30312c

Browse files
committed
tess.settingUpVAO -> GL_VertexAttribsState() arg
1 parent 4a6c36a commit a30312c

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

src/engine/renderer/tr_backend.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -615,12 +615,12 @@ void GL_State( uint32_t stateBits )
615615
glState.glStateBits ^= diff;
616616
}
617617

618-
void GL_VertexAttribsState( uint32_t stateBits )
618+
void GL_VertexAttribsState( uint32_t stateBits, const bool settingUpVAO )
619619
{
620620
uint32_t diff;
621621
uint32_t i;
622622

623-
if ( !tess.settingUpVAO && glState.currentVBO && !glState.currentVBO->dynamicVAO ) {
623+
if ( !settingUpVAO && glState.currentVBO && !glState.currentVBO->dynamicVAO ) {
624624
glState.currentVBO->VAO.Bind();
625625
return;
626626
}
@@ -630,9 +630,9 @@ void GL_VertexAttribsState( uint32_t stateBits )
630630
stateBits |= ATTR_BONE_FACTORS;
631631
}
632632

633-
GL_VertexAttribPointers( stateBits );
633+
GL_VertexAttribPointers( stateBits, settingUpVAO );
634634

635-
if ( !tess.settingUpVAO && backEnd.currentVAO != backEnd.defaultVAO ) {
635+
if ( !settingUpVAO && backEnd.currentVAO != backEnd.defaultVAO ) {
636636
return;
637637
}
638638

@@ -673,8 +673,7 @@ void GL_VertexAttribsState( uint32_t stateBits )
673673
}
674674
}
675675

676-
void GL_VertexAttribPointers( uint32_t attribBits )
677-
{
676+
void GL_VertexAttribPointers( uint32_t attribBits, const bool settingUpVAO ) {
678677
uint32_t i;
679678

680679
if ( !glState.currentVBO )
@@ -702,7 +701,7 @@ void GL_VertexAttribPointers( uint32_t attribBits )
702701
if ( ( attribBits & bit ) != 0 &&
703702
( !( glState.vertexAttribPointersSet & bit ) ||
704703
tess.vboVertexAnimation ||
705-
glState.currentVBO == tess.vbo || tess.settingUpVAO || glState.currentVBO->dynamicVAO ) )
704+
glState.currentVBO == tess.vbo || settingUpVAO || glState.currentVBO->dynamicVAO ) )
706705
{
707706
const vboAttributeLayout_t *layout = &glState.currentVBO->attribs[ i ];
708707

src/engine/renderer/tr_local.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,8 +2923,8 @@ inline bool checkGLErrors()
29232923
void GL_PolygonOffset( float factor, float units );
29242924

29252925
void GL_State( uint32_t stateVector );
2926-
void GL_VertexAttribsState( uint32_t stateBits );
2927-
void GL_VertexAttribPointers( uint32_t attribBits );
2926+
void GL_VertexAttribsState( uint32_t stateBits, const bool settingUpVAO = false );
2927+
void GL_VertexAttribPointers( uint32_t attribBits, const bool settingUpVAO );
29282928
void GL_Cull( cullType_t cullType );
29292929
void GL_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data, bool isSRGB );
29302930
void GL_TexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *data, bool isSRGB );
@@ -3126,8 +3126,6 @@ void GLimp_LogComment_( std::string comment );
31263126
// enabled when an MD3 VBO is used
31273127
bool vboVertexAnimation;
31283128

3129-
bool settingUpVAO = false;
3130-
31313129
// This can be thought of a "flush" function for the vertex buffer.
31323130
// Which function depends on backend mode and also the shader.
31333131
void ( *stageIteratorFunc )();

src/engine/renderer/tr_vbo.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,7 @@ void SetupVAOBuffers( VBO_t* VBO, const IBO_t* IBO, const uint32_t stateBits,
453453

454454
R_BindVBO( VBO );
455455

456-
tess.settingUpVAO = true;
457-
GL_VertexAttribsState( stateBits );
458-
tess.settingUpVAO = false;
456+
GL_VertexAttribsState( stateBits, true );
459457

460458
if ( IBO ) {
461459
VAO->SetIndexBuffer( IBO->indexesVBO );

0 commit comments

Comments
 (0)