mesa: inline _mesa_draw_array_bits & _mesa_draw_current_bits
authorMarek Olšák <marek.olsak@amd.com>
Tue, 22 Nov 2022 09:37:31 +0000 (04:37 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Dec 2022 19:15:34 +0000 (19:15 +0000)
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.h
src/mesa/state_tracker/st_atom_array.cpp
src/mesa/state_tracker/st_context.c

index 09d655f..2914932 100644 (file)
@@ -154,23 +154,6 @@ _mesa_vao_enable_to_vp_inputs(gl_attribute_map_mode mode, GLbitfield enabled)
 
 
 /**
- * Helper functions for consuming backends to walk the
- * ctx->Array._DrawVAO for driver side array setup.
- * Note that mesa provides preprocessed minimal binding information
- * in the VAO. See _mesa_update_vao_derived_arrays for documentation.
- */
-
-/**
- * Return enabled vertex attribute bits for draw.
- */
-static inline GLbitfield
-_mesa_draw_array_bits(const struct gl_context *ctx)
-{
-   return ctx->Array._DrawVAOEnabledAttribs;
-}
-
-
-/**
  * Return the enabled user (= non-VBO) attrib mask and the non-zero divisor
  * attrib mask for the draw.
  *
@@ -216,15 +199,6 @@ _mesa_get_derived_vao_masks(const struct gl_context *ctx,
    }
 }
 
-/**
- * Return enabled current values attribute bits for draw.
- */
-static inline GLbitfield
-_mesa_draw_current_bits(const struct gl_context *ctx)
-{
-   return ~ctx->Array._DrawVAOEnabledAttribs;
-}
-
 
 /**
  * Return vertex buffer binding provided the attribute struct.
index e3b8556..759a322 100644 (file)
@@ -181,7 +181,7 @@ st_setup_arrays(struct st_context *st,
 
    setup_arrays<POPCNT_NO, UPDATE_ALL>
       (st, ctx->Array._DrawVAO, vp->Base.DualSlotInputs,
-       vp_variant->vert_attrib_mask, _mesa_draw_array_bits(ctx),
+       vp_variant->vert_attrib_mask, ctx->Array._DrawVAOEnabledAttribs,
        velements, vbuffer, num_vbuffers);
 }
 
@@ -201,7 +201,7 @@ st_setup_current(struct st_context *st,
    struct gl_context *ctx = st->ctx;
 
    /* Process values that should have better been uniforms in the application */
-   GLbitfield curmask = inputs_read & _mesa_draw_current_bits(ctx);
+   GLbitfield curmask = inputs_read & ~ctx->Array._DrawVAOEnabledAttribs;
    if (curmask) {
       unsigned num_attribs = util_bitcount_fast<POPCNT>(curmask);
       unsigned num_dual_attribs = util_bitcount_fast<POPCNT>(curmask &
@@ -276,7 +276,7 @@ st_setup_current_user(struct st_context *st,
    const GLbitfield dual_slot_inputs = vp->Base.DualSlotInputs;
 
    /* Process values that should have better been uniforms in the application */
-   GLbitfield curmask = inputs_read & _mesa_draw_current_bits(ctx);
+   GLbitfield curmask = inputs_read & ~ctx->Array._DrawVAOEnabledAttribs;
    /* For each attribute, make an own user buffer binding. */
    while (curmask) {
       const gl_vert_attrib attr = (gl_vert_attrib)u_bit_scan(&curmask);
@@ -323,7 +323,7 @@ st_update_array_templ(struct st_context *st,
    /* Setup arrays */
    setup_arrays<POPCNT, UPDATE>
       (st, ctx->Array._DrawVAO, dual_slot_inputs, inputs_read,
-       _mesa_draw_array_bits(ctx), &velements, vbuffer, &num_vbuffers);
+       ctx->Array._DrawVAOEnabledAttribs, &velements, vbuffer, &num_vbuffers);
 
    /* _NEW_CURRENT_ATTRIB */
    /* Setup zero-stride attribs. */
index cd2154e..9bc63b5 100644 (file)
@@ -108,7 +108,7 @@ static inline bool
 st_vp_uses_current_values(const struct gl_context *ctx)
 {
    const uint64_t inputs = ctx->VertexProgram._Current->info.inputs_read;
-   return _mesa_draw_current_bits(ctx) & inputs;
+   return ~ctx->Array._DrawVAOEnabledAttribs & inputs;
 }