From 9466e4cfabc0419264a1d53372cda8c970267b0c Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Fri, 13 Sep 2019 09:04:45 +0200 Subject: [PATCH] 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 --- src/gallium/auxiliary/util/u_helpers.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); } } -- 2.30.2