@@ -18,8 +18,8 @@ typedef struct {
1818
1919void basevertex_init (context_t * context ) {
2020 basevertex_renderer_t * renderer = & context -> basevertex ;
21- if (context -> es32 ) {
22- printf ("LTW: BaseVertex render calls will use OpenGL ES 3.2 variants \n" );
21+ if (context -> drawelementsbasevertex != NULL ) {
22+ printf ("LTW: BaseVertex render calls will use the host driver implementation \n" );
2323 return ;
2424 }
2525 if (!context -> es31 ) {
@@ -50,8 +50,8 @@ static void restore_state(GLuint element_buffer) {
5050
5151void glDrawElementsBaseVertex (GLenum mode , GLsizei count , GLenum type , const void * indices , GLint basevertex ) {
5252 if (!current_context ) return ;
53- if (current_context -> es32 ) {
54- es3_functions . glDrawElementsBaseVertex (mode , count , type , indices , basevertex );
53+ if (current_context -> drawelementsbasevertex != NULL ) {
54+ current_context -> drawelementsbasevertex (mode , count , type , indices , basevertex );
5555 return ;
5656 }
5757 basevertex_renderer_t * renderer = & current_context -> basevertex ;
@@ -89,9 +89,9 @@ void glMultiDrawElementsBaseVertex(GLenum mode,
8989 GLsizei drawcount ,
9090 const GLint * basevertex ) {
9191 if (!current_context ) return ;
92- if (current_context -> es32 ) {
92+ if (current_context -> drawelementsbasevertex != NULL ) {
9393 for (GLsizei i = 0 ; i < drawcount ; i ++ ) {
94- es3_functions . glDrawElementsBaseVertex (mode , count [i ], type , indices [i ], basevertex [i ]);
94+ current_context -> drawelementsbasevertex (mode , count [i ], type , indices [i ], basevertex [i ]);
9595 }
9696 return ;
9797 }
@@ -121,7 +121,9 @@ void glMultiDrawElementsBaseVertex(GLenum mode,
121121 }
122122 es3_functions .glBindBuffer (GL_DRAW_INDIRECT_BUFFER , renderer -> indirectRenderBuffer );
123123 es3_functions .glBufferData (GL_DRAW_INDIRECT_BUFFER , (long )sizeof (indirect_pass_t ) * drawcount , indirect_passes , GL_STREAM_DRAW );
124- for (GLsizei i = 0 ; i < drawcount ; i ++ ) {
124+ if (current_context -> multidraw_indirect ) {
125+ es3_functions .glMultiDrawElementsIndirectEXT (mode , type , 0 , drawcount , 0 );
126+ } else for (GLsizei i = 0 ; i < drawcount ; i ++ ) {
125127 es3_functions .glDrawElementsIndirect (mode , type , (void * )(sizeof (indirect_pass_t ) * i ));
126128 }
127129 restore_state (elementbuffer );
0 commit comments