diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 204b8a8c70..56a56cb1ae 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1214,12 +1214,17 @@ void gl_video_set_lut3d(struct gl_video *p, struct lut3d *lut3d) { GL *gl = p->gl; - assert(!p->lut_3d_texture); - - if (!lut3d) + if (!lut3d) { + if (p->use_lut_3d) { + p->use_lut_3d = false; + reinit_rendering(p); + } return; + } + + if (!p->lut_3d_texture) + gl->GenTextures(1, &p->lut_3d_texture); - gl->GenTextures(1, &p->lut_3d_texture); gl->ActiveTexture(GL_TEXTURE0 + TEXUNIT_3DLUT); gl->BindTexture(GL_TEXTURE_3D, p->lut_3d_texture); gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4); @@ -1237,6 +1242,8 @@ void gl_video_set_lut3d(struct gl_video *p, struct lut3d *lut3d) check_gl_features(p); debug_check_gl(p, "after 3d lut creation"); + + reinit_rendering(p); } static void set_image_textures(struct gl_video *p, struct video_image *vimg, diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index 8fea170a55..8e117a48b6 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -262,27 +262,47 @@ static void unload_hwdec_driver(struct gl_priv *p) } } +static bool update_icc_profile(struct gl_priv *p, struct mp_icc_opts *opts) +{ + struct lut3d *lut3d = NULL; + if (opts->profile) { + lut3d = mp_load_icc(opts, p->vo->log, p->vo->global); + if (!lut3d) + return false; + } + gl_video_set_lut3d(p->renderer, lut3d); + talloc_free(lut3d); + return true; +} + static bool reparse_cmdline(struct gl_priv *p, char *args) { struct m_config *cfg = NULL; - struct gl_video_opts *opts = NULL; + struct gl_priv *opts = NULL; int r = 0; + // list of options which can be changed at runtime +#define OPT_BASE_STRUCT struct gl_priv + static const struct m_option change_otps[] = { + OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0), + OPT_SUBSTRUCT("", icc_opts, mp_icc_conf, 0), + {0} + }; +#undef OPT_BASE_STRUCT + if (strcmp(args, "-") == 0) { - opts = p->renderer_opts; + opts = p; } else { const struct gl_priv *vodef = p->vo->driver->priv_defaults; - const struct gl_video_opts *def = - vodef ? vodef->renderer_opts : gl_video_conf.defaults; - cfg = m_config_new(NULL, p->vo->log, sizeof(*opts), def, - gl_video_conf.opts); + cfg = m_config_new(NULL, p->vo->log, sizeof(*opts), vodef, change_otps); opts = cfg->optstruct; r = m_config_parse_suboptions(cfg, "opengl", args); } if (r >= 0) { mpgl_lock(p->glctx); - gl_video_set_options(p->renderer, opts); + gl_video_set_options(p->renderer, opts->renderer_opts); + update_icc_profile(p, opts->icc_opts); resize(p); mpgl_unlock(p->glctx); } @@ -396,14 +416,8 @@ static int preinit(struct vo *vo) gl_video_set_output_depth(p->renderer, p->glctx->depth_r, p->glctx->depth_g, p->glctx->depth_b); gl_video_set_options(p->renderer, p->renderer_opts); - - if (p->icc_opts->profile) { - struct lut3d *lut3d = mp_load_icc(p->icc_opts, vo->log, vo->global); - if (!lut3d) - goto err_out; - gl_video_set_lut3d(p->renderer, lut3d); - talloc_free(lut3d); - } + if (!update_icc_profile(p, p->icc_opts)) + goto err_out; mpgl_unset_context(p->glctx);