[Mesa-dev] [PATCH v2 3/4] mesa: move glMultiDrawArrays to vbo and fix error handling

Nils Wallménius nils.wallmenius at gmail.com
Sat Apr 15 13:51:19 UTC 2017


Hi Nicolai,

Re-replying as I seem to have messed up the quoting. Anyway a question
about a loop index below.

Den 13 apr. 2017 21:29 skrev "Nicolai Hähnle" <nhaehnle at gmail.com>:

From: Nicolai Hähnle <nicolai.haehnle at amd.com>

[snip]


+/**
+ * Called to error check the function parameters.

+ *
+ * Note that glMultiDrawArrays is not part of GLES, so there's limited
scope
+ * for sharing code with the validation of glDrawArrays.
+ */
+bool
+_mesa_validate_MultiDrawArrays(struct gl_context *ctx, GLenum mode,
+                               const GLsizei *count, GLsizei primcount)
+{
+   int i;
+
+   FLUSH_CURRENT(ctx, 0);
+
+   if (!_mesa_valid_prim_mode(ctx, mode, "glMultiDrawArrays"))
+      return false;
+
+   if (!check_valid_to_render(ctx, "glMultiDrawArrays"))
+      return false;
+
+   if (primcount < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glMultiDrawArrays(primcount=%d)",
+                  primcount);
+      return false;
+   }
+
+   for (i = 0; i < primcount; ++i) {
+      if (count[i] < 0) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glMultiDrawArrays(count[%d]=%
d)",
+                     i, count[i]);
+         return false;
+      }
+   }
+
+   if (need_xfb_remaining_prims_check(ctx)) {
+      struct gl_transform_feedback_object *xfb_obj
+         = ctx->TransformFeedback.CurrentObject;
+      size_t prim_count = 0;
+
+      for (i = 0; i < prim_count; ++i)
+         prim_count += vbo_count_tessellated_primitives(mode, count[i], 1);


As prim_count is 0 the above loop will iterate 0 times, perhaps a mixup
with primcount?

BR
Nils

[snip]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170415/8ff099c6/attachment.html>


More information about the mesa-dev mailing list