Re: [Mesa-dev] [PATCH 10/11] mesa: Validate image units when the texture state changes.

2013-11-25 Thread Francisco Jerez
Chris Forbes chr...@ijw.co.nz writes:

 It would be nice not to have to touch this memory when the extension
 is unused|unsupported, but that might be a problem for another
 patch...

How do you mean?  If the driver doesn't know about this extension
ctx-Const.MaxImageUnits will be zero and no memory will be touched.

 -- Chris

 On Mon, Nov 25, 2013 at 6:00 PM, Francisco Jerez curroje...@riseup.net 
 wrote:
 ---
  src/mesa/main/shaderimage.c | 11 +++
  src/mesa/main/shaderimage.h |  9 +
  src/mesa/main/texstate.c|  3 +++
  3 files changed, 23 insertions(+)

 diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
 index 627366b..3a59409 100644
 --- a/src/mesa/main/shaderimage.c
 +++ b/src/mesa/main/shaderimage.c
 @@ -368,6 +368,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 f9d550b..aaecc5d 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 ad80dcf..7720965 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);
  }


 --
 1.8.3.4

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev


pgpHh9NyhClPU.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/11] mesa: Validate image units when the texture state changes.

2013-11-25 Thread Chris Forbes
Ah, of course; so it's not a factor for driver which don't expose the
extension at all.

The `unused` side still stands as a vague concern, I think -- we
currently pay for lots of things that most apps don't use.

On Tue, Nov 26, 2013 at 6:43 AM, Francisco Jerez curroje...@riseup.net wrote:
 Chris Forbes chr...@ijw.co.nz writes:

 It would be nice not to have to touch this memory when the extension
 is unused|unsupported, but that might be a problem for another
 patch...

 How do you mean?  If the driver doesn't know about this extension
 ctx-Const.MaxImageUnits will be zero and no memory will be touched.

 -- Chris

 On Mon, Nov 25, 2013 at 6:00 PM, Francisco Jerez curroje...@riseup.net 
 wrote:
 ---
  src/mesa/main/shaderimage.c | 11 +++
  src/mesa/main/shaderimage.h |  9 +
  src/mesa/main/texstate.c|  3 +++
  3 files changed, 23 insertions(+)

 diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
 index 627366b..3a59409 100644
 --- a/src/mesa/main/shaderimage.c
 +++ b/src/mesa/main/shaderimage.c
 @@ -368,6 +368,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 f9d550b..aaecc5d 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 ad80dcf..7720965 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);
  }


 --
 1.8.3.4

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 10/11] mesa: Validate image units when the texture state changes.

2013-11-24 Thread Francisco Jerez
---
 src/mesa/main/shaderimage.c | 11 +++
 src/mesa/main/shaderimage.h |  9 +
 src/mesa/main/texstate.c|  3 +++
 3 files changed, 23 insertions(+)

diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 627366b..3a59409 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -368,6 +368,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 f9d550b..aaecc5d 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 ad80dcf..7720965 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);
 }
 
 
-- 
1.8.3.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/11] mesa: Validate image units when the texture state changes.

2013-11-24 Thread Chris Forbes
It would be nice not to have to touch this memory when the extension
is unused|unsupported, but that might be a problem for another
patch...

-- Chris

On Mon, Nov 25, 2013 at 6:00 PM, Francisco Jerez curroje...@riseup.net wrote:
 ---
  src/mesa/main/shaderimage.c | 11 +++
  src/mesa/main/shaderimage.h |  9 +
  src/mesa/main/texstate.c|  3 +++
  3 files changed, 23 insertions(+)

 diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
 index 627366b..3a59409 100644
 --- a/src/mesa/main/shaderimage.c
 +++ b/src/mesa/main/shaderimage.c
 @@ -368,6 +368,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 f9d550b..aaecc5d 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 ad80dcf..7720965 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);
  }


 --
 1.8.3.4

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev