From 01ef28f1aff66a9239e22974e1d65708cb6a4c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 22 Nov 2022 04:37:31 -0500 Subject: [PATCH] mesa: inline _mesa_draw_array_bits & _mesa_draw_current_bits Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/mesa/main/arrayobj.h | 26 ------------------------ src/mesa/state_tracker/st_atom_array.cpp | 8 ++++---- src/mesa/state_tracker/st_context.c | 2 +- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index 09d655f0508..2914932868b 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -153,23 +153,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. diff --git a/src/mesa/state_tracker/st_atom_array.cpp b/src/mesa/state_tracker/st_atom_array.cpp index e3b8556f967..759a3221e6b 100644 --- a/src/mesa/state_tracker/st_atom_array.cpp +++ b/src/mesa/state_tracker/st_atom_array.cpp @@ -181,7 +181,7 @@ st_setup_arrays(struct st_context *st, setup_arrays (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(curmask); unsigned num_dual_attribs = util_bitcount_fast(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 (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. */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index cd2154eff11..9bc63b5f9af 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -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; }