mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Refactor this - get rid of set_coords_fallback
This commit is contained in:
parent
ade80dbe76
commit
e560adcc9f
@ -141,25 +141,6 @@ typedef struct gl
|
|||||||
void *renderchain_data;
|
void *renderchain_data;
|
||||||
} gl_t;
|
} gl_t;
|
||||||
|
|
||||||
#ifdef NO_GL_FF_VERTEX
|
|
||||||
#define gl_ff_vertex(coords) ((void)0)
|
|
||||||
#else
|
|
||||||
static INLINE void gl_ff_vertex(const struct video_coords *coords)
|
|
||||||
{
|
|
||||||
/* Fall back to fixed function-style if needed and possible. */
|
|
||||||
glClientActiveTexture(GL_TEXTURE1);
|
|
||||||
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord);
|
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
glClientActiveTexture(GL_TEXTURE0);
|
|
||||||
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
|
||||||
glColorPointer(4, GL_FLOAT, 0, coords->color);
|
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
|
||||||
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord);
|
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static INLINE void gl_bind_texture(GLuint id, GLint wrap_mode, GLint mag_filter,
|
static INLINE void gl_bind_texture(GLuint id, GLint wrap_mode, GLint mag_filter,
|
||||||
GLint min_filter)
|
GLint min_filter)
|
||||||
{
|
{
|
||||||
|
@ -289,12 +289,6 @@ static bool gl_cg_set_coords(void *handle_data, void *shader_data, const struct
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gl_cg_set_coords_fallback(void *handle_data, void *shader_data, const struct video_coords *coords)
|
|
||||||
{
|
|
||||||
gl_ff_vertex(coords);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gl_cg_set_texture_info(
|
static void gl_cg_set_texture_info(
|
||||||
cg_shader_data_t *cg,
|
cg_shader_data_t *cg,
|
||||||
const struct cg_fbo_params *params,
|
const struct cg_fbo_params *params,
|
||||||
@ -1292,7 +1286,6 @@ const shader_backend_t gl_cg_backend = {
|
|||||||
gl_cg_wrap_type,
|
gl_cg_wrap_type,
|
||||||
gl_cg_shader_scale,
|
gl_cg_shader_scale,
|
||||||
gl_cg_set_coords,
|
gl_cg_set_coords,
|
||||||
gl_cg_set_coords_fallback,
|
|
||||||
gl_cg_set_mvp,
|
gl_cg_set_mvp,
|
||||||
gl_cg_get_prev_textures,
|
gl_cg_get_prev_textures,
|
||||||
gl_cg_get_feedback_pass,
|
gl_cg_get_feedback_pass,
|
||||||
|
@ -1549,13 +1549,6 @@ static bool gl_glsl_set_coords(void *handle_data, void *shader_data,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gl_glsl_set_coords_fallback(void *handle_data, void *shader_data,
|
|
||||||
const struct video_coords *coords)
|
|
||||||
{
|
|
||||||
gl_ff_vertex(coords);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gl_glsl_use(void *data, void *shader_data, unsigned idx, bool set_active)
|
static void gl_glsl_use(void *data, void *shader_data, unsigned idx, bool set_active)
|
||||||
{
|
{
|
||||||
GLuint id;
|
GLuint id;
|
||||||
@ -1682,7 +1675,6 @@ const shader_backend_t gl_glsl_backend = {
|
|||||||
gl_glsl_wrap_type,
|
gl_glsl_wrap_type,
|
||||||
gl_glsl_shader_scale,
|
gl_glsl_shader_scale,
|
||||||
gl_glsl_set_coords,
|
gl_glsl_set_coords,
|
||||||
gl_glsl_set_coords_fallback,
|
|
||||||
gl_glsl_set_mvp,
|
gl_glsl_set_mvp,
|
||||||
gl_glsl_get_prev_textures,
|
gl_glsl_get_prev_textures,
|
||||||
gl_glsl_get_feedback_pass,
|
gl_glsl_get_feedback_pass,
|
||||||
|
@ -542,7 +542,6 @@ const shader_backend_t hlsl_backend = {
|
|||||||
NULL, /* hlsl_wrap_type */
|
NULL, /* hlsl_wrap_type */
|
||||||
hlsl_shader_scale,
|
hlsl_shader_scale,
|
||||||
NULL, /* hlsl_set_coords */
|
NULL, /* hlsl_set_coords */
|
||||||
NULL, /* hlsl_set_coords_fallback */
|
|
||||||
hlsl_set_mvp,
|
hlsl_set_mvp,
|
||||||
NULL, /* hlsl_get_prev_textures */
|
NULL, /* hlsl_get_prev_textures */
|
||||||
hlsl_get_feedback_pass,
|
hlsl_get_feedback_pass,
|
||||||
|
@ -88,7 +88,6 @@ const shader_backend_t shader_null_backend = {
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
|
||||||
shader_null_get_prev_textures,
|
shader_null_get_prev_textures,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2473,6 +2473,7 @@ static void video_shader_driver_use_null(void *data,
|
|||||||
(void)set_active;
|
(void)set_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static bool video_driver_cb_set_coords(void *handle_data,
|
static bool video_driver_cb_set_coords(void *handle_data,
|
||||||
void *shader_data, const struct video_coords *coords)
|
void *shader_data, const struct video_coords *coords)
|
||||||
{
|
{
|
||||||
@ -2480,16 +2481,34 @@ static bool video_driver_cb_set_coords(void *handle_data,
|
|||||||
coords);
|
coords);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
bool video_driver_set_coords_fallback(void *handle_data,
|
||||||
static bool video_driver_cb_set_coords_fallback(void *handle_data,
|
|
||||||
void *shader_data, const struct video_coords *coords)
|
void *shader_data, const struct video_coords *coords)
|
||||||
{
|
{
|
||||||
current_shader->set_coords_fallback(handle_data, shader_data,
|
#ifdef HAVE_OPENGL
|
||||||
coords);
|
#ifndef NO_GL_FF_VERTEX
|
||||||
return true;
|
const char *video_ident = (current_video) ? current_video->ident : NULL;
|
||||||
}
|
if (string_is_equal_fast(video_ident, "gl", 2))
|
||||||
|
{
|
||||||
|
/* Fall back to fixed function-style if needed and possible. */
|
||||||
|
glClientActiveTexture(GL_TEXTURE1);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord);
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glClientActiveTexture(GL_TEXTURE0);
|
||||||
|
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glColorPointer(4, GL_FLOAT, 0, coords->color);
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord);
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void video_driver_build_info(video_frame_info_t *video_info)
|
void video_driver_build_info(video_frame_info_t *video_info)
|
||||||
{
|
{
|
||||||
@ -2599,7 +2618,9 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
|||||||
video_info->cb_shader_use = video_driver_cb_shader_use;
|
video_info->cb_shader_use = video_driver_cb_shader_use;
|
||||||
video_info->cb_shader_set_mvp = video_driver_cb_shader_set_mvp;
|
video_info->cb_shader_set_mvp = video_driver_cb_shader_set_mvp;
|
||||||
|
|
||||||
|
#if 0
|
||||||
video_info->cb_set_coords = video_driver_cb_set_coords;
|
video_info->cb_set_coords = video_driver_cb_set_coords;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
video_driver_threaded_unlock(is_threaded);
|
video_driver_threaded_unlock(is_threaded);
|
||||||
@ -3239,23 +3260,6 @@ static bool video_shader_driver_set_mvp_null_gl(void *data,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool video_shader_driver_set_coords_null(void *handle_data,
|
|
||||||
void *shader_data, const struct video_coords *coords)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
|
||||||
#ifndef NO_GL_FF_VERTEX
|
|
||||||
static bool video_shader_driver_set_coords_null_gl(void *handle_data,
|
|
||||||
void *shader_data, const struct video_coords *coords)
|
|
||||||
{
|
|
||||||
gl_ff_vertex(coords);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct video_shader *video_shader_driver_get_current_shader_null(void *data)
|
static struct video_shader *video_shader_driver_get_current_shader_null(void *data)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -3329,16 +3333,8 @@ static void video_shader_driver_reset_to_defaults(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!current_shader->set_coords)
|
if (!current_shader->set_coords)
|
||||||
{
|
current_shader->set_coords = video_driver_set_coords_fallback;
|
||||||
#ifdef HAVE_OPENGL
|
|
||||||
#ifndef NO_GL_FF_VERTEX
|
|
||||||
if (string_is_equal_fast(video_driver_get_ident(), "gl", 2))
|
|
||||||
current_shader->set_coords = video_shader_driver_set_coords_null_gl;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
current_shader->set_coords = video_shader_driver_set_coords_null;
|
|
||||||
}
|
|
||||||
if (current_shader->use)
|
if (current_shader->use)
|
||||||
video_driver_cb_shader_use = current_shader->use;
|
video_driver_cb_shader_use = current_shader->use;
|
||||||
else
|
else
|
||||||
|
@ -233,8 +233,6 @@ typedef struct shader_backend
|
|||||||
unsigned index, struct gfx_fbo_scale *scale);
|
unsigned index, struct gfx_fbo_scale *scale);
|
||||||
bool (*set_coords)(void *handle_data,
|
bool (*set_coords)(void *handle_data,
|
||||||
void *shader_data, const struct video_coords *coords);
|
void *shader_data, const struct video_coords *coords);
|
||||||
bool (*set_coords_fallback)(void *handle_data,
|
|
||||||
void *shader_data, const struct video_coords *coords);
|
|
||||||
bool (*set_mvp)(void *data, void *shader_data,
|
bool (*set_mvp)(void *data, void *shader_data,
|
||||||
const math_matrix_4x4 *mat);
|
const math_matrix_4x4 *mat);
|
||||||
unsigned (*get_prev_textures)(void *data);
|
unsigned (*get_prev_textures)(void *data);
|
||||||
@ -468,8 +466,10 @@ typedef struct video_frame_info
|
|||||||
bool (*cb_set_resize)(void*, unsigned, unsigned);
|
bool (*cb_set_resize)(void*, unsigned, unsigned);
|
||||||
|
|
||||||
void (*cb_shader_use)(void *data, void *shader_data, unsigned index, bool set_active);
|
void (*cb_shader_use)(void *data, void *shader_data, unsigned index, bool set_active);
|
||||||
|
#if 0
|
||||||
bool (*cb_set_coords)(void *handle_data,
|
bool (*cb_set_coords)(void *handle_data,
|
||||||
void *shader_data, const struct video_coords *coords);
|
void *shader_data, const struct video_coords *coords);
|
||||||
|
#endif
|
||||||
bool (*cb_shader_set_mvp)(void *data, void *shader_data,
|
bool (*cb_shader_set_mvp)(void *data, void *shader_data,
|
||||||
const math_matrix_4x4 *mat);
|
const math_matrix_4x4 *mat);
|
||||||
|
|
||||||
@ -1276,8 +1276,8 @@ bool video_shader_driver_get_feedback_pass(unsigned *data);
|
|||||||
bool video_shader_driver_mipmap_input(unsigned *index);
|
bool video_shader_driver_mipmap_input(unsigned *index);
|
||||||
|
|
||||||
#define video_shader_driver_set_coords(coords) \
|
#define video_shader_driver_set_coords(coords) \
|
||||||
if (!current_shader->set_coords(coords.handle_data, shader_data, (const struct video_coords*)coords.data) && current_shader->set_coords_fallback) \
|
if (!current_shader->set_coords(coords.handle_data, shader_data, (const struct video_coords*)coords.data)) \
|
||||||
current_shader->set_coords_fallback(coords.handle_data, shader_data, (const struct video_coords*)coords.data)
|
video_driver_set_coords_fallback(coords.handle_data, shader_data, (const struct video_coords*)coords.data)
|
||||||
|
|
||||||
bool video_shader_driver_scale(video_shader_ctx_scale_t *scaler);
|
bool video_shader_driver_scale(video_shader_ctx_scale_t *scaler);
|
||||||
|
|
||||||
@ -1304,6 +1304,9 @@ bool renderchain_gl_init_first(
|
|||||||
const gl_renderchain_driver_t **renderchain_driver,
|
const gl_renderchain_driver_t **renderchain_driver,
|
||||||
void **renderchain_handle);
|
void **renderchain_handle);
|
||||||
|
|
||||||
|
bool video_driver_set_coords_fallback(void *handle_data,
|
||||||
|
void *shader_data, const struct video_coords *coords);
|
||||||
|
|
||||||
extern bool (*video_driver_cb_has_focus)(void);
|
extern bool (*video_driver_cb_has_focus)(void);
|
||||||
|
|
||||||
extern shader_backend_t *current_shader;
|
extern shader_backend_t *current_shader;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user