Revert "Reimplement video_driver_set_coords"

This reverts commit 93ded925d371253542ae9595dc0b57c8bb53591e.
This commit is contained in:
twinaphex 2019-02-03 19:40:21 +01:00
parent 43884758c5
commit 5a45464bb3
3 changed files with 51 additions and 25 deletions

View File

@ -547,6 +547,7 @@ static void gl2_renderchain_render(
const struct video_tex_info *feedback_info)
{
int i;
video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params;
static GLfloat fbo_tex_coords[8] = {0.0f};
struct video_tex_info fbo_tex_info[GFX_MAX_SHADERS];
@ -625,9 +626,10 @@ static void gl2_renderchain_render(
gl->coords.vertices = 4;
if (gl->shader->set_coords)
gl->shader->set_coords(gl, gl->shader_data,
(const struct video_coords*)&gl->coords);
coords.handle_data = NULL;
coords.data = &gl->coords;
video_driver_set_coords(&coords);
video_info->cb_set_mvp(gl,
video_info->shader_data, &gl->mvp);
@ -700,9 +702,10 @@ static void gl2_renderchain_render(
gl->coords.vertices = 4;
if (gl->shader->set_coords)
gl->shader->set_coords(gl, gl->shader_data,
(const struct video_coords*)&gl->coords);
coords.handle_data = NULL;
coords.data = &gl->coords;
video_driver_set_coords(&coords);
video_info->cb_set_mvp(gl,
video_info->shader_data, &gl->mvp);
@ -1953,6 +1956,7 @@ static void gl_overlay_tex_geom(void *data,
static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
{
video_shader_ctx_coords_t coords;
unsigned i;
unsigned width = video_info->width;
unsigned height = video_info->height;
@ -1972,9 +1976,10 @@ static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
gl->coords.color = gl->overlay_color_coord;
gl->coords.vertices = 4 * gl->overlays;
if (gl->shader->set_coords)
gl->shader->set_coords(gl, gl->shader_data,
(const struct video_coords*)&gl->coords);
coords.handle_data = NULL;
coords.data = &gl->coords;
video_driver_set_coords(&coords);
video_info->cb_set_mvp(gl,
video_info->shader_data, &gl->mvp_no_rot);
@ -2289,6 +2294,7 @@ static void gl_render_osd_background(
gl_t *gl, video_frame_info_t *video_info,
const char *msg)
{
video_shader_ctx_coords_t coords_data;
video_coords_t coords;
struct uniform_info uniform_param;
float colors[4];
@ -2346,6 +2352,9 @@ static void gl_render_osd_background(
coords.lut_tex_coord = dummy;
coords.vertices = vertices_total;
coords_data.handle_data = NULL;
coords_data.data = &coords;
video_driver_set_viewport(video_info->width,
video_info->height, true, false);
@ -2353,9 +2362,7 @@ static void gl_render_osd_background(
video_info->shader_driver->use(gl,
video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true);
if (gl->shader->set_coords)
gl->shader->set_coords(gl, gl->shader_data,
(const struct video_coords*)&coords);
video_driver_set_coords(&coords_data);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -2429,6 +2436,7 @@ static struct video_shader *gl_get_current_shader(void *data)
#if defined(HAVE_MENU)
static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
{
video_shader_ctx_coords_t coords;
GLfloat color[16];
unsigned width = video_info->width;
unsigned height = video_info->height;
@ -2462,9 +2470,10 @@ static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
gl->coords.vertices = 4;
if (gl->shader->set_coords)
gl->shader->set_coords(gl, gl->shader_data,
(const struct video_coords*)&gl->coords);
coords.handle_data = NULL;
coords.data = &gl->coords;
video_driver_set_coords(&coords);
video_info->cb_set_mvp(gl,
video_info->shader_data, &gl->mvp_no_rot);
@ -2517,6 +2526,7 @@ static bool gl_frame(void *data, const void *frame,
unsigned pitch, const char *msg,
video_frame_info_t *video_info)
{
video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params;
struct video_tex_info feedback_info;
gl_t *gl = (gl_t*)data;
@ -2663,10 +2673,10 @@ static bool gl_frame(void *data, const void *frame,
gl->shader->set_params(&params, gl->shader_data);
gl->coords.vertices = 4;
coords.handle_data = NULL;
coords.data = &gl->coords;
if (gl->shader->set_coords)
gl->shader->set_coords(gl, gl->shader_data,
(const struct video_coords*)&gl->coords);
video_driver_set_coords(&coords);
video_info->cb_set_mvp(gl, video_info->shader_data, &gl->mvp);
@ -4069,10 +4079,6 @@ static void gl_unload_texture(void *data, uintptr_t id)
static void gl_set_coords(void *handle_data, void *shader_data,
const struct video_coords *coords)
{
gl_t *gl = (gl_t*)handle_data;
if (gl->shader && gl->shader->set_coords)
gl->shader->set_coords(gl, gl->shader_data, coords);
}
static float gl_get_refresh_rate(void *data)

View File

@ -257,7 +257,7 @@ static void gl_raster_font_draw_vertices(gl_raster_t *font,
font->atlas->dirty = false;
}
coords_data.handle_data = font->gl;
coords_data.handle_data = NULL;
coords_data.data = coords;
video_driver_set_coords(&coords_data);

View File

@ -2737,6 +2737,17 @@ bool video_driver_texture_unload(uintptr_t *id)
return true;
}
static bool video_driver_cb_set_coords(void *handle_data,
void *shader_data, const struct video_coords *coords)
{
video_shader_ctx_coords_t ctx_coords;
ctx_coords.handle_data = handle_data;
ctx_coords.data = coords;
video_driver_set_coords(&ctx_coords);
return true;
}
void video_driver_build_info(video_frame_info_t *video_info)
{
bool is_perfcnt_enable = false;
@ -3503,6 +3514,8 @@ static void video_shader_driver_reset_to_defaults(void)
current_shader->set_mvp = video_driver_cb_set_mvp;
video_driver_cb_shader_set_mvp = video_driver_cb_set_mvp;
}
if (!current_shader->set_coords)
current_shader->set_coords = video_driver_cb_set_coords;
}
/* Finds first suitable shader context driver. */
@ -3551,10 +3564,17 @@ bool video_shader_driver_init(video_shader_ctx_init_t *init)
void video_driver_set_coords(video_shader_ctx_coords_t *coords)
{
if (video_driver_poke && video_driver_poke->set_coords)
video_driver_poke->set_coords(coords->handle_data,
if (current_shader && current_shader->set_coords)
current_shader->set_coords(coords->handle_data,
current_shader_data,
(const struct video_coords*)coords->data);
else
{
if (video_driver_poke && video_driver_poke->set_coords)
video_driver_poke->set_coords(coords->handle_data,
current_shader_data,
(const struct video_coords*)coords->data);
}
}
void video_driver_set_mvp(video_shader_ctx_mvp_t *mvp)