mirror of https://github.com/mpv-player/mpv
opengl/context_win: move opengl-dwmflush to wingl_opts group
Gets rid of yet another mp_read_option_raw call.
This commit is contained in:
parent
58ac0dd6db
commit
73ad9eef28
|
@ -95,6 +95,7 @@ extern const struct m_sub_options d3d11va_conf;
|
|||
extern const struct m_sub_options angle_conf;
|
||||
extern const struct m_sub_options macos_conf;
|
||||
extern const struct m_sub_options wayland_conf;
|
||||
extern const struct m_sub_options wingl_conf;
|
||||
extern const struct m_sub_options vaapi_conf;
|
||||
|
||||
static const struct m_sub_options screenshot_conf = {
|
||||
|
@ -840,8 +841,7 @@ static const m_option_t mp_opts[] = {
|
|||
#endif
|
||||
|
||||
#if HAVE_GL_WIN32
|
||||
{"opengl-dwmflush", OPT_CHOICE(wingl_dwm_flush,
|
||||
{"no", -1}, {"auto", 0}, {"windowed", 1}, {"yes", 2})},
|
||||
{"", OPT_SUBSTRUCT(wingl_opts, wingl_conf)},
|
||||
#endif
|
||||
|
||||
#if HAVE_CUDA_HWACCEL
|
||||
|
|
|
@ -350,8 +350,6 @@ typedef struct MPOpts {
|
|||
char *ipc_path;
|
||||
char *ipc_client;
|
||||
|
||||
int wingl_dwm_flush;
|
||||
|
||||
struct mp_resample_opts *resample_opts;
|
||||
|
||||
struct ra_ctx_opts *ra_ctx_opts;
|
||||
|
@ -366,6 +364,7 @@ typedef struct MPOpts {
|
|||
struct macos_opts *macos_opts;
|
||||
struct drm_opts *drm_opts;
|
||||
struct wayland_opts *wayland_opts;
|
||||
struct wingl_opts *wingl_opts;
|
||||
struct dvd_opts *dvd_opts;
|
||||
struct vaapi_opts *vaapi_opts;
|
||||
struct sws_opts *sws_opts;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue