st/mesa: Reject forward-looking contexts

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Ian Romanick 2011-12-01 11:31:28 -08:00
parent d9de33c304
commit 4c7898cb13
1 changed files with 6 additions and 2 deletions

View 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;