wineandroid: Implement wglCreateContextAttribsARB.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-06-23 09:18:55 +02:00
parent f2bb2064bf
commit a3eda7257c
1 changed files with 45 additions and 0 deletions

View File

@ -289,6 +289,47 @@ static const char *android_wglGetExtensionsStringEXT(void)
return wgl_extensions; 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 * android_wglSetPixelFormatWINE
*/ */
@ -508,6 +549,10 @@ static void init_extensions(void)
{ {
void *ptr; 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"); register_extension("WGL_ARB_extensions_string");
egl_funcs.ext.p_wglGetExtensionsStringARB = android_wglGetExtensionsStringARB; egl_funcs.ext.p_wglGetExtensionsStringARB = android_wglGetExtensionsStringARB;