Move gl_wrap_type_to_enum to gfx/gl.c

This commit is contained in:
twinaphex 2014-10-02 01:02:13 +02:00
parent 306d1f8809
commit c861b4f994
4 changed files with 24 additions and 24 deletions

View File

@ -414,6 +414,7 @@ typedef struct video_driver
void (*overlay_interface)(void *data, const video_overlay_interface_t **iface);
#endif
void (*poke_interface)(void *data, const video_poke_interface_t **iface);
unsigned (*wrap_type_to_enum)(enum gfx_wrap_type type);
} video_driver_t;
enum rarch_display_type

View File

@ -452,6 +452,26 @@ static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
}
}
static unsigned gl_wrap_type_to_enum(enum gfx_wrap_type type)
{
switch (type)
{
#ifndef HAVE_OPENGLES
case RARCH_WRAP_BORDER:
return GL_CLAMP_TO_BORDER;
#else
case RARCH_WRAP_BORDER:
#endif
case RARCH_WRAP_EDGE:
return GL_CLAMP_TO_EDGE;
case RARCH_WRAP_REPEAT:
return GL_REPEAT;
case RARCH_WRAP_MIRRORED_REPEAT:
return GL_MIRRORED_REPEAT;
}
return 0;
}
static void gl_create_fbo_textures(gl_t *gl)
{
@ -3082,6 +3102,7 @@ static struct gfx_shader *gl_get_current_shader(void *data)
return (gl && gl->shader) ? gl->shader->get_current_shader() : NULL;
}
static const video_poke_interface_t gl_poke_interface = {
NULL,
#ifdef HAVE_FBO
@ -3131,5 +3152,6 @@ video_driver_t video_gl = {
gl_get_overlay_interface,
#endif
gl_get_poke_interface,
gl_wrap_type_to_enum,
};

View File

@ -414,28 +414,5 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height);
void gl_deinit_fbo(gl_t *gl);
/* TODO - we need a D3D equivalent for this too - probably move
* this to video driver later so it can be defined per graphics API. */
static inline GLenum gl_wrap_type_to_enum(enum gfx_wrap_type type)
{
switch (type)
{
#ifndef HAVE_OPENGLES
case RARCH_WRAP_BORDER:
return GL_CLAMP_TO_BORDER;
#else
case RARCH_WRAP_BORDER:
#endif
case RARCH_WRAP_EDGE:
return GL_CLAMP_TO_EDGE;
case RARCH_WRAP_REPEAT:
return GL_REPEAT;
case RARCH_WRAP_MIRRORED_REPEAT:
return GL_MIRRORED_REPEAT;
}
return 0;
}
#endif

View File

@ -75,7 +75,7 @@ bool gl_load_luts(const struct gfx_shader *generic_shader,
}
gl_load_texture_data(lut_textures[i], &img,
gl_wrap_type_to_enum(generic_shader->lut[i].wrap),
driver.video->wrap_type_to_enum(generic_shader->lut[i].wrap),
generic_shader->lut[i].filter != RARCH_FILTER_NEAREST,
generic_shader->lut[i].mipmap);
texture_image_free(&img);