summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/shaderimage.c11
-rw-r--r--src/mesa/main/shaderimage.h9
-rw-r--r--src/mesa/main/texstate.c3
3 files changed, 23 insertions, 0 deletions
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index ade0a7b822d..80c4693663b 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -380,6 +380,17 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
return GL_TRUE;
}
+void
+_mesa_validate_image_units(struct gl_context *ctx)
+{
+ int i;
+
+ for (i = 0; i < ctx->Const.MaxImageUnits; ++i) {
+ struct gl_image_unit *u = &ctx->ImageUnits[i];
+ u->_Valid = validate_image_unit(ctx, u);
+ }
+}
+
static GLboolean
validate_bind_image_texture(struct gl_context *ctx, GLuint unit,
GLuint texture, GLint level, GLboolean layered,
diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index f9d550b02e7..aaecc5d2994 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -31,6 +31,15 @@
struct gl_context;
+/**
+ * Recalculate the \c _Valid flag of a context's shader image units.
+ *
+ * To be called when the state of any texture bound to an image unit
+ * changes.
+ */
+void
+_mesa_validate_image_units(struct gl_context *ctx);
+
void GLAPIENTRY
_mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
GLboolean layered, GLint layer, GLenum access,
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index ad80dcfaa5c..7720965a8c8 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -35,6 +35,7 @@
#include "context.h"
#include "enums.h"
#include "macros.h"
+#include "shaderimage.h"
#include "texobj.h"
#include "teximage.h"
#include "texstate.h"
@@ -674,6 +675,8 @@ update_texture_state( struct gl_context *ctx )
if (!fprog || !vprog)
update_texgen(ctx);
+
+ _mesa_validate_image_units(ctx);
}