vbo: clean up conditional blocks in ATTR_UNION
authorMarek Olšák <marek.olsak@amd.com>
Thu, 27 Feb 2020 20:30:08 +0000 (15:30 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 5 Mar 2020 00:54:43 +0000 (19:54 -0500)
Move the A != 0 code to the first block.

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

src/mesa/vbo/vbo_exec_api.c

index 2f049ccd450e03591cfc49af77c70aa0c758a755..29773fbba4dc425d0b163cedf355fcf6ee97b415 100644 (file)
@@ -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)