summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/context.c2
-rw-r--r--src/mesa/main/shaderimage.c10
-rw-r--r--src/mesa/main/shaderimage.h3
3 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 492f01de957..e5a89d9c2fc 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -129,6 +129,7 @@
#include "util/disk_cache.h"
#include "util/strtod.h"
#include "stencil.h"
+#include "shaderimage.h"
#include "texcompress_s3tc.h"
#include "texstate.h"
#include "transformfeedback.h"
@@ -1345,6 +1346,7 @@ _mesa_free_context_data( struct gl_context *ctx )
_mesa_free_buffer_objects(ctx);
_mesa_free_eval_data( ctx );
_mesa_free_texture_data( ctx );
+ _mesa_free_image_textures(ctx);
_mesa_free_matrix_data( ctx );
_mesa_free_pipeline_data(ctx);
_mesa_free_program_data(ctx);
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 31ac852d37f..242a8c29909 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -469,6 +469,16 @@ _mesa_init_image_units(struct gl_context *ctx)
ctx->ImageUnits[i] = _mesa_default_image_unit(ctx);
}
+
+void
+_mesa_free_image_textures(struct gl_context *ctx)
+{
+ unsigned i;
+
+ for (i = 0; i < ARRAY_SIZE(ctx->ImageUnits); ++i)
+ _mesa_reference_texobj(&ctx->ImageUnits[i].TexObj, NULL);
+}
+
GLboolean
_mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u)
{
diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index 6a9e3d67e92..daed27508a7 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -68,6 +68,9 @@ _mesa_default_image_unit(struct gl_context *ctx);
void
_mesa_init_image_units(struct gl_context *ctx);
+void
+_mesa_free_image_textures(struct gl_context *ctx);
+
/**
* Return GL_TRUE if the state of the image unit passed as argument is valid
* and access from the shader is allowed. Otherwise loads from this unit