aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_context.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-09-21 18:11:28 +0200
committermarha <marha@users.sourceforge.net>2014-09-21 18:11:28 +0200
commit438af0c7d4bf60b408b259c88205ff2193195466 (patch)
tree46fd6465cb7431f64a3cb475a40587a261983af4 /mesalib/src/mesa/state_tracker/st_context.c
parentd0f70707dde032e662dbd5bc70df6ac915403abe (diff)
downloadvcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.gz
vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.bz2
vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.zip
libxtrans xkeyboard-config xserver mesa plink glproto git update 21 Sep 2014
plink revision 10233 xserver commit 28337cb14e4347e1dd7936c5393a22e042866687 xkeyboard-config commit 48e1c0b351b6711edc0f167cbb81e4424b75291a glproto commit bd3d751e1eb17efb39f65093271bb4ac071aa9e0 libxtrans commit fb7f198c88e97d22c8c89e76e9cd06b2b2720a96 mesa commit 4eb2bbefd2bf0359aff7ebbb8e931a1c7833606f
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_context.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c82
1 files changed, 49 insertions, 33 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 09b615465..768a66790 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -104,6 +104,42 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state)
_vbo_InvalidateState(ctx, new_state);
}
+
+static void
+st_destroy_context_priv(struct st_context *st)
+{
+ uint shader, i;
+
+ st_destroy_atoms( st );
+ st_destroy_draw( st );
+ st_destroy_clear(st);
+ st_destroy_bitmap(st);
+ st_destroy_drawpix(st);
+ st_destroy_drawtex(st);
+
+ for (shader = 0; shader < Elements(st->state.sampler_views); shader++) {
+ for (i = 0; i < Elements(st->state.sampler_views[0]); i++) {
+ pipe_sampler_view_release(st->pipe,
+ &st->state.sampler_views[shader][i]);
+ }
+ }
+
+ if (st->default_texture) {
+ st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture);
+ st->default_texture = NULL;
+ }
+
+ u_upload_destroy(st->uploader);
+ if (st->indexbuf_uploader) {
+ u_upload_destroy(st->indexbuf_uploader);
+ }
+ if (st->constbuf_uploader) {
+ u_upload_destroy(st->constbuf_uploader);
+ }
+ free( st );
+}
+
+
static struct st_context *
st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
const struct st_config_options *options)
@@ -238,6 +274,14 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
_mesa_compute_version(ctx);
+ if (ctx->Version == 0) {
+ /* This can happen when a core profile was requested, but the driver
+ * does not support some features of GL 3.1 or later.
+ */
+ st_destroy_context_priv(st);
+ return NULL;
+ }
+
_mesa_initialize_dispatch_tables(ctx);
_mesa_initialize_vbo_vtxfmt(ctx);
@@ -259,6 +303,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
struct gl_context *ctx;
struct gl_context *shareCtx = share ? share->ctx : NULL;
struct dd_function_table funcs;
+ struct st_context *st;
memset(&funcs, 0, sizeof(funcs));
st_init_driver_functions(&funcs);
@@ -276,41 +321,12 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
if (debug_get_option_mesa_mvp_dp4())
ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE;
- return st_create_context_priv(ctx, pipe, options);
-}
-
-
-static void st_destroy_context_priv( struct st_context *st )
-{
- uint shader, i;
-
- st_destroy_atoms( st );
- st_destroy_draw( st );
- st_destroy_clear(st);
- st_destroy_bitmap(st);
- st_destroy_drawpix(st);
- st_destroy_drawtex(st);
-
- for (shader = 0; shader < Elements(st->state.sampler_views); shader++) {
- for (i = 0; i < Elements(st->state.sampler_views[0]); i++) {
- pipe_sampler_view_release(st->pipe,
- &st->state.sampler_views[shader][i]);
- }
+ st = st_create_context_priv(ctx, pipe, options);
+ if (!st) {
+ _mesa_destroy_context(ctx);
}
- if (st->default_texture) {
- st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture);
- st->default_texture = NULL;
- }
-
- u_upload_destroy(st->uploader);
- if (st->indexbuf_uploader) {
- u_upload_destroy(st->indexbuf_uploader);
- }
- if (st->constbuf_uploader) {
- u_upload_destroy(st->constbuf_uploader);
- }
- free( st );
+ return st;
}