summaryrefslogtreecommitdiffstats
path: root/video/out/vo_gpu.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2024-02-22 12:29:13 -0600
committerDudemanguy <random342@airmail.cc>2024-02-26 16:46:00 +0000
commitb7fd232524bc213df91fa77ca0261ff514fad1e4 (patch)
tree9f29421024ae33f320dfe5d480633d57337184aa /video/out/vo_gpu.c
parentbbbc0e248b9a2ec1d4643df98c71516a4d3e0881 (diff)
downloadmpv-b7fd232524bc213df91fa77ca0261ff514fad1e4.tar.bz2
mpv-b7fd232524bc213df91fa77ca0261ff514fad1e4.tar.xz
vo_gpu/vo_gpu_next: set ctx->opts.want_alpha in specific functions
Currently this was being duplicated on init and on runtime updates between both VOs. Since the conditions for setting this will get more complicated in the future commits, it's better to just handle it in one place. We could combine the vo_gpu and vo_gpu_next handling into one single function but vo_gpu_next has an additional condition for determining alpha that vo_gpu_does not, so we'll leave these separate for simplicity. Also this technically fixes a memory leak where gl_opts weren't being freed.
Diffstat (limited to 'video/out/vo_gpu.c')
-rw-r--r--video/out/vo_gpu.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c
index 584a86096b..ec70f45da9 100644
--- a/video/out/vo_gpu.c
+++ b/video/out/vo_gpu.c
@@ -172,10 +172,9 @@ static void get_and_update_ambient_lighting(struct gpu_priv *p)
static void update_ra_ctx_options(struct vo *vo)
{
struct gpu_priv *p = vo->priv;
-
- /* Only the alpha option has any runtime toggle ability. */
struct gl_video_opts *gl_opts = mp_get_config_group(p->ctx, vo->global, &gl_video_conf);
p->ctx->opts.want_alpha = gl_opts->alpha_mode == 1;
+ talloc_free(gl_opts);
}
static int control(struct vo *vo, uint32_t request, void *data)
@@ -285,16 +284,14 @@ static int preinit(struct vo *vo)
p->log = vo->log;
struct ra_ctx_opts *ctx_opts = mp_get_config_group(vo, vo->global, &ra_ctx_conf);
- struct gl_video_opts *gl_opts = mp_get_config_group(vo, vo->global, &gl_video_conf);
struct ra_ctx_opts opts = *ctx_opts;
- opts.want_alpha = gl_opts->alpha_mode == 1;
p->ctx = ra_ctx_create(vo, opts);
talloc_free(ctx_opts);
- talloc_free(gl_opts);
if (!p->ctx)
goto err_out;
assert(p->ctx->ra);
assert(p->ctx->swapchain);
+ update_ra_ctx_options(vo);
p->renderer = gl_video_init(p->ctx->ra, vo->log, vo->global);
gl_video_set_osd_source(p->renderer, vo->osd);