diff --git a/driver.h b/driver.h index e11ec9f662..6dacf3ba83 100644 --- a/driver.h +++ b/driver.h @@ -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 diff --git a/gfx/gl.c b/gfx/gl.c index a1346a09cc..bc2fde2f03 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -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, }; diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 7314415b4d..a878bdfac0 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -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 diff --git a/gfx/shader/shader_common.c b/gfx/shader/shader_common.c index 3c56bc158e..90f9ace947 100644 --- a/gfx/shader/shader_common.c +++ b/gfx/shader/shader_common.c @@ -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);