@@ -615,6 +615,61 @@ void GL_State( uint32_t stateBits )
615
615
glState.glStateBits ^= diff;
616
616
}
617
617
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
+
618
673
void GL_VertexAttribsState ( uint32_t stateBits, const bool settingUpVAO )
619
674
{
620
675
uint32_t diff;
@@ -673,61 +728,6 @@ void GL_VertexAttribsState( uint32_t stateBits, const bool settingUpVAO )
673
728
}
674
729
}
675
730
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
-
731
731
static GLint GL_ToSRGB ( GLint internalFormat, bool isSRGB )
732
732
{
733
733
if ( !isSRGB )
0 commit comments