summaryrefslogtreecommitdiffstats
path: root/video/out/gpu/video.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-09-17 10:55:43 +0200
committerNiklas Haas <git@haasn.xyz>2017-09-26 17:25:35 +0200
commit47af509e1fad3e9ce30e3e339d8cd705fcd44ef2 (patch)
tree0f0ac7f905efe2a3efdfe4e0b38cae15d0be8eda /video/out/gpu/video.c
parentca85a153b4a201c7f6d600f861639ef68c1edfa3 (diff)
downloadmpv-47af509e1fad3e9ce30e3e339d8cd705fcd44ef2.tar.bz2
mpv-47af509e1fad3e9ce30e3e339d8cd705fcd44ef2.tar.xz
vo_gpu: attempt to avoid UBOs for dynamic variables
This makes the radeon driver shut up about frequently updating STATIC_DRAW UBOs (--opengl-debug), and also reduces the amount of synchronization necessary for vulkan uniform buffers. Also add some extra debugging/tracing code paths. I went with a flags-based approach in case we ever want to extend this.
Diffstat (limited to 'video/out/gpu/video.c')
-rw-r--r--video/out/gpu/video.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 4cc6114c52..dd3ad709cc 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -1500,7 +1500,9 @@ found:
static void load_shader(struct gl_video *p, struct bstr body)
{
gl_sc_hadd_bstr(p->sc, body);
+ gl_sc_uniform_dynamic(p->sc);
gl_sc_uniform_f(p->sc, "random", (double)av_lfg_get(&p->lfg) / UINT32_MAX);
+ gl_sc_uniform_dynamic(p->sc);
gl_sc_uniform_i(p->sc, "frame", p->frames_uploaded);
gl_sc_uniform_vec2(p->sc, "input_size",
(float[]){(p->src_rect.x1 - p->src_rect.x0) *
@@ -2579,6 +2581,7 @@ static void pass_dither(struct gl_video *p)
float matrix[2][2] = {{cos(r), -sin(r) },
{sin(r) * m, cos(r) * m}};
+ gl_sc_uniform_dynamic(p->sc);
gl_sc_uniform_mat2(p->sc, "dither_trafo", true, &matrix[0][0]);
GLSL(dither_pos = dither_trafo * dither_pos;)
@@ -2957,11 +2960,13 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t,
// Blend the frames together
if (oversample || linear) {
+ gl_sc_uniform_dynamic(p->sc);
gl_sc_uniform_f(p->sc, "inter_coeff", mix);
GLSL(color = mix(texture(texture0, texcoord0),
texture(texture1, texcoord1),
inter_coeff);)
} else {
+ gl_sc_uniform_dynamic(p->sc);
gl_sc_uniform_f(p->sc, "fcoord", mix);
pass_sample_separated_gen(p->sc, tscale, 0, 0);
}