summaryrefslogtreecommitdiffstats
path: root/video/out/gpu/osd.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-09-28 00:07:42 +0200
committerNiklas Haas <git@haasn.xyz>2017-09-28 01:54:38 +0200
commit67fd5882b86bc544e27a9cb0b188d63bdb950623 (patch)
tree7b0cd41803e8432cf2a5124c85cdf96cf73382a9 /video/out/gpu/osd.c
parent002a0ce23200c7044ce744555223e4b884350436 (diff)
downloadmpv-67fd5882b86bc544e27a9cb0b188d63bdb950623.tar.bz2
mpv-67fd5882b86bc544e27a9cb0b188d63bdb950623.tar.xz
vo_gpu: make the vertex attribs dynamic
This has several advantages: 1. no more redundant texcoords when we don't need them 2. no more arbitrary limit on how many textures we can bind 3. (that extends to user shaders as well) 4. no more arbitrary limits on tscale radius To realize this, the VAO was moved from a hacky stateful approach (gl_sc_set_vertex_attribs) - which always bothered me since it was required for compute shaders as well even though they ignored it - to be a proper parameter of gl_sc_dispatch_draw, and internally plumbed into gl_sc_generate, which will make a (properly mangled) deep copy into params.vertex_attribs.
Diffstat (limited to 'video/out/gpu/osd.c')
-rw-r--r--video/out/gpu/osd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/video/out/gpu/osd.c b/video/out/gpu/osd.c
index 350736461c..b7cbfa597a 100644
--- a/video/out/gpu/osd.c
+++ b/video/out/gpu/osd.c
@@ -47,7 +47,6 @@ static const struct ra_renderpass_input vertex_vao[] = {
{"position", RA_VARTYPE_FLOAT, 2, 1, offsetof(struct vertex, position)},
{"texcoord" , RA_VARTYPE_FLOAT, 2, 1, offsetof(struct vertex, texcoord)},
{"ass_color", RA_VARTYPE_BYTE_UNORM, 4, 1, offsetof(struct vertex, ass_color)},
- {0}
};
struct mpgl_osd_part {
@@ -231,8 +230,6 @@ bool mpgl_osd_draw_prepare(struct mpgl_osd *ctx, int index,
abort();
}
- gl_sc_set_vertex_format(sc, vertex_vao, sizeof(struct vertex));
-
return true;
}
@@ -317,7 +314,8 @@ 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, part->vertices, part->num_vertices);
+ gl_sc_dispatch_draw(sc, fbo.tex, vertex_vao, MP_ARRAY_SIZE(vertex_vao),
+ sizeof(struct vertex), part->vertices, part->num_vertices);
}
static void set_res(struct mpgl_osd *ctx, struct mp_osd_res res, int stereo_mode)