Create disable_client_arrays function pointer

This commit is contained in:
twinaphex 2017-11-08 05:44:12 +01:00
parent bd1f04554e
commit a72461c16b
3 changed files with 22 additions and 22 deletions

View File

@ -430,22 +430,6 @@ static bool gl_shader_init(gl_t *gl)
return video_shader_driver_init(&init_data);
}
#ifndef NO_GL_FF_VERTEX
static void gl_disable_client_arrays(void)
{
if (gl_query_core_context_in_use())
return;
glClientActiveTexture(GL_TEXTURE1);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE0);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
#endif
GLenum min_filter_to_mag(GLenum type)
{
switch (type)
@ -1364,9 +1348,8 @@ static bool gl_frame(void *data, const void *frame,
video_info->cb_shader_use(gl, video_info->shader_data, 0, true);
glBindTexture(GL_TEXTURE_2D, 0);
#ifndef NO_GL_FF_VERTEX
gl_disable_client_arrays();
#endif
if (gl->renderchain_driver->disable_client_arrays)
gl->renderchain_driver->disable_client_arrays();
}
#ifndef NO_GL_READ_PIXELS
@ -1485,9 +1468,8 @@ static void gl_free(void *data)
font_driver_free_osd();
video_shader_driver_deinit();
#ifndef NO_GL_FF_VERTEX
gl_disable_client_arrays();
#endif
if (gl->renderchain_driver->disable_client_arrays)
gl->renderchain_driver->disable_client_arrays();
glDeleteTextures(gl->textures, gl->texture);

View File

@ -1143,10 +1143,27 @@ static void gl2_renderchain_ff_matrix(const void *data)
}
#endif
#ifndef NO_GL_FF_VERTEX
static void gl2_renderchain_disable_client_arrays(void)
{
if (gl_query_core_context_in_use())
return;
glClientActiveTexture(GL_TEXTURE1);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE0);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
#endif
gl_renderchain_driver_t gl2_renderchain = {
#ifdef NO_GL_FF_VERTEX
NULL,
NULL,
#else
gl2_renderchain_disable_client_arrays,
gl2_renderchain_ff_vertex,
#endif
#ifdef NO_GL_FF_MATRIX

View File

@ -827,6 +827,7 @@ typedef struct d3d_renderchain_driver
typedef struct gl_renderchain_driver
{
void (*disable_client_arrays)(void);
void (*ff_vertex)(const void *data);
void (*ff_matrix)(const void *data);
void (*bind_backbuffer)(void);