Mesa (main): v3d: use helper to simplify things

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 26 10:16:56 UTC 2021


Module: Mesa
Branch: main
Commit: ea003df98e18cc5e028ddd6b24258eeb824a7850
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea003df98e18cc5e028ddd6b24258eeb824a7850

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Tue May 25 16:03:27 2021 +0200

v3d: use helper to simplify things

We can use the util_prim_restart_index_from_size helper to avoid
open-coding the implicit index size here.

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10981>

---

 src/gallium/drivers/v3d/v3dx_draw.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c
index f0f5228943e..cdf9d5d0878 100644
--- a/src/gallium/drivers/v3d/v3dx_draw.c
+++ b/src/gallium/drivers/v3d/v3dx_draw.c
@@ -1129,17 +1129,7 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
         /* Fall back for weird desktop GL primitive restart values. */
         if (info->primitive_restart &&
             info->index_size) {
-                uint32_t mask = ~0;
-
-                switch (info->index_size) {
-                case 2:
-                        mask = 0xffff;
-                        break;
-                case 1:
-                        mask = 0xff;
-                        break;
-                }
-
+                uint32_t mask = util_prim_restart_index_from_size(info->index_size);
                 if (info->restart_index != mask) {
                         util_draw_vbo_without_prim_restart(pctx, info, drawid_offset, indirect, &draws[0]);
                         return;



More information about the mesa-commit mailing list