mesa: Validate image units when the texture state changes.
authorFrancisco Jerez <currojerez@riseup.net>
Sat, 23 Nov 2013 03:58:10 +0000 (19:58 -0800)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 15 Jan 2014 15:42:08 +0000 (16:42 +0100)
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/main/shaderimage.c
src/mesa/main/shaderimage.h
src/mesa/main/texstate.c

index ade0a7b822d61d55d11edfdee8bb9b7da41be288..80c4693663bf7972be39e84a7ffd3d7dfe953f42 100644 (file)
@@ -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,
index f9d550b02e72f50823a37556a8634d15cc0d7924..aaecc5d299489c27b6a72f70df22fed634fa4aa7 100644 (file)
 
 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,
index ad80dcfaa5cc2bd3b125afe3495f9abae1d67b25..7720965a8c85d921d4a74b726245f7e96b660925 100644 (file)
@@ -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);
 }