From a3eda7257cc2812d7e3f6f4b0188d5d084d6b767 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 23 Jun 2017 09:18:55 +0200 Subject: [PATCH] wineandroid: Implement wglCreateContextAttribsARB. Signed-off-by: Alexandre Julliard --- dlls/wineandroid.drv/opengl.c | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dlls/wineandroid.drv/opengl.c b/dlls/wineandroid.drv/opengl.c index 910652bfe69..e55b2531912 100644 --- a/dlls/wineandroid.drv/opengl.c +++ b/dlls/wineandroid.drv/opengl.c @@ -289,6 +289,47 @@ static const char *android_wglGetExtensionsStringEXT(void) return wgl_extensions; } +/*********************************************************************** + * android_wglCreateContextAttribsARB + */ +static struct wgl_context *android_wglCreateContextAttribsARB( HDC hdc, struct wgl_context *share, + const int *attribs ) +{ + int count = 0, egl_attribs[3]; + BOOL opengl_es = FALSE; + + while (attribs && *attribs && count < 2) + { + switch (*attribs) + { + case WGL_CONTEXT_PROFILE_MASK_ARB: + if (attribs[1] == WGL_CONTEXT_ES2_PROFILE_BIT_EXT) + opengl_es = TRUE; + break; + case WGL_CONTEXT_MAJOR_VERSION_ARB: + egl_attribs[count++] = EGL_CONTEXT_CLIENT_VERSION; + egl_attribs[count++] = attribs[1]; + break; + default: + FIXME("Unhandled attributes: %#x %#x\n", attribs[0], attribs[1]); + } + attribs += 2; + } + if (!opengl_es) + { + WARN("Requested creation of an OpenGL (non ES) context, that's not supported.\n"); + return NULL; + } + if (!count) /* FIXME: force version if not specified */ + { + egl_attribs[count++] = EGL_CONTEXT_CLIENT_VERSION; + egl_attribs[count++] = egl_client_version; + } + egl_attribs[count] = EGL_NONE; + + return create_context( hdc, share, egl_attribs ); +} + /*********************************************************************** * android_wglSetPixelFormatWINE */ @@ -508,6 +549,10 @@ static void init_extensions(void) { void *ptr; + register_extension("WGL_ARB_create_context"); + register_extension("WGL_ARB_create_context_profile"); + egl_funcs.ext.p_wglCreateContextAttribsARB = android_wglCreateContextAttribsARB; + register_extension("WGL_ARB_extensions_string"); egl_funcs.ext.p_wglGetExtensionsStringARB = android_wglGetExtensionsStringARB;