summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-09-19 17:26:21 -0500
committerDudemanguy <random342@airmail.cc>2023-09-22 14:20:38 +0000
commit73ad9eef2875247d38af99f4d8c804f2749a8588 (patch)
treed03d912b0ae85cbf99de2f893634e5f74a191aff /video
parent58ac0dd6db87c6cdabff79f1cfba575f15f3328d (diff)
downloadmpv-73ad9eef2875247d38af99f4d8c804f2749a8588.tar.bz2
mpv-73ad9eef2875247d38af99f4d8c804f2749a8588.tar.xz
opengl/context_win: move opengl-dwmflush to wingl_opts group
Gets rid of yet another mp_read_option_raw call.
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/context_win.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/video/out/opengl/context_win.c b/video/out/opengl/context_win.c
index 6bf04547ad..968b1763bf 100644
--- a/video/out/opengl/context_win.c
+++ b/video/out/opengl/context_win.c
@@ -37,6 +37,20 @@
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#endif
+struct wingl_opts {
+ int wingl_dwm_flush;
+};
+
+#define OPT_BASE_STRUCT struct wingl_opts
+const struct m_sub_options wingl_conf = {
+ .opts = (const struct m_option[]) {
+ {"opengl-dwmflush", OPT_CHOICE(wingl_dwm_flush,
+ {"no", -1}, {"auto", 0}, {"windowed", 1}, {"yes", 2})},
+ {0}
+ },
+ .size = sizeof(struct wingl_opts),
+};
+
struct priv {
GL gl;
@@ -44,6 +58,8 @@ struct priv {
int current_swapinterval;
int (GLAPIENTRY *real_wglSwapInterval)(int);
+ struct m_config_cache *opts_cache;
+ struct wingl_opts *opts;
HGLRC context;
HDC hdc;
@@ -247,14 +263,10 @@ static void wgl_swap_buffers(struct ra_ctx *ctx)
// default if we don't DwmFLush
int new_swapinterval = p->opt_swapinterval;
- int dwm_flush_opt;
- mp_read_option_raw(ctx->global, "opengl-dwmflush", &m_option_type_choice,
- &dwm_flush_opt);
-
- if (dwm_flush_opt >= 0) {
- if ((dwm_flush_opt == 1 && !ctx->vo->opts->fullscreen) ||
- (dwm_flush_opt == 2) ||
- (dwm_flush_opt == 0 && compositor_active(ctx)))
+ if (p->opts->wingl_dwm_flush >= 0) {
+ if ((p->opts->wingl_dwm_flush == 1 && !ctx->vo->opts->fullscreen) ||
+ (p->opts->wingl_dwm_flush == 2) ||
+ (p->opts->wingl_dwm_flush == 0 && compositor_active(ctx)))
{
if (DwmFlush() == S_OK)
new_swapinterval = 0;
@@ -275,6 +287,9 @@ static bool wgl_init(struct ra_ctx *ctx)
struct priv *p = ctx->priv = talloc_zero(ctx, struct priv);
GL *gl = &p->gl;
+ p->opts_cache = m_config_cache_alloc(ctx, ctx->global, &wingl_conf);
+ p->opts = p->opts_cache->opts;
+
if (!vo_w32_init(ctx->vo))
goto fail;