From e532b6288f01b63d8d8ba8c8dc08292967e65490 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Dec 2011 14:06:58 -0800 Subject: dri2: Add plumbing to get context version requirements and flags to drivers This adds support for DRI_DRI2 version 3 to all of the DRI2 drivers. Signed-off-by: Ian Romanick --- src/mesa/drivers/dri/swrast/swrast.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/swrast/swrast.c') diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index ac82dc7d568..ff74cc5e290 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -702,7 +702,12 @@ InitExtensionsES2(struct gl_context *ctx) static GLboolean dri_create_context(gl_api api, const struct gl_config * visual, - __DRIcontext * cPriv, void *sharedContextPrivate) + __DRIcontext * cPriv, + unsigned major_version, + unsigned minor_version, + uint32_t flags, + unsigned *error, + void *sharedContextPrivate) { struct dri_context *ctx = NULL; struct dri_context *share = (struct dri_context *)sharedContextPrivate; @@ -712,9 +717,22 @@ dri_create_context(gl_api api, TRACE; + /* Flag filtering is handled in dri2CreateContextAttribs. + */ + (void) flags; + + if (api == API_OPENGL + && (major_version > 2 + || (major_version == 2 && minor_version > 1))) { + *error = __DRI_CTX_ERROR_BAD_VERSION; + goto context_fail; + } + ctx = CALLOC_STRUCT(dri_context); - if (ctx == NULL) + if (ctx == NULL) { + *error = __DRI_CTX_ERROR_NO_MEMORY; goto context_fail; + } cPriv->driverPrivate = ctx; ctx->cPriv = cPriv; @@ -731,6 +749,7 @@ dri_create_context(gl_api api, /* basic context setup */ if (!_mesa_initialize_context(mesaCtx, api, visual, sharedCtx, &functions, (void *) cPriv)) { + *error = __DRI_CTX_ERROR_NO_MEMORY; goto context_fail; } @@ -772,6 +791,7 @@ dri_create_context(gl_api api, break; } + *error = __DRI_CTX_ERROR_SUCCESS; return GL_TRUE; context_fail: -- cgit v1.2.3