From: Christian Gmeiner Date: Fri, 13 Sep 2019 07:04:45 +0000 (+0200) Subject: gallium: util_set_vertex_buffers_mask(..): make use of u_bit_consecutive(..) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9466e4cfabc0419264a1d53372cda8c970267b0c;p=mesa.git gallium: util_set_vertex_buffers_mask(..): make use of u_bit_consecutive(..) Also move the clearing of the bits out of if/else. Signed-off-by: Christian Gmeiner Reviewed-by: Eric Anholt --- diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c index c9da90c775a..00a1a9791fa 100644 --- a/src/gallium/auxiliary/util/u_helpers.c +++ b/src/gallium/auxiliary/util/u_helpers.c @@ -52,6 +52,8 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, dst += start_slot; + *enabled_buffers &= ~u_bit_consecutive(start_slot, count); + if (src) { for (i = 0; i < count; i++) { if (src[i].buffer.resource) @@ -66,15 +68,12 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, /* Copy over the other members of pipe_vertex_buffer. */ memcpy(dst, src, count * sizeof(struct pipe_vertex_buffer)); - *enabled_buffers &= ~(((1ull << count) - 1) << start_slot); *enabled_buffers |= bitmask << start_slot; } else { /* Unreference the buffers. */ for (i = 0; i < count; i++) pipe_vertex_buffer_unreference(&dst[i]); - - *enabled_buffers &= ~(((1ull << count) - 1) << start_slot); } }