st/mesa: Reject forward-looking contexts
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 1 Dec 2011 19:31:28 +0000 (11:31 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 2 Jan 2012 20:41:45 +0000 (12:41 -0800)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/state_tracker/st_manager.c

index 828f0d81f600c88f0b7f44f207295ba93b183d6a..1cee312cd3ef43d06fa640c897caee602594a242 100644 (file)
@@ -647,9 +647,13 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
    if (attribs->major > 1 || attribs->minor > 0) {
       _mesa_compute_version(st->ctx);
 
-      /* is the actual version less than the requested version? */
+      /* Is the actual version less than the requested version?  Mesa can't
+       * yet enforce the added restrictions of a forward-looking context, so
+       * fail that too.
+       */
       if (st->ctx->VersionMajor * 10 + st->ctx->VersionMinor <
-          attribs->major * 10 + attribs->minor) {
+          attribs->major * 10 + attribs->minor
+         || (attribs->flags & ~ST_CONTEXT_FLAG_DEBUG) != 0) {
         *error = ST_CONTEXT_ERROR_BAD_VERSION;
          st_destroy_context(st);
          return NULL;