Alexandre Julliard : wineandroid: Implement wglCreateContextAttribsARB.

Alexandre Julliard julliard at winehq.org
Fri Jun 23 13:08:00 CDT 2017


Module: wine
Branch: master
Commit: a3eda7257cc2812d7e3f6f4b0188d5d084d6b767
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a3eda7257cc2812d7e3f6f4b0188d5d084d6b767

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jun 23 09:18:55 2017 +0200

wineandroid: Implement wglCreateContextAttribsARB.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 910652b..e55b253 100644
--- a/dlls/wineandroid.drv/opengl.c
+++ b/dlls/wineandroid.drv/opengl.c
@@ -290,6 +290,47 @@ static const char *android_wglGetExtensionsStringEXT(void)
 }
 
 /***********************************************************************
+ *		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
  */
 static BOOL android_wglSetPixelFormatWINE( HDC hdc, int format )
@@ -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;
 




More information about the wine-cvs mailing list