vo_gpu: invalidate fbotex before drawing

Don't discard the OSD or pass_draw_to_screen passes though. Could be
faster on some hardware.
This commit is contained in:
Niklas Haas 2017-08-18 02:31:58 +02:00 committed by Martin Herkt
parent 6186cc79e6
commit a3c9685257
4 changed files with 11 additions and 10 deletions

View File

@ -314,7 +314,7 @@ void mpgl_osd_draw_finish(struct mpgl_osd *ctx, int index,
const int *factors = &blend_factors[part->format][0];
gl_sc_blend(sc, factors[0], factors[1], factors[2], factors[3]);
gl_sc_dispatch_draw(sc, fbo.tex, vertex_vao, MP_ARRAY_SIZE(vertex_vao),
gl_sc_dispatch_draw(sc, fbo.tex, false, vertex_vao, MP_ARRAY_SIZE(vertex_vao),
sizeof(struct vertex), part->vertices, part->num_vertices);
}

View File

@ -965,13 +965,14 @@ static void gl_sc_generate(struct gl_shader_cache *sc,
}
struct mp_pass_perf gl_sc_dispatch_draw(struct gl_shader_cache *sc,
struct ra_tex *target,
struct ra_tex *target, bool discard,
const struct ra_renderpass_input *vao,
int vao_len, size_t vertex_stride,
void *vertices, size_t num_vertices)
{
struct timer_pool *timer = NULL;
sc->params.invalidate_target = discard;
gl_sc_generate(sc, RA_RENDERPASS_TYPE_RASTER, target->params.format,
vao, vao_len, vertex_stride);
if (!sc->current_shader)

View File

@ -50,7 +50,7 @@ void gl_sc_blend(struct gl_shader_cache *sc,
enum ra_blend blend_dst_alpha);
void gl_sc_enable_extension(struct gl_shader_cache *sc, char *name);
struct mp_pass_perf gl_sc_dispatch_draw(struct gl_shader_cache *sc,
struct ra_tex *target,
struct ra_tex *target, bool discard,
const struct ra_renderpass_input *vao,
int vao_len, size_t vertex_stride,
void *ptr, size_t num);

View File

@ -1153,7 +1153,7 @@ static void dispatch_compute(struct gl_video *p, int w, int h,
}
static struct mp_pass_perf render_pass_quad(struct gl_video *p,
struct ra_fbo fbo,
struct ra_fbo fbo, bool discard,
const struct mp_rect *dst)
{
// The first element is reserved for `vec2 position`
@ -1211,15 +1211,15 @@ static struct mp_pass_perf render_pass_quad(struct gl_video *p,
&p->tmp_vertex[num_vertex_attribs * 1],
vertex_stride);
return gl_sc_dispatch_draw(p->sc, fbo.tex, p->vao, num_vertex_attribs,
return gl_sc_dispatch_draw(p->sc, fbo.tex, discard, p->vao, num_vertex_attribs,
vertex_stride, p->tmp_vertex, num_vertices);
}
static void finish_pass_fbo(struct gl_video *p, struct ra_fbo fbo,
const struct mp_rect *dst)
bool discard, const struct mp_rect *dst)
{
pass_prepare_src_tex(p);
pass_record(p, render_pass_quad(p, fbo, dst));
pass_record(p, render_pass_quad(p, fbo, discard, dst));
debug_check_gl(p, "after rendering");
cleanup_binds(p);
}
@ -1248,7 +1248,7 @@ static void finish_pass_tex(struct gl_video *p, struct ra_tex **dst_tex,
debug_check_gl(p, "after dispatching compute shader");
} else {
struct ra_fbo fbo = { .tex = *dst_tex, };
finish_pass_fbo(p, fbo, &(struct mp_rect){0, 0, w, h});
finish_pass_fbo(p, fbo, true, &(struct mp_rect){0, 0, w, h});
}
}
@ -2799,7 +2799,7 @@ static void pass_draw_to_screen(struct gl_video *p, struct ra_fbo fbo)
pass_dither(p);
pass_describe(p, "output to screen");
finish_pass_fbo(p, fbo, &p->dst_rect);
finish_pass_fbo(p, fbo, false, &p->dst_rect);
}
static bool update_surface(struct gl_video *p, struct mp_image *mpi,
@ -3205,7 +3205,7 @@ static void reinterleave_vdpau(struct gl_video *p,
const struct ra_format *fmt = ra_find_unorm_format(p->ra, 1, comps);
ra_tex_resize(p->ra, p->log, tex, w, h * 2, fmt);
struct ra_fbo fbo = { *tex };
finish_pass_fbo(p, fbo, &(struct mp_rect){0, 0, w, h * 2});
finish_pass_fbo(p, fbo, true, &(struct mp_rect){0, 0, w, h * 2});
output[n] = *tex;
}