Skip to content

Commit ab6e9e2

Browse files
committed
Make GL_VertexAttribPointers() since it's not used anywhere else
1 parent a30312c commit ab6e9e2

File tree

2 files changed

+55
-56
lines changed

2 files changed

+55
-56
lines changed

src/engine/renderer/tr_backend.cpp

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

618+
static void GL_VertexAttribPointers( uint32_t attribBits, const bool settingUpVAO ) {
619+
uint32_t i;
620+
621+
if ( !glState.currentVBO )
622+
{
623+
Sys::Error( "GL_VertexAttribPointers: no VBO bound" );
624+
}
625+
626+
GLIMP_LOGCOMMENT( "--- GL_VertexAttribPointers( %s ) ---", glState.currentVBO->name );
627+
628+
if ( glConfig2.vboVertexSkinningAvailable && tess.vboVertexSkinning )
629+
{
630+
attribBits |= ATTR_BONE_FACTORS;
631+
}
632+
633+
for ( i = 0; i < ATTR_INDEX_MAX; i++ )
634+
{
635+
uint32_t bit = BIT( i );
636+
uint32_t frame = 0;
637+
uintptr_t base = 0;
638+
639+
if( glState.currentVBO == tess.vbo ) {
640+
base = tess.vertexBase * sizeof( shaderVertex_t );
641+
}
642+
643+
if ( ( attribBits & bit ) != 0 &&
644+
( !( glState.vertexAttribPointersSet & bit ) ||
645+
tess.vboVertexAnimation ||
646+
glState.currentVBO == tess.vbo || settingUpVAO || glState.currentVBO->dynamicVAO ) )
647+
{
648+
const vboAttributeLayout_t *layout = &glState.currentVBO->attribs[ i ];
649+
650+
GLIMP_LOGCOMMENT( "glVertexAttribPointer( %s )", attributeNames[ i ] );
651+
652+
if ( ( ATTR_INTERP_BITS & bit ) && glState.vertexAttribsInterpolation > 0 )
653+
{
654+
frame = glState.vertexAttribsNewFrame;
655+
}
656+
else
657+
{
658+
frame = glState.vertexAttribsOldFrame;
659+
}
660+
661+
if ( !( glState.currentVBO->attribBits & bit ) )
662+
{
663+
Log::Warn( "GL_VertexAttribPointers: %s does not have %s",
664+
glState.currentVBO->name, attributeNames[ i ] );
665+
}
666+
667+
glVertexAttribPointer( i, layout->numComponents, layout->componentType, layout->normalize, layout->stride, BUFFER_OFFSET( layout->ofs + ( frame * layout->frameOffset + base ) ) );
668+
glState.vertexAttribPointersSet |= bit;
669+
}
670+
}
671+
}
672+
618673
void GL_VertexAttribsState( uint32_t stateBits, const bool settingUpVAO )
619674
{
620675
uint32_t diff;
@@ -673,61 +728,6 @@ void GL_VertexAttribsState( uint32_t stateBits, const bool settingUpVAO )
673728
}
674729
}
675730

676-
void GL_VertexAttribPointers( uint32_t attribBits, const bool settingUpVAO ) {
677-
uint32_t i;
678-
679-
if ( !glState.currentVBO )
680-
{
681-
Sys::Error( "GL_VertexAttribPointers: no VBO bound" );
682-
}
683-
684-
GLIMP_LOGCOMMENT( "--- GL_VertexAttribPointers( %s ) ---", glState.currentVBO->name );
685-
686-
if ( glConfig2.vboVertexSkinningAvailable && tess.vboVertexSkinning )
687-
{
688-
attribBits |= ATTR_BONE_FACTORS;
689-
}
690-
691-
for ( i = 0; i < ATTR_INDEX_MAX; i++ )
692-
{
693-
uint32_t bit = BIT( i );
694-
uint32_t frame = 0;
695-
uintptr_t base = 0;
696-
697-
if( glState.currentVBO == tess.vbo ) {
698-
base = tess.vertexBase * sizeof( shaderVertex_t );
699-
}
700-
701-
if ( ( attribBits & bit ) != 0 &&
702-
( !( glState.vertexAttribPointersSet & bit ) ||
703-
tess.vboVertexAnimation ||
704-
glState.currentVBO == tess.vbo || settingUpVAO || glState.currentVBO->dynamicVAO ) )
705-
{
706-
const vboAttributeLayout_t *layout = &glState.currentVBO->attribs[ i ];
707-
708-
GLIMP_LOGCOMMENT( "glVertexAttribPointer( %s )", attributeNames[ i ] );
709-
710-
if ( ( ATTR_INTERP_BITS & bit ) && glState.vertexAttribsInterpolation > 0 )
711-
{
712-
frame = glState.vertexAttribsNewFrame;
713-
}
714-
else
715-
{
716-
frame = glState.vertexAttribsOldFrame;
717-
}
718-
719-
if ( !( glState.currentVBO->attribBits & bit ) )
720-
{
721-
Log::Warn( "GL_VertexAttribPointers: %s does not have %s",
722-
glState.currentVBO->name, attributeNames[ i ] );
723-
}
724-
725-
glVertexAttribPointer( i, layout->numComponents, layout->componentType, layout->normalize, layout->stride, BUFFER_OFFSET( layout->ofs + ( frame * layout->frameOffset + base ) ) );
726-
glState.vertexAttribPointersSet |= bit;
727-
}
728-
}
729-
}
730-
731731
static GLint GL_ToSRGB( GLint internalFormat, bool isSRGB )
732732
{
733733
if ( !isSRGB )

src/engine/renderer/tr_local.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2924,7 +2924,6 @@ inline bool checkGLErrors()
29242924

29252925
void GL_State( uint32_t stateVector );
29262926
void GL_VertexAttribsState( uint32_t stateBits, const bool settingUpVAO = false );
2927-
void GL_VertexAttribPointers( uint32_t attribBits, const bool settingUpVAO );
29282927
void GL_Cull( cullType_t cullType );
29292928
void GL_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data, bool isSRGB );
29302929
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 );

0 commit comments

Comments
 (0)