From: Chip Davis Subject: [PATCH 4/4] wined3d: When creating a 3.x/4.x context, specifically request a core context. Message-Id: <20200409062135.33872-4-cdavis@codeweavers.com> Date: Thu, 9 Apr 2020 01:21:35 -0500 In-Reply-To: <20200409062135.33872-3-cdavis@codeweavers.com> References: <20200409062135.33872-1-cdavis@codeweavers.com> <20200409062135.33872-2-cdavis@codeweavers.com> <20200409062135.33872-3-cdavis@codeweavers.com> Signed-off-by: Chip Davis --- dlls/wined3d/context.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 41dbca24dbc..62be2c37291 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1970,7 +1970,7 @@ HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc, { HGLRC ctx; unsigned int ctx_attrib_idx = 0; - GLint ctx_attribs[7], ctx_flags = 0; + GLint ctx_attribs[9], ctx_flags = 0; if (context_debug_output_enabled(gl_info)) ctx_flags = WGL_CONTEXT_DEBUG_BIT_ARB; @@ -2001,10 +2001,19 @@ HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc, ctx_attribs[ctx_attrib_idx++] = ctx_flags; ctx_attribs[ctx_attrib_idx] = 0; } - if (!(ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs))) - WARN("Failed to create a WGL context with wglCreateContextAttribsARB, last error %#x.\n", - GetLastError()); - } + if ((ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs))) + return ctx; + ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_PROFILE_MASK_ARB; + ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; + ctx_attribs[ctx_attrib_idx] = 0; + if ((ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs))) + return ctx; + ctx_attribs[ctx_attrib_idx - 3] &= ~WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + if ((ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs))) + return ctx; + } + WARN("Failed to create a WGL context with wglCreateContextAttribsARB, last error %#x.\n", + GetLastError()); } return ctx; } -- 2.24.0