st/dri: Support EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR/GLX_CONTEXT_DEBUG_BIT_ARB on ES contexts.

The latest version of the specs explicitly allow it, and given that Mesa
universally supports KHR_debug we should definitely support it.

Totally untested.  (Just happened to noticed this while implementing
GLX_EXT_create_context_es2_profile for st/xlib.)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
José Fonseca
2014-11-12 12:13:42 +00:00
parent 363b53f000
commit 7037793f6b
2 changed files with 9 additions and 11 deletions

View File

@@ -72,9 +72,6 @@ dri_create_context(gl_api api, const struct gl_config * visual,
attribs.major = major_version; attribs.major = major_version;
attribs.minor = minor_version; attribs.minor = minor_version;
if ((flags & __DRI_CTX_FLAG_DEBUG) != 0)
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0) if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE; attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE;
break; break;
@@ -83,6 +80,9 @@ dri_create_context(gl_api api, const struct gl_config * visual,
goto fail; goto fail;
} }
if ((flags & __DRI_CTX_FLAG_DEBUG) != 0)
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) { if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG; *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
goto fail; goto fail;

View File

@@ -376,19 +376,17 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
return NULL; return NULL;
} }
/* The EGL_KHR_create_context spec says: /* The latest version of EGL_KHR_create_context spec says:
* *
* "Flags are only defined for OpenGL context creation, and specifying * "If the EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR flag bit is set in
* a flags value other than zero for other types of contexts, * EGL_CONTEXT_FLAGS_KHR, then a <debug context> will be created.
* including OpenGL ES contexts, will generate an error." * [...] This bit is supported for OpenGL and OpenGL ES contexts.
* *
* The GLX_EXT_create_context_es2_profile specification doesn't say * None of the other flags have any meaning in an ES context, so this seems safe.
* anything specific about this case. However, none of the known flags
* have any meaning in an ES context, so this seems safe.
*/ */
if (mesa_api != API_OPENGL_COMPAT if (mesa_api != API_OPENGL_COMPAT
&& mesa_api != API_OPENGL_CORE && mesa_api != API_OPENGL_CORE
&& flags != 0) { && (flags & ~__DRI_CTX_FLAG_DEBUG)) {
*error = __DRI_CTX_ERROR_BAD_FLAG; *error = __DRI_CTX_ERROR_BAD_FLAG;
return NULL; return NULL;
} }