From 67fd5882b86bc544e27a9cb0b188d63bdb950623 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 28 Sep 2017 00:07:42 +0200 Subject: 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. --- video/out/gpu/osd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'video/out/gpu/osd.c') 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) -- cgit v1.2.3