mesa: split _NEW_TEXTURE into _NEW_TEXTURE_OBJECT & _NEW_TEXTURE_STATE
authorMarek Olšák <marek.olsak@amd.com>
Thu, 23 Mar 2017 21:42:56 +0000 (22:42 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 29 Mar 2017 13:44:00 +0000 (15:44 +0200)
No performance testing has been done, because it makes sense to make this
change regardless of that. Also, _NEW_TEXTURE is still used in many places,
but the obvious occurences are replaced here.

It's now possible to split _NEW_TEXTURE_OBJECT further.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
15 files changed:
src/mesa/main/enable.c
src/mesa/main/ff_fragment_shader.cpp
src/mesa/main/mipmap.c
src/mesa/main/mtypes.h
src/mesa/main/samplerobj.c
src/mesa/main/shaderimage.h
src/mesa/main/texenv.c
src/mesa/main/texgen.c
src/mesa/main/teximage.c
src/mesa/main/texobj.c
src/mesa/main/texparam.c
src/mesa/main/texstate.c
src/mesa/main/uniform_query.cpp
src/mesa/program/prog_statevars.c
src/mesa/state_tracker/st_context.c

index f0c5bb7f35c9d70fb7607c5ad99bc795f832bde8..d9d63a6b4bacdf74ad84565f8282e6fa8fb66e13 100644 (file)
@@ -226,7 +226,7 @@ enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit)
    if (texUnit->Enabled == newenabled)
        return GL_FALSE;
 
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
    texUnit->Enabled = newenabled;
    return GL_TRUE;
 }
@@ -718,7 +718,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
                   newenabled |= coordBit;
                if (texUnit->TexGenEnabled == newenabled)
                   return;
-               FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+               FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
                texUnit->TexGenEnabled = newenabled;
             }
          }
@@ -739,7 +739,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
                   newenabled |= STR_BITS;
                if (texUnit->TexGenEnabled == newenabled)
                   return;
-               FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+               FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
                texUnit->TexGenEnabled = newenabled;
             }
          }
@@ -958,7 +958,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             goto invalid_enum_error;
         CHECK_EXTENSION(ARB_seamless_cube_map, cap);
         if (ctx->Texture.CubeMapSeamless != state) {
-           FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+           FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
            ctx->Texture.CubeMapSeamless = state;
         }
         break;
index be382fa3ae993f4c2be95381bd34c640ce342afc..f007ac3b40f30831bcbeda619a606ec046c308c0 100644 (file)
@@ -338,7 +338,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
             fp_inputs |= VARYING_BIT_COL1;
       }
 
-      /* _NEW_TEXTURE */
+      /* _NEW_TEXTURE_STATE */
       fp_inputs |= (ctx->Texture._TexGenEnabled |
                     ctx->Texture._TexMatEnabled) << VARYING_SLOT_TEX0;
 
@@ -404,7 +404,7 @@ static GLuint make_state_key( struct gl_context *ctx,  struct state_key *key )
 
    memset(key, 0, sizeof(*key));
 
-   /* _NEW_TEXTURE */
+   /* _NEW_TEXTURE_OBJECT */
    mask = ctx->Texture._EnabledCoordUnits;
    while (mask) {
       const int i = u_bit_scan(&mask);
index 05c13fbba0cb58fe34c6a6e11e6166bbed2e4871..8745dd93be56233860c1f45ebbd944b32440881c 100644 (file)
@@ -1867,7 +1867,7 @@ prepare_mipmap_level(struct gl_context *ctx,
          /* in case the mipmap level is part of an FBO: */
          _mesa_update_fbo_texture(ctx, texObj, face, level);
 
-         ctx->NewState |= _NEW_TEXTURE;
+         ctx->NewState |= _NEW_TEXTURE_OBJECT;
       }
    }
 
index be78b96810d0994e9b03e4fa39b4d83a96528cc5..91e1948c232c3cc4a36559cb09a63a56a600b27a 100644 (file)
@@ -4100,10 +4100,10 @@ struct gl_matrix_stack
 #define _NEW_POLYGONSTIPPLE    (1u << 13)  /**< gl_context::PolygonStipple */
 #define _NEW_SCISSOR           (1u << 14)  /**< gl_context::Scissor */
 #define _NEW_STENCIL           (1u << 15)  /**< gl_context::Stencil */
-#define _NEW_TEXTURE           (1u << 16)  /**< gl_context::Texture */
+#define _NEW_TEXTURE_OBJECT    (1u << 16)  /**< gl_context::Texture (bindings only) */
 #define _NEW_TRANSFORM         (1u << 17)  /**< gl_context::Transform */
 #define _NEW_VIEWPORT          (1u << 18)  /**< gl_context::Viewport */
-/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
+#define _NEW_TEXTURE_STATE     (1u << 19)  /**< gl_context::Texture (states only) */
 #define _NEW_ARRAY             (1u << 20)  /**< gl_context::Array */
 #define _NEW_RENDERMODE        (1u << 21)  /**< gl_context::RenderMode, etc */
 #define _NEW_BUFFERS           (1u << 22)  /**< gl_context::Visual, DrawBuffer, */
@@ -4124,8 +4124,10 @@ struct gl_matrix_stack
  * Composite state flags
  */
 /*@{*/
+#define _NEW_TEXTURE   (_NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE)
+
 #define _MESA_NEW_NEED_EYE_COORDS         (_NEW_LIGHT |                \
-                                           _NEW_TEXTURE |      \
+                                           _NEW_TEXTURE_STATE |        \
                                            _NEW_POINT |                \
                                            _NEW_PROGRAM |      \
                                            _NEW_MODELVIEW)
index a36563a018249b4dfcdf1f2c9c8253659c3f9db9..183f1d2a8620fa18f327e7413fa866ac5a0a2c24 100644 (file)
@@ -226,7 +226,7 @@ _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
             /* If the sampler is currently bound, unbind it. */
             for (j = 0; j < ctx->Const.MaxCombinedTextureImageUnits; j++) {
                if (ctx->Texture.Unit[j].Sampler == sampObj) {
-                  FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+                  FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
                   _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[j].Sampler, NULL);
                }
             }
@@ -258,7 +258,7 @@ _mesa_bind_sampler(struct gl_context *ctx, GLuint unit,
                    struct gl_sampler_object *sampObj)
 {
    if (ctx->Texture.Unit[unit].Sampler != sampObj) {
-      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
    }
 
    _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[unit].Sampler,
@@ -374,7 +374,7 @@ _mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
             _mesa_reference_sampler_object(ctx,
                                            &ctx->Texture.Unit[unit].Sampler,
                                            sampObj);
-            ctx->NewState |= _NEW_TEXTURE;
+            ctx->NewState |= _NEW_TEXTURE_OBJECT;
          }
       }
 
@@ -388,7 +388,7 @@ _mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
             _mesa_reference_sampler_object(ctx,
                                            &ctx->Texture.Unit[unit].Sampler,
                                            NULL);
-            ctx->NewState |= _NEW_TEXTURE;
+            ctx->NewState |= _NEW_TEXTURE_OBJECT;
          }
       }
    }
@@ -430,7 +430,7 @@ validate_texture_wrap_mode(struct gl_context *ctx, GLenum wrap)
 static inline void
 flush(struct gl_context *ctx)
 {
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
 }
 
 void
index 2cf0b0abc72750f4664317f3a8f66a5f85ac9140..99dddb77dfc37439483f328868177ff250beb6cb 100644 (file)
@@ -74,7 +74,7 @@ _mesa_init_image_units(struct gl_context *ctx);
  * should return zero and stores should have no effect.
  *
  * The result depends on context state other than the passed image unit, part
- * of the _NEW_TEXTURE set.
+ * of the _NEW_TEXTURE_OBJECT set.
  */
 GLboolean
 _mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u);
index de49566ec42cb66f44b13fda5d0c72c0d3ce3942..ee5171c5c6afc3eb19ef0630ed7c3b038c01bb39 100644 (file)
@@ -77,7 +77,7 @@ set_env_mode(struct gl_context *ctx,
    }
 
    if (legal) {
-      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
       texUnit->EnvMode = mode;
    }
    else {
@@ -93,7 +93,7 @@ set_env_color(struct gl_context *ctx,
 {
    if (TEST_EQ_4V(color, texUnit->EnvColorUnclamped))
       return;
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
    COPY_4FV(texUnit->EnvColorUnclamped, color);
    texUnit->EnvColor[0] = CLAMP(color[0], 0.0F, 1.0F);
    texUnit->EnvColor[1] = CLAMP(color[1], 0.0F, 1.0F);
@@ -151,14 +151,14 @@ set_combiner_mode(struct gl_context *ctx,
    case GL_COMBINE_RGB:
       if (texUnit->Combine.ModeRGB == mode)
          return;
-      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
       texUnit->Combine.ModeRGB = mode;
       break;
 
    case GL_COMBINE_ALPHA:
       if (texUnit->Combine.ModeA == mode)
          return;
-      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
       texUnit->Combine.ModeA = mode;
       break;
    default:
@@ -249,7 +249,7 @@ set_combiner_source(struct gl_context *ctx,
       return;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
 
    if (alpha)
       texUnit->Combine.SourceA[term] = param;
@@ -331,7 +331,7 @@ set_combiner_operand(struct gl_context *ctx,
       return;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
 
    if (alpha)
       texUnit->Combine.OperandA[term] = param;
@@ -366,13 +366,13 @@ set_combiner_scale(struct gl_context *ctx,
    case GL_RGB_SCALE:
       if (texUnit->Combine.ScaleShiftRGB == shift)
          return;
-      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
       texUnit->Combine.ScaleShiftRGB = shift;
       break;
    case GL_ALPHA_SCALE:
       if (texUnit->Combine.ScaleShiftA == shift)
          return;
-      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
       texUnit->Combine.ScaleShiftA = shift;
       break;
    default:
@@ -444,7 +444,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
       if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
         if (texUnit->LodBias == param[0])
            return;
-        FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+        FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
          texUnit->LodBias = param[0];
       }
       else {
index 24ba295746a5319d2711e181c057bcbbb96120cb..1b8d187cd3b267f180b57ae3f4b973fc997c74f1 100644 (file)
@@ -133,7 +133,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
             return;
          }
 
-         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
          texgen->Mode = mode;
          texgen->_ModeBit = bit;
       }
@@ -147,7 +147,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
          }
          if (TEST_EQ_4V(texgen->ObjectPlane, params))
             return;
-         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
          COPY_4FV(texgen->ObjectPlane, params);
       }
       break;
@@ -169,7 +169,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
                                 ctx->ModelviewMatrixStack.Top->inv);
          if (TEST_EQ_4V(texgen->EyePlane, tmp))
             return;
-         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
          COPY_4FV(texgen->EyePlane, tmp);
       }
       break;
index efbf30b8280b219cf5cdd1ec6051b8506aedebb9..1a00d251324fe2ef5f018889df33230d55f3fc18 100644 (file)
@@ -3225,7 +3225,7 @@ _mesa_texture_sub_image(struct gl_context *ctx, GLuint dims,
 
          check_gen_mipmap(ctx, target, texObj, level);
 
-         /* NOTE: Don't signal _NEW_TEXTURE since we've only changed
+         /* NOTE: Don't signal _NEW_TEXTURE_OBJECT since we've only changed
           * the texel data, not the texture format, size, etc.
           */
       }
@@ -3817,7 +3817,7 @@ _mesa_copy_texture_sub_image(struct gl_context *ctx, GLuint dims,
 
          check_gen_mipmap(ctx, target, texObj, level);
 
-         /* NOTE: Don't signal _NEW_TEXTURE since we've only changed
+         /* NOTE: Don't signal _NEW_TEXTURE_OBJECT since we've only changed
           * the texel data, not the texture format, size, etc.
           */
       }
@@ -4523,7 +4523,7 @@ _mesa_compressed_texture_sub_image(struct gl_context *ctx, GLuint dims,
 
          check_gen_mipmap(ctx, target, texObj, level);
 
-         /* NOTE: Don't signal _NEW_TEXTURE since we've only changed
+         /* NOTE: Don't signal _NEW_TEXTURE_OBJECT since we've only changed
           * the texel data, not the texture format, size, etc.
           */
       }
index 25b959d1814a96c6fcadffe61ffe71cf148d1635..a5e64c3e57bdf9e35ea3f7ef7159ed7bbaabb319 100644 (file)
@@ -932,7 +932,7 @@ _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj)
 {
    texObj->_BaseComplete = GL_FALSE;
    texObj->_MipmapComplete = GL_FALSE;
-   ctx->NewState |= _NEW_TEXTURE;
+   ctx->NewState |= _NEW_TEXTURE_OBJECT;
 }
 
 
@@ -1412,7 +1412,7 @@ unbind_textures_from_unit(struct gl_context *ctx, GLuint unit)
          ctx->Driver.BindTexture(ctx, unit, 0, texObj);
 
       texUnit->_BoundTextures &= ~(1 << index);
-      ctx->NewState |= _NEW_TEXTURE;
+      ctx->NewState |= _NEW_TEXTURE_OBJECT;
    }
 }
 
@@ -1482,7 +1482,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
 
             _mesa_unlock_texture(ctx, delObj);
 
-            ctx->NewState |= _NEW_TEXTURE;
+            ctx->NewState |= _NEW_TEXTURE_OBJECT;
 
             /* The texture _name_ is now free for re-use.
              * Remove it from the hash table now.
@@ -1531,7 +1531,7 @@ _mesa_delete_nameless_texture(struct gl_context *ctx,
    }
    _mesa_unlock_texture(ctx, texObj);
 
-   ctx->NewState |= _NEW_TEXTURE;
+   ctx->NewState |= _NEW_TEXTURE_OBJECT;
 
    /* Unreference the texobj.  If refcount hits zero, the texture
     * will be deleted.
@@ -1634,7 +1634,7 @@ bind_texture(struct gl_context *ctx,
    }
 
    /* flush before changing binding */
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
 
    /* If the refcount on the previously bound texture is decremented to
     * zero, it'll be deleted here.
@@ -1915,7 +1915,7 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
       }
    }
 
-   ctx->NewState |= _NEW_TEXTURE;
+   ctx->NewState |= _NEW_TEXTURE_OBJECT;
 }
 
 
@@ -2019,7 +2019,7 @@ _mesa_lock_context_textures( struct gl_context *ctx )
    mtx_lock(&ctx->Shared->TexMutex);
 
    if (ctx->Shared->TextureStateStamp != ctx->TextureStateTimestamp) {
-      ctx->NewState |= _NEW_TEXTURE;
+      ctx->NewState |= _NEW_TEXTURE_OBJECT;
       ctx->TextureStateTimestamp = ctx->Shared->TextureStateStamp;
    }
 }
index 4db406fa9f645422859761bc31b615c4eaf82757..25165e4ededc2be46e1883b7143e43678f34b42b 100644 (file)
@@ -233,21 +233,21 @@ set_swizzle_component(GLuint *swizzle, GLuint comp, GLuint swz)
 static inline void
 flush(struct gl_context *ctx)
 {
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
 }
 
 
 /**
  * This is called just prior to changing any texture object state which
  * could affect texture completeness (texture base level, max level).
- * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
+ * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE_OBJECT
  * state flag and then mark the texture object as 'incomplete' so that any
  * per-texture derived state gets recomputed.
  */
 static inline void
 incomplete(struct gl_context *ctx, struct gl_texture_object *texObj)
 {
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
    _mesa_dirty_texobj(ctx, texObj);
 }
 
@@ -982,7 +982,7 @@ _mesa_texture_parameterIiv(struct gl_context *ctx,
          _mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameterIiv(texture)");
          return;
       }
-      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
       /* set the integer-valued border color */
       COPY_4V(texObj->Sampler.BorderColor.i, params);
       break;
@@ -1004,7 +1004,7 @@ _mesa_texture_parameterIuiv(struct gl_context *ctx,
          _mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameterIuiv(texture)");
          return;
       }
-      FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+      FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
       /* set the unsigned integer-valued border color */
       COPY_4V(texObj->Sampler.BorderColor.ui, params);
       break;
index 70e014cab6375129a527a41c082ffedefe612fdc..87c4d4a8881829e370e400b5791f4fd0c3bc92f1 100644 (file)
@@ -306,7 +306,7 @@ _mesa_ActiveTexture(GLenum texture)
       return;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+   FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
 
    ctx->Texture.CurrentUnit = texUnit;
    if (ctx->Transform.MatrixMode == GL_TEXTURE) {
index 4d06313565f63cb8b0fd37796a382c1cd89c2525..e613898713be6a72d5739cdb514ad3a231fac037 100644 (file)
@@ -963,7 +963,7 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
 
         if (changed) {
            if (!flushed) {
-              FLUSH_VERTICES(ctx, _NEW_TEXTURE | _NEW_PROGRAM);
+              FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM);
               flushed = true;
            }
 
index 803d0afd8d37e7d5e42a282e14a68f5a7bbba886..91178e395cb5e13a3d4c7b6c6deee807fa30d6c0 100644 (file)
@@ -641,9 +641,9 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
       return _NEW_LIGHT;
 
    case STATE_TEXGEN:
-      return _NEW_TEXTURE;
+      return _NEW_TEXTURE_STATE;
    case STATE_TEXENV_COLOR:
-      return _NEW_TEXTURE | _NEW_BUFFERS | _NEW_FRAG_CLAMP;
+      return _NEW_TEXTURE_STATE | _NEW_BUFFERS | _NEW_FRAG_CLAMP;
 
    case STATE_FOG_COLOR:
       return _NEW_FOG | _NEW_BUFFERS | _NEW_FRAG_CLAMP;
index c7d25ecd75596d415d19288a0bba9c995476b8c8..fb98a340010454e87d70b83d80c3da571e5f0cb9 100644 (file)
@@ -258,7 +258,7 @@ void st_invalidate_state(struct gl_context * ctx, GLbitfield new_state)
       st->active_states = st_get_active_states(ctx);
    }
 
-   if (new_state & _NEW_TEXTURE) {
+   if (new_state & _NEW_TEXTURE_OBJECT) {
       st->dirty |= st->active_states &
                    (ST_NEW_SAMPLER_VIEWS |
                     ST_NEW_SAMPLERS |