summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-08-18 02:31:58 +0200
committerMartin Herkt <652892+lachs0r@users.noreply.github.com>2017-12-25 00:47:53 +0100
commita3c9685257e60e32646bb54a895ef7574a945f69 (patch)
tree03d351a787997037631fc7b6e3576a67707b0b7b /video
parent6186cc79e6b95a52f5d2ec6075416cbc58c7539f (diff)
downloadmpv-a3c9685257e60e32646bb54a895ef7574a945f69.tar.bz2
mpv-a3c9685257e60e32646bb54a895ef7574a945f69.tar.xz
vo_gpu: invalidate fbotex before drawing
Don't discard the OSD or pass_draw_to_screen passes though. Could be faster on some hardware.
Diffstat (limited to 'video')
-rw-r--r--video/out/gpu/osd.c2
-rw-r--r--video/out/gpu/shader_cache.c3
-rw-r--r--video/out/gpu/shader_cache.h2
-rw-r--r--video/out/gpu/video.c14
4 files changed, 11 insertions, 10 deletions
diff --git a/video/out/gpu/osd.c b/video/out/gpu/osd.c
index 317deb6e4d..75f69f0c9b 100644
--- a/video/out/gpu/osd.c
+++ b/video/out/gpu/osd.c
@@ -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);
}
diff --git a/video/out/gpu/shader_cache.c b/video/out/gpu/shader_cache.c
index 6d0f370568..780bf7f5d7 100644
--- a/video/out/gpu/shader_cache.c
+++ b/video/out/gpu/shader_cache.c
@@ -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)
diff --git a/video/out/gpu/shader_cache.h b/video/out/gpu/shader_cache.h
index 2fe7dcfb9d..547c6b6307 100644
--- a/video/out/gpu/shader_cache.h
+++ b/video/out/gpu/shader_cache.h
@@ -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);
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index f80d63a8b1..3f0959931d 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -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;
}