Mesa (master): vbo: clean up conditional blocks in ATTR_UNION

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 5 01:17:03 UTC 2020


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Thu Feb 27 15:30:08 2020 -0500

vbo: clean up conditional blocks in ATTR_UNION

Move the A != 0 code to the first block.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4052>

---

 src/mesa/vbo/vbo_exec_api.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 2f049ccd450..29773fbba4d 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -487,9 +487,10 @@ do {                                                                    \
       if (N>2) dest[2] = V2;                                            \
       if (N>3) dest[3] = V3;                                            \
       assert(exec->vtx.attr[A].type == T);                              \
-   }                                                                    \
                                                                         \
-   if ((A) == 0) {                                                      \
+      /* we now have accumulated a per-vertex attribute */              \
+      ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;                    \
+   } else {                                                             \
       /* This is a glVertex call */                                     \
       uint32_t *dst = (uint32_t *)exec->vtx.buffer_ptr;                 \
       uint32_t *src = (uint32_t *)exec->vtx.vertex;                     \
@@ -523,9 +524,6 @@ do {                                                                    \
                                                                         \
       if (unlikely(++exec->vtx.vert_count >= exec->vtx.max_vert))       \
          vbo_exec_vtx_wrap(exec);                                       \
-   } else {                                                             \
-      /* we now have accumulated per-vertex attributes */               \
-      ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;                    \
    }                                                                    \
 } while (0)
 



More information about the mesa-commit mailing list