mesa: inline _mesa_draw_array_bits & _mesa_draw_current_bits

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19953>
This commit is contained in:
Marek Olšák 2022-11-22 04:37:31 -05:00 committed by Marge Bot
parent a2cda5ba09
commit 01ef28f1af
3 changed files with 5 additions and 31 deletions

View file

@ -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.

View 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. */

View 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;
}