diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/out/gl_w32.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/video/out/gl_w32.c b/video/out/gl_w32.c index 9d704bcca6..13a46a295d 100644 --- a/video/out/gl_w32.c +++ b/video/out/gl_w32.c @@ -34,7 +34,8 @@ static bool create_dc(struct MPGLContext *ctx, int flags) struct w32_context *w32_ctx = ctx->priv; HWND win = vo_w32_hwnd(ctx->vo); - assert(!w32_ctx->hdc); + if (w32_ctx->hdc) + return true; HDC hdc = GetDC(win); if (!hdc) @@ -83,7 +84,7 @@ static void *w32gpa(const GLubyte *procName) return GetProcAddress(oglmod, procName); } -static bool create_context_w32_old(struct MPGLContext *ctx, int flags) +static bool create_context_w32_old(struct MPGLContext *ctx) { struct w32_context *w32_ctx = ctx->priv; HGLRC *context = &w32_ctx->context; @@ -91,9 +92,6 @@ static bool create_context_w32_old(struct MPGLContext *ctx, int flags) if (*context) return true; - if (!create_dc(ctx, flags)) - return false; - HDC windc = w32_ctx->hdc; bool res = false; @@ -118,7 +116,7 @@ out: return res; } -static bool create_context_w32_gl3(struct MPGLContext *ctx, int flags) +static bool create_context_w32_gl3(struct MPGLContext *ctx) { struct w32_context *w32_ctx = ctx->priv; HGLRC *context = &w32_ctx->context; @@ -126,9 +124,6 @@ static bool create_context_w32_gl3(struct MPGLContext *ctx, int flags) if (*context) // reuse existing context return true; // not reusing it breaks gl3! - if (!create_dc(ctx, flags)) - return false; - HDC windc = w32_ctx->hdc; HGLRC new_context = 0; @@ -199,7 +194,7 @@ static bool create_context_w32_gl3(struct MPGLContext *ctx, int flags) return true; unsupported: - MP_ERR(ctx->vo, "The current OpenGL implementation does not support OpenGL 3.x \n"); + MP_ERR(ctx->vo, "The OpenGL driver does not support OpenGL 3.x \n"); out: wglDeleteContext(new_context); return false; @@ -210,11 +205,14 @@ static bool config_window_w32(struct MPGLContext *ctx, int flags) if (!vo_w32_config(ctx->vo, flags)) return false; + if (!create_dc(ctx, flags)) + return false; + bool success = false; if (ctx->requested_gl_version >= MPGL_VER(3, 0)) - success = create_context_w32_gl3(ctx, flags); + success = create_context_w32_gl3(ctx); if (!success) - success = create_context_w32_old(ctx, flags); + success = create_context_w32_old(ctx); return success; } |