summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-19 09:36:10 -0600
committerBrian Paul <[email protected]>2008-05-19 09:36:10 -0600
commita846b156b8a0d2ef63de8f905af440f54e5668c7 (patch)
treee08afbcda76d2253e9f1fa40e34cc9543092ae78 /src
parentaafe3ddee276230243ed6767803ce4b6ce2aeec6 (diff)
parent59007a811de2d76ea00164e8f1cacb4a375d1458 (diff)
Merge branch 'gallium-0.1' into gallium-tex-surfaces
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_sse.c3
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c6
-rwxr-xr-xsrc/mesa/main/context.c46
3 files changed, 32 insertions, 23 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
index 5929ea76b23..e3f4e67472a 100644
--- a/src/gallium/auxiliary/draw/draw_vs_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -215,6 +215,9 @@ draw_create_vs_sse(struct draw_context *draw,
goto fail;
vs->func = (codegen_function) x86_get_func( &vs->sse2_program );
+ if (!vs->func) {
+ goto fail;
+ }
return &vs->base;
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
index 25fdfea4915..55741cc1df8 100644
--- a/src/gallium/drivers/softpipe/sp_fs_sse.c
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -139,7 +139,11 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe,
}
shader->func = (codegen_function) x86_get_func( &shader->sse2_program );
- assert(shader->func);
+ if (!shader->func) {
+ x86_release_func( &shader->sse2_program );
+ FREE(shader);
+ return NULL;
+ }
shader->base.shader = *templ;
shader->base.prepare = fs_sse_prepare;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 893c79f28ca..2158eb68738 100755
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -593,6 +593,8 @@ delete_program_cb(GLuint id, void *data, void *userData)
{
struct gl_program *prog = (struct gl_program *) data;
GLcontext *ctx = (GLcontext *) userData;
+ ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */
+ prog->RefCount = 0; /* now going away */
ctx->Driver.DeleteProgram(ctx, prog);
}
@@ -686,22 +688,11 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
_mesa_HashDeleteAll(ss->DisplayList, delete_displaylist_cb, ctx);
_mesa_DeleteHashTable(ss->DisplayList);
- /*
- * Free texture objects
- */
- ASSERT(ctx->Driver.DeleteTexture);
- /* the default textures */
- ctx->Driver.DeleteTexture(ctx, ss->Default1D);
- ctx->Driver.DeleteTexture(ctx, ss->Default2D);
- ctx->Driver.DeleteTexture(ctx, ss->Default3D);
- ctx->Driver.DeleteTexture(ctx, ss->DefaultCubeMap);
- ctx->Driver.DeleteTexture(ctx, ss->DefaultRect);
- ctx->Driver.DeleteTexture(ctx, ss->Default1DArray);
- ctx->Driver.DeleteTexture(ctx, ss->Default2DArray);
-
- /* all other textures */
- _mesa_HashDeleteAll(ss->TexObjects, delete_texture_cb, ctx);
- _mesa_DeleteHashTable(ss->TexObjects);
+#if FEATURE_ARB_shader_objects
+ _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx);
+ _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx);
+ _mesa_DeleteHashTable(ss->ShaderObjects);
+#endif
#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_NV_fragment_program)
_mesa_HashDeleteAll(ss->Programs, delete_program_cb, ctx);
@@ -728,17 +719,28 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
_mesa_HashDeleteAll(ss->ArrayObjects, delete_arrayobj_cb, ctx);
_mesa_DeleteHashTable(ss->ArrayObjects);
-#if FEATURE_ARB_shader_objects
- _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx);
- _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx);
- _mesa_DeleteHashTable(ss->ShaderObjects);
-#endif
-
#if FEATURE_EXT_framebuffer_object
_mesa_DeleteHashTable(ss->FrameBuffers);
_mesa_DeleteHashTable(ss->RenderBuffers);
#endif
+ /*
+ * Free texture objects (after FBOs since some textures might have
+ * been bound to FBOs).
+ */
+ ASSERT(ctx->Driver.DeleteTexture);
+ /* the default textures */
+ ctx->Driver.DeleteTexture(ctx, ss->Default1D);
+ ctx->Driver.DeleteTexture(ctx, ss->Default2D);
+ ctx->Driver.DeleteTexture(ctx, ss->Default3D);
+ ctx->Driver.DeleteTexture(ctx, ss->DefaultCubeMap);
+ ctx->Driver.DeleteTexture(ctx, ss->DefaultRect);
+ ctx->Driver.DeleteTexture(ctx, ss->Default1DArray);
+ ctx->Driver.DeleteTexture(ctx, ss->Default2DArray);
+ /* all other textures */
+ _mesa_HashDeleteAll(ss->TexObjects, delete_texture_cb, ctx);
+ _mesa_DeleteHashTable(ss->TexObjects);
+
_glthread_DESTROY_MUTEX(ss->Mutex);
_mesa_free(ss);