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

Nicolai Hähnle nicolai.haehnle at amd.com
Sun Apr 16 08:43:53 UTC 2017


On 15.04.2017 15:51, Nils Wallménius wrote:
> 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
> <mailto:nhaehnle at gmail.com>>:
>
>     From: Nicolai Hähnle <nicolai.haehnle at amd.com
>     <mailto: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?

Yes, you're right. I'll update this once I get back.

Cheers,
Nicolai

>
> BR
> Nils
>
> [snip]
>



More information about the mesa-dev mailing list