[Mesa-stable] [PATCH 4/4] mesa: Get rid of texture-dependent image unit derived state.

Francisco Jerez currojerez at riseup.net
Thu Sep 3 06:53:15 PDT 2015


The point is to avoid having to re-validate all image units when
_NEW_TEXTURE is flagged, which can be expensive if the driver exposes
a large number of image units.  This has been reported to fix a 36%
performance regression in the Synmark2 Multithread benchmark on the
i965 driver which exposes 192 image units.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91788
Reported-by: Wendy Wang <wendy.wang at intel.com>
Tested-by: Ye Tian <yex.tian at intel.com>
CC: "11.0" <mesa-stable at lists.freedesktop.org>
---
 src/mesa/main/mtypes.h      |  7 -------
 src/mesa/main/shaderimage.c | 14 --------------
 src/mesa/main/shaderimage.h |  9 ---------
 src/mesa/main/texstate.c    |  3 ---
 4 files changed, 33 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 85a9f5d..e87d90b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4066,13 +4066,6 @@ struct gl_image_unit
    GLboolean Layered;
 
    /**
-    * GL_TRUE if the state of this image unit is valid and access from
-    * the shader is allowed.  Otherwise loads from this unit should
-    * return zero and stores should have no effect.
-    */
-   GLboolean _Valid;
-
-   /**
     * Layer of the texture object bound to this unit as specified by the
     * application.
     */
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index e686cad..152abf4 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -474,17 +474,6 @@ _mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u)
    return GL_TRUE;
 }
 
-void
-_mesa_validate_image_units(struct gl_context *ctx)
-{
-   unsigned 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,
@@ -568,7 +557,6 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
    u->Access = access;
    u->Format = format;
    u->_ActualFormat = _mesa_get_shader_image_format(format);
-   u->_Valid = _mesa_is_image_unit_valid(ctx, u);
 
    if (u->TexObj && _mesa_tex_target_is_layered(u->TexObj->Target)) {
       u->Layered = layered;
@@ -708,7 +696,6 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
          u->Access = GL_READ_WRITE;
          u->Format = tex_format;
          u->_ActualFormat = _mesa_get_shader_image_format(tex_format);
-         u->_Valid = _mesa_is_image_unit_valid(ctx, u);
       } else {
          /* Unbind the texture from the unit */
          _mesa_reference_texobj(&u->TexObj, NULL);
@@ -718,7 +705,6 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
          u->Access = GL_READ_ONLY;
          u->Format = GL_R8;
          u->_ActualFormat = MESA_FORMAT_R_UNORM8;
-         u->_Valid = GL_FALSE;
       }
 
       /* Pass the BindImageTexture call down to the device driver */
diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index 14a544f..94ee814 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -65,15 +65,6 @@ _mesa_init_image_units(struct gl_context *ctx);
 GLboolean
 _mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u);
 
-/**
- * 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 9b5928c..cb147fa 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -34,7 +34,6 @@
 #include "context.h"
 #include "enums.h"
 #include "macros.h"
-#include "shaderimage.h"
 #include "texobj.h"
 #include "teximage.h"
 #include "texstate.h"
@@ -741,8 +740,6 @@ update_texture_state( struct gl_context *ctx )
 
    if (!prog[MESA_SHADER_FRAGMENT] || !prog[MESA_SHADER_VERTEX])
       update_texgen(ctx);
-
-   _mesa_validate_image_units(ctx);
 }
 
 
-- 
2.4.6



More information about the mesa-stable mailing list