Mesa (master): gallium: util_set_vertex_buffers_mask(..): make use of u_bit_consecutive(..)

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Sep 14 18:03:13 UTC 2019


Module: Mesa
Branch: master
Commit: 9466e4cfabc0419264a1d53372cda8c970267b0c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9466e4cfabc0419264a1d53372cda8c970267b0c

Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date:   Fri Sep 13 09:04:45 2019 +0200

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 <christian.gmeiner at gmail.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

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




More information about the mesa-commit mailing list