From: Christian Gmeiner Date: Fri, 13 Sep 2019 06:09:24 +0000 (+0200) Subject: freedreno: calculate modified bit mask only once X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3340cbd398bb5a74287e794277d2423d11bbbc52;p=mesa.git freedreno: calculate modified bit mask only once Signed-off-by: Christian Gmeiner Reviewed-by: Rob Clark Part-of: --- diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index d9c8f9f89a2..4c558e14f0f 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -126,7 +126,7 @@ fd_set_shader_buffers(struct pipe_context *pctx, { struct fd_context *ctx = fd_context(pctx); struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[shader]; - unsigned mask = 0; + const unsigned modified_bits = u_bit_consecutive(start, count); if (buffers) { for (unsigned i = 0; i < count; i++) { @@ -138,8 +138,6 @@ fd_set_shader_buffers(struct pipe_context *pctx, (buf->buffer_size == buffers[i].buffer_size)) continue; - mask |= BIT(n); - buf->buffer_offset = buffers[i].buffer_offset; buf->buffer_size = buffers[i].buffer_size; pipe_resource_reference(&buf->buffer, buffers[i].buffer); @@ -150,8 +148,6 @@ fd_set_shader_buffers(struct pipe_context *pctx, so->enabled_mask &= ~BIT(n); } } else { - mask = (BIT(count) - 1) << start; - for (unsigned i = 0; i < count; i++) { unsigned n = i + start; struct pipe_shader_buffer *buf = &so->sb[n]; @@ -159,7 +155,7 @@ fd_set_shader_buffers(struct pipe_context *pctx, pipe_resource_reference(&buf->buffer, NULL); } - so->enabled_mask &= ~mask; + so->enabled_mask &= ~modified_bits; } ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_SSBO;