diff options
author | Ian Romanick <[email protected]> | 2011-12-13 15:46:20 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2011-12-23 08:49:50 -0800 |
commit | d18152028e1825c05c7de33acacee3336350a096 (patch) | |
tree | cbfe88a4d0c18ff5e1c2d5ec4a4cf9eaf74875f2 /src/mesa | |
parent | 358ecff1ea0fa8432fd46bd3deeb8d2d694b5550 (diff) |
st-api: Have context_create explain why creation failed
This won't be used in the client-side libGL, but the xserver has to
generate a different protocol error depending on the reason context
creation failed.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_manager.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 55699e721f0..828f0d81f60 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -600,6 +600,7 @@ st_context_destroy(struct st_context_iface *stctxi) static struct st_context_iface * st_api_create_context(struct st_api *stapi, struct st_manager *smapi, const struct st_context_attribs *attribs, + enum st_context_error *error, struct st_context_iface *shared_stctxi) { struct st_context *shared_ctx = (struct st_context *) shared_stctxi; @@ -623,17 +624,21 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, break; case ST_PROFILE_OPENGL_CORE: default: + *error = ST_CONTEXT_ERROR_BAD_API; return NULL; break; } pipe = smapi->screen->context_create(smapi->screen, NULL); - if (!pipe) + if (!pipe) { + *error = ST_CONTEXT_ERROR_NO_MEMORY; return NULL; + } st_visual_to_context_mode(&attribs->visual, &mode); st = st_create_context(api, pipe, &mode, shared_ctx); if (!st) { + *error = ST_CONTEXT_ERROR_NO_MEMORY; pipe->destroy(pipe); return NULL; } @@ -645,6 +650,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, /* is the actual version less than the requested version? */ if (st->ctx->VersionMajor * 10 + st->ctx->VersionMinor < attribs->major * 10 + attribs->minor) { + *error = ST_CONTEXT_ERROR_BAD_VERSION; st_destroy_context(st); return NULL; } @@ -660,6 +666,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, st->iface.share = st_context_share; st->iface.st_context_private = (void *) smapi; + *error = ST_CONTEXT_SUCCESS; return &st->iface; } |