if (*error != __DRI_CTX_ERROR_SUCCESS)
goto error_exit;
- if (!dri2_check_no_error(dca.flags, shareList, dca.major_ver, error)) {
- goto error_exit;
- }
-
/* Check the renderType value */
if (!validate_renderType_against_config(config_base, dca.render_type))
goto error_exit;
if (!shareList->isDirect)
return NULL;
+ /* The GLX_ARB_create_context_no_error specs say:
+ *
+ * BadMatch is generated if the value of GLX_CONTEXT_OPENGL_NO_ERROR_ARB
+ * used to create <share_context> does not match the value of
+ * GLX_CONTEXT_OPENGL_NO_ERROR_ARB for the context being created.
+ */
+ if (!!shareList->noError != !!dca.no_error) {
+ *error = __DRI_CTX_ERROR_BAD_FLAG;
+ return NULL;
+ }
+
pcp_shared = (struct dri2_context *) shareList;
shared = pcp_shared->driContext;
}
ctx_attribs[num_ctx_attribs++] = dca.release;
}
+ if (dca.no_error) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_NO_ERROR;
+ ctx_attribs[num_ctx_attribs++] = dca.no_error;
+ pcp->base.noError = GL_TRUE;
+ }
+
if (dca.flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
-
- /* The current __DRI_CTX_FLAG_* values are identical to the
- * GLX_CONTEXT_*_BIT values.
- */
ctx_attribs[num_ctx_attribs++] = dca.flags;
}
*/
pcp->base.renderType = dca.render_type;
- if (dca.flags & __DRI_CTX_FLAG_NO_ERROR)
- pcp->base.noError = GL_TRUE;
-
pcp->driContext =
(*psc->dri2->createContextAttribs) (psc->driScreen,
dca.api,
__glXEnableDirectExtension(&psc->base,
"GLX_ARB_create_context_robustness");
- if (strcmp(extensions[i]->name, __DRI2_NO_ERROR) == 0)
- __glXEnableDirectExtension(&psc->base,
- "GLX_ARB_create_context_no_error");
-
if (strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) {
psc->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];
__glXEnableDirectExtension(&psc->base, "GLX_MESA_query_renderer");
+ unsigned int no_error = 0;
+ if (psc->rendererQuery->queryInteger(psc->driScreen,
+ __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT,
+ &no_error) == 0 && no_error)
+ __glXEnableDirectExtension(&psc->base,
+ "GLX_ARB_create_context_no_error");
}
if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
if (*error != __DRI_CTX_ERROR_SUCCESS)
goto error_exit;
- if (!dri2_check_no_error(dca.flags, shareList, dca.major_ver, error)) {
- goto error_exit;
- }
-
/* Check the renderType value */
if (!validate_renderType_against_config(config_base, dca.render_type))
goto error_exit;
if (!shareList->isDirect)
return NULL;
+ /* The GLX_ARB_create_context_no_error specs say:
+ *
+ * BadMatch is generated if the value of GLX_CONTEXT_OPENGL_NO_ERROR_ARB
+ * used to create <share_context> does not match the value of
+ * GLX_CONTEXT_OPENGL_NO_ERROR_ARB for the context being created.
+ */
+ if (!!shareList->noError != !!dca.no_error) {
+ *error = __DRI_CTX_ERROR_BAD_FLAG;
+ return NULL;
+ }
+
pcp_shared = (struct dri3_context *) shareList;
shared = pcp_shared->driContext;
}
ctx_attribs[num_ctx_attribs++] = dca.release;
}
+ if (dca.no_error) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_NO_ERROR;
+ ctx_attribs[num_ctx_attribs++] = dca.no_error;
+ pcp->base.noError = GL_TRUE;
+ }
+
if (dca.flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
-
- /* The current __DRI_CTX_FLAG_* values are identical to the
- * GLX_CONTEXT_*_BIT values.
- */
ctx_attribs[num_ctx_attribs++] = dca.flags;
-
- if (dca.flags & __DRI_CTX_FLAG_NO_ERROR)
- pcp->base.noError = GL_TRUE;
}
pcp->base.renderType = dca.render_type;
__glXEnableDirectExtension(&psc->base,
"GLX_ARB_create_context_robustness");
- if (strcmp(extensions[i]->name, __DRI2_NO_ERROR) == 0)
- __glXEnableDirectExtension(&psc->base,
- "GLX_ARB_create_context_no_error");
-
if (strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) {
psc->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];
__glXEnableDirectExtension(&psc->base, "GLX_MESA_query_renderer");
+ unsigned int no_error = 0;
+ if (psc->rendererQuery->queryInteger(psc->driScreen,
+ __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT,
+ &no_error) == 0 && no_error)
+ __glXEnableDirectExtension(&psc->base,
+ "GLX_ARB_create_context_no_error");
}
if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
struct dri_ctx_attribs *dca)
{
unsigned i;
- int no_error = 0;
uint32_t profile = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
dca->major_ver = 1;
dca->release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
dca->flags = 0;
dca->api = __DRI_API_OPENGL;
+ dca->no_error = 0;
if (num_attribs == 0)
return __DRI_CTX_ERROR_SUCCESS;
dca->flags = attribs[i * 2 + 1];
break;
case GLX_CONTEXT_OPENGL_NO_ERROR_ARB:
- no_error = attribs[i * 2 + 1];
+ dca->no_error = attribs[i * 2 + 1];
break;
case GLX_CONTEXT_PROFILE_MASK_ARB:
profile = attribs[i * 2 + 1];
}
}
- if (no_error) {
- dca->flags |= __DRI_CTX_FLAG_NO_ERROR;
- }
-
switch (profile) {
case GLX_CONTEXT_CORE_PROFILE_BIT_ARB:
/* This is the default value, but there are no profiles before OpenGL
if (dca->flags & ~(__DRI_CTX_FLAG_DEBUG |
__DRI_CTX_FLAG_FORWARD_COMPATIBLE |
__DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS |
- __DRI_CTX_FLAG_NO_ERROR))
+ __DRI_CTX_FLAG_RESET_ISOLATION))
return __DRI_CTX_ERROR_UNKNOWN_FLAG;
/* There are no forward-compatible contexts before OpenGL 3.0. The
if (dca->major_ver >= 3 && dca->render_type == GLX_COLOR_INDEX_TYPE)
return __DRI_CTX_ERROR_BAD_FLAG;
- return __DRI_CTX_ERROR_SUCCESS;
-}
-
-_X_HIDDEN bool
-dri2_check_no_error(uint32_t flags, struct glx_context *share_context,
- int major, unsigned *error)
-{
- Bool noError = flags & __DRI_CTX_FLAG_NO_ERROR;
-
/* The KHR_no_error specs say:
*
* Requires OpenGL ES 2.0 or OpenGL 2.0.
*/
- if (noError && major < 2) {
- *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
- return false;
- }
-
- /* The GLX_ARB_create_context_no_error specs say:
- *
- * BadMatch is generated if the value of GLX_CONTEXT_OPENGL_NO_ERROR_ARB
- * used to create <share_context> does not match the value of
- * GLX_CONTEXT_OPENGL_NO_ERROR_ARB for the context being created.
- */
- if (share_context && !!share_context->noError != !!noError) {
- *error = __DRI_CTX_ERROR_BAD_FLAG;
- return false;
- }
+ if (dca->no_error && dca->major_ver < 2)
+ return __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
/* The GLX_ARB_create_context_no_error specs say:
*
* the same time as a debug or robustness context is specified.
*
*/
- if (noError && ((flags & __DRI_CTX_FLAG_DEBUG) ||
- (flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS))) {
- *error = __DRI_CTX_ERROR_BAD_FLAG;
- return false;
- }
+ if (dca->no_error && ((dca->flags & __DRI_CTX_FLAG_DEBUG) ||
+ (dca->flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)))
+ return __DRI_CTX_ERROR_BAD_FLAG;
- return true;
+ return __DRI_CTX_ERROR_SUCCESS;
}
struct glx_context *
unsigned api;
int reset;
int release;
+ int no_error;
};
extern int
dri_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
struct dri_ctx_attribs *dca);
-extern bool
-dri2_check_no_error(uint32_t flags, struct glx_context *share_context,
- int major, unsigned *error);
-
-
extern struct glx_context *
dri_common_create_context(struct glx_screen *base,
struct glx_config *config_base,
if (*error != __DRI_CTX_ERROR_SUCCESS)
return NULL;
- if (!dri2_check_no_error(dca.flags, shareList, dca.major_ver, error))
- return NULL;
-
/* Check the renderType value */
if (!validate_renderType_against_config(config_base, dca.render_type)) {
return NULL;
if (!shareList->isDirect)
return NULL;
+ /* The GLX_ARB_create_context_no_error specs say:
+ *
+ * BadMatch is generated if the value of GLX_CONTEXT_OPENGL_NO_ERROR_ARB
+ * used to create <share_context> does not match the value of
+ * GLX_CONTEXT_OPENGL_NO_ERROR_ARB for the context being created.
+ */
+ if (!!shareList->noError != !!dca.no_error) {
+ *error = __DRI_CTX_ERROR_BAD_FLAG;
+ return NULL;
+ }
+
pcp_shared = (struct drisw_context *) shareList;
shared = pcp_shared->driContext;
}
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
ctx_attribs[num_ctx_attribs++] = dca.release;
}
+ if (dca.no_error) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_NO_ERROR;
+ ctx_attribs[num_ctx_attribs++] = GL_TRUE;
+ pcp->base.noError = GL_TRUE;
+ }
if (dca.flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
-
- /* The current __DRI_CTX_FLAG_* values are identical to the
- * GLX_CONTEXT_*_BIT values.
- */
ctx_attribs[num_ctx_attribs++] = dca.flags;
-
- if (dca.flags & __DRI_CTX_FLAG_NO_ERROR)
- pcp->base.noError = GL_TRUE;
}
pcp->base.renderType = dca.render_type;
&& strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) {
psc->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];
__glXEnableDirectExtension(&psc->base, "GLX_MESA_query_renderer");
+ unsigned int no_error = 0;
+ if (psc->rendererQuery->queryInteger(psc->driScreen,
+ __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT,
+ &no_error) == 0 && no_error)
+ __glXEnableDirectExtension(&psc->base,
+ "GLX_ARB_create_context_no_error");
}
if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0)
__glXEnableDirectExtension(&psc->base,
"GLX_ARB_context_flush_control");
}
-
- if (strcmp(extensions[i]->name, __DRI2_NO_ERROR) == 0)
- __glXEnableDirectExtension(&psc->base,
- "GLX_ARB_create_context_no_error");
}
}