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 angle_conf;
|
||||||
extern const struct m_sub_options macos_conf;
|
extern const struct m_sub_options macos_conf;
|
||||||
extern const struct m_sub_options wayland_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;
|
extern const struct m_sub_options vaapi_conf;
|
||||||
|
|
||||||
static const struct m_sub_options screenshot_conf = {
|
static const struct m_sub_options screenshot_conf = {
|
||||||
|
@ -840,8 +841,7 @@ static const m_option_t mp_opts[] = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_GL_WIN32
|
#if HAVE_GL_WIN32
|
||||||
{"opengl-dwmflush", OPT_CHOICE(wingl_dwm_flush,
|
{"", OPT_SUBSTRUCT(wingl_opts, wingl_conf)},
|
||||||
{"no", -1}, {"auto", 0}, {"windowed", 1}, {"yes", 2})},
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_CUDA_HWACCEL
|
#if HAVE_CUDA_HWACCEL
|
||||||
|
|
|
@ -350,8 +350,6 @@ typedef struct MPOpts {
|
||||||
char *ipc_path;
|
char *ipc_path;
|
||||||
char *ipc_client;
|
char *ipc_client;
|
||||||
|
|
||||||
int wingl_dwm_flush;
|
|
||||||
|
|
||||||
struct mp_resample_opts *resample_opts;
|
struct mp_resample_opts *resample_opts;
|
||||||
|
|
||||||
struct ra_ctx_opts *ra_ctx_opts;
|
struct ra_ctx_opts *ra_ctx_opts;
|
||||||
|
@ -366,6 +364,7 @@ typedef struct MPOpts {
|
||||||
struct macos_opts *macos_opts;
|
struct macos_opts *macos_opts;
|
||||||
struct drm_opts *drm_opts;
|
struct drm_opts *drm_opts;
|
||||||
struct wayland_opts *wayland_opts;
|
struct wayland_opts *wayland_opts;
|
||||||
|
struct wingl_opts *wingl_opts;
|
||||||
struct dvd_opts *dvd_opts;
|
struct dvd_opts *dvd_opts;
|
||||||
struct vaapi_opts *vaapi_opts;
|
struct vaapi_opts *vaapi_opts;
|
||||||
struct sws_opts *sws_opts;
|
struct sws_opts *sws_opts;
|
||||||
|
|
|
@ -37,6 +37,20 @@
|
||||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||||
#endif
|
#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 {
|
struct priv {
|
||||||
GL gl;
|
GL gl;
|
||||||
|
|
||||||
|
@ -44,6 +58,8 @@ struct priv {
|
||||||
int current_swapinterval;
|
int current_swapinterval;
|
||||||
|
|
||||||
int (GLAPIENTRY *real_wglSwapInterval)(int);
|
int (GLAPIENTRY *real_wglSwapInterval)(int);
|
||||||
|
struct m_config_cache *opts_cache;
|
||||||
|
struct wingl_opts *opts;
|
||||||
|
|
||||||
HGLRC context;
|
HGLRC context;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
|
@ -247,14 +263,10 @@ static void wgl_swap_buffers(struct ra_ctx *ctx)
|
||||||
// default if we don't DwmFLush
|
// default if we don't DwmFLush
|
||||||
int new_swapinterval = p->opt_swapinterval;
|
int new_swapinterval = p->opt_swapinterval;
|
||||||
|
|
||||||
int dwm_flush_opt;
|
if (p->opts->wingl_dwm_flush >= 0) {
|
||||||
mp_read_option_raw(ctx->global, "opengl-dwmflush", &m_option_type_choice,
|
if ((p->opts->wingl_dwm_flush == 1 && !ctx->vo->opts->fullscreen) ||
|
||||||
&dwm_flush_opt);
|
(p->opts->wingl_dwm_flush == 2) ||
|
||||||
|
(p->opts->wingl_dwm_flush == 0 && compositor_active(ctx)))
|
||||||
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 (DwmFlush() == S_OK)
|
if (DwmFlush() == S_OK)
|
||||||
new_swapinterval = 0;
|
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);
|
struct priv *p = ctx->priv = talloc_zero(ctx, struct priv);
|
||||||
GL *gl = &p->gl;
|
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))
|
if (!vo_w32_init(ctx->vo))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue