diff options
author | Christian Gmeiner <[email protected]> | 2019-09-13 09:04:45 +0200 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-09-14 17:45:47 +0000 |
commit | 9466e4cfabc0419264a1d53372cda8c970267b0c (patch) | |
tree | 75a2b7dd58ade67a7d289e2e9742be7ebedf724c | |
parent | 53a38e30157871dec45eed2bb22b394dd1a16b6b (diff) |
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 <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/util/u_helpers.c | 5 |
1 files 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); } } |