mesa: remove derived _EffEnabled* fields and compute them at their only use
authorMarek Olšák <marek.olsak@amd.com>
Fri, 18 Nov 2022 23:18:33 +0000 (18:18 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Dec 2022 19:15:34 +0000 (19:15 +0000)
We were passing the fields to their only use and used them only once,
so let's just compute them there.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19953>

src/mesa/main/arrayobj.c
src/mesa/main/arrayobj.h
src/mesa/main/attrib.c
src/mesa/main/mtypes.h

index c1b4c9a..58d78fe 100644 (file)
@@ -541,12 +541,6 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
    const GLbitfield enabled = vao->Enabled;
    /* VBO array bits. */
    const GLbitfield vbos = vao->VertexAttribBufferMask;
-   const GLbitfield divisor_is_nonzero = vao->NonZeroDivisorMask;
-
-   /* Compute and store effectively enabled and mapped vbo arrays */
-   vao->_EffEnabledVBO = _mesa_vao_enable_to_vp_inputs(mode, enabled & vbos);
-   vao->_EffEnabledNonZeroDivisor =
-      _mesa_vao_enable_to_vp_inputs(mode, enabled & divisor_is_nonzero);
 
    /* Fast path when the VAO is updated too often. */
    if (vao->IsDynamic)
index 1e317f0..6f7acdc 100644 (file)
@@ -182,12 +182,24 @@ _mesa_get_derived_vao_masks(const struct gl_context *ctx,
                             GLbitfield *nonzero_divisor_attribs)
 {
    const struct gl_vertex_array_object *const vao = ctx->Array._DrawVAO;
+   const gl_attribute_map_mode mode = vao->_AttributeMapMode;
+   /* Enabled array bits. */
+   const GLbitfield enabled = vao->Enabled;
+   /* VBO array bits. */
+   const GLbitfield vbos = vao->VertexAttribBufferMask;
+   const GLbitfield divisor_is_nonzero = vao->NonZeroDivisorMask;
 
    assert(!vao->NewVertexBuffers && !vao->NewVertexElements);
-   *enabled_user_attribs = ~vao->_EffEnabledVBO &
-                           ctx->Array._DrawVAOEnabledAttribs;
-   *nonzero_divisor_attribs = vao->_EffEnabledNonZeroDivisor &
-                              ctx->Array._DrawVAOEnabledAttribs;
+
+   /* Mask of VERT_BIT_* enabled arrays past position/generic0 mapping. */
+   *enabled_user_attribs =
+      ~_mesa_vao_enable_to_vp_inputs(mode, enabled & vbos) &
+      ctx->Array._DrawVAOEnabledAttribs;
+
+   /* Same as above, but for instance divisors. */
+   *nonzero_divisor_attribs =
+      _mesa_vao_enable_to_vp_inputs(mode, enabled & divisor_is_nonzero) &
+      ctx->Array._DrawVAOEnabledAttribs;
 }
 
 /**
index 6572e4c..754a6e1 100644 (file)
@@ -1205,8 +1205,6 @@ copy_array_object(struct gl_context *ctx,
    /* Enabled must be the same than on push */
    dest->Enabled = src->Enabled;
    dest->_EnabledWithMapMode = src->_EnabledWithMapMode;
-   dest->_EffEnabledVBO = src->_EffEnabledVBO;
-   dest->_EffEnabledNonZeroDivisor = src->_EffEnabledNonZeroDivisor;
    /* The bitmask of bound VBOs needs to match the VertexBinding array */
    dest->VertexAttribBufferMask = src->VertexAttribBufferMask;
    dest->NonZeroDivisorMask = src->NonZeroDivisorMask;
index 974af94..697361d 100644 (file)
@@ -1680,18 +1680,6 @@ struct gl_vertex_array_object
     */
    GLbitfield NonDefaultStateMask;
 
-   /**
-    * Mask of VERT_BIT_* enabled arrays past position/generic0 mapping
-    *
-    * The value is valid past calling _mesa_update_vao_derived_arrays.
-    * Note that _mesa_update_vao_derived_arrays is called when binding
-    * the VAO to Array._DrawVAO.
-    */
-   GLbitfield _EffEnabledVBO;
-
-   /** Same as _EffEnabledVBO, but for instance divisors. */
-   GLbitfield _EffEnabledNonZeroDivisor;
-
    /** Denotes the way the position/generic0 attribute is mapped */
    gl_attribute_map_mode _AttributeMapMode;