Mesa (main): mesa/vbo: be more comprehensive for degenerate primitive conversion in dlists

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 3 14:33:31 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Nov 16 10:57:24 2021 -0500

mesa/vbo: be more comprehensive for degenerate primitive conversion in dlists

these shouldn't result in any sort of draw, and passing the unsupported primtype
to the driver is invalid

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13845>

---

 src/mesa/vbo/vbo_save_api.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index cde53f6350e..ec5c98d8a4b 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -645,12 +645,11 @@ compile_vertex_list(struct gl_context *ctx)
                            PV_LAST, PV_LAST,
                            &pmode, &index_size, &new_count,
                            &trans_func);
-         if (new_count > 0) {
+         if (new_count > 0)
             trans_func(original_prims[i].start, new_count, tmp_indices);
-            vertex_count = new_count;
-            mode = (GLubyte)pmode;
-            converted_prim = true;
-         }
+         vertex_count = new_count;
+         mode = (GLubyte)pmode;
+         converted_prim = true;
       }
 
       /* If 2 consecutive prims use the same mode => merge them. */
@@ -734,9 +733,10 @@ compile_vertex_list(struct gl_context *ctx)
          merged_prims[last_valid_prim].count = idx - start;
       }
       merged_prims[last_valid_prim].mode = mode;
-   }
 
-   assert(idx > 0 && idx <= max_index_count);
+      /* converted prims will filter incomplete primitives and may have no indices */
+      assert((idx > 0 || converted_prim) && idx <= max_index_count);
+   }
 
    unsigned merged_prim_count = last_valid_prim + 1;
    node->cold->ib.ptr = NULL;



More information about the mesa-commit mailing list