mesa/dri: Move context flag validation down into the drivers
Soon some drivers will support a different set of flags than other drivers. If some flags have to be filtered in the driver, we might as well filter all of them in the driver. The changes in nouveau use tabs because nouveau seems to have it's own indentation rules. v2: Fix some rebase failures noticed by Ken (returning the wrong types, etc.). Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -101,6 +101,11 @@ dri_create_context(gl_api api, const struct gl_config * visual,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (notify_reset) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
|
||||
goto fail;
|
||||
|
||||
@@ -917,6 +917,11 @@ intelCreateContext(gl_api api,
|
||||
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
|
||||
struct intel_screen *intelScreen = sPriv->driverPrivate;
|
||||
|
||||
if (flags & ~__DRI_CTX_FLAG_DEBUG) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (notify_reset) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
|
||||
return false;
|
||||
|
||||
@@ -580,6 +580,11 @@ brwCreateContext(gl_api api,
|
||||
struct dd_function_table functions;
|
||||
struct gl_config visual;
|
||||
|
||||
if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
|
||||
*dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (notify_reset) {
|
||||
*dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
|
||||
return false;
|
||||
|
||||
@@ -62,9 +62,10 @@ nouveau_context_create(gl_api api,
|
||||
struct nouveau_context *nctx;
|
||||
struct gl_context *ctx;
|
||||
|
||||
/* API and flag filtering is handled in dri2CreateContextAttribs.
|
||||
*/
|
||||
(void) flags;
|
||||
if (flags & ~__DRI_CTX_FLAG_DEBUG) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (notify_reset) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
|
||||
|
||||
@@ -213,9 +213,10 @@ GLboolean r200CreateContext( gl_api api,
|
||||
int i;
|
||||
int tcl_mode;
|
||||
|
||||
/* Flag filtering is handled in dri2CreateContextAttribs.
|
||||
*/
|
||||
(void) flags;
|
||||
if (flags & ~__DRI_CTX_FLAG_DEBUG) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (notify_reset) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
|
||||
|
||||
@@ -180,9 +180,10 @@ r100CreateContext( gl_api api,
|
||||
int i;
|
||||
int tcl_mode, fthrottle_mode;
|
||||
|
||||
/* Flag filtering is handled in dri2CreateContextAttribs.
|
||||
*/
|
||||
(void) flags;
|
||||
if (flags & ~__DRI_CTX_FLAG_DEBUG) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (notify_reset) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
|
||||
|
||||
Reference in New Issue
Block a user