summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-08-03 16:08:18 +0200
committerwm4 <wm4@nowhere>2017-08-03 16:19:49 +0200
commitffe0526064309bda2b24c1503e1b43316b33e6d7 (patch)
treeefb8f963a40f35b9d77c96eb2d66a936cad837a9 /video/out/opengl/video.c
parent7ec8bd168e9347b00de5b10e87854ddf60b61071 (diff)
downloadmpv-ffe0526064309bda2b24c1503e1b43316b33e6d7.tar.bz2
mpv-ffe0526064309bda2b24c1503e1b43316b33e6d7.tar.xz
vo_opengl: simplify/fix user shader textures
This broke float textures, which were actually used by some shaders. There were probably some other bugs as well. Lots of code can be avoided by using ra_tex_params directly, so do that. The main change is that COMPONENT/FORMAT are replaced by a single FORMAT directive, which takes different parameters now. Due to the mess with 16/32 bit float textures, and because we want to support other APIs than just GL in the future, it's not really clear how this should be handled, and the nice component/type separation makes things actually harder. So just jump the gun and use the ra_format.name names, which were originally meant mostly for debugging. (This is probably something that will be regretted later.) Still only superficially tested, but seems to work. Fixes #4708.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r--video/out/opengl/video.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 0cd7ef3688..b6be230b53 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -1973,34 +1973,14 @@ static bool add_user_tex(void *priv, struct gl_user_shader_tex tex)
goto err;
}
- const struct ra_format *format = ra_find_unorm_format(p->ra, tex.components,
- tex.bytes);
-
- if (!format) {
- MP_ERR(p, "Could not satisfy format requirements for user "
- "shader texture '%.*s'!\n", BSTR_P(tex.name));
- goto err;
- }
-
- struct ra_tex_params params = {
- .dimensions = tex.dimensions,
- .w = tex.w,
- .h = tex.h,
- .d = tex.d,
- .format = format,
- .render_src = true,
- .src_linear = tex.filter,
- .src_repeat = tex.border,
- .initial_data = tex.texdata,
- };
- tex.tex = ra_tex_create(p->ra, &params);
- talloc_free(tex.texdata);
+ tex.tex = ra_tex_create(p->ra, &tex.params);
+ TA_FREEP(&tex.params.initial_data);
p->user_textures[p->user_tex_num++] = tex;
return true;
err:
- talloc_free(tex.texdata);
+ talloc_free(tex.params.initial_data);
return false;
}
@@ -2011,7 +1991,7 @@ static void load_user_shaders(struct gl_video *p, char **shaders)
for (int n = 0; shaders[n] != NULL; n++) {
struct bstr file = load_cached_file(p, shaders[n]);
- parse_user_shader(p->log, file, p, add_user_hook, add_user_tex);
+ parse_user_shader(p->log, p->ra, file, p, add_user_hook, add_user_tex);
}
}