[Mesa-dev] [PATCH 1/4] mesa: Draw indirect is not allowed if the default VAO is bound.

Ian Romanick idr at freedesktop.org
Wed Oct 21 07:52:02 PDT 2015


On 10/20/2015 10:22 AM, Ilia Mirkin wrote:
> On Tue, Oct 20, 2015 at 10:19 AM, Marta Lofstedt
> <marta.lofstedt at linux.intel.com> wrote:
>> From: Marta Lofstedt <marta.lofstedt at intel.com>
>>
>> From OpenGL ES 3.1 specification, section 10.5:
>> "DrawArraysIndirect requires that all data sourced for the
>> command, including the DrawArraysIndirectCommand
>> structure,  be in buffer objects,  and may not be called when
>> the default vertex array object is bound."
> 
> Is it possible to do this with desktop GL? AFAIK ARB_draw_indirect is
> only enabled for core profiles, and you can't draw at all in core
> without a VAO bound. So I think you can remove the _mesa_is_gles31
> check. [Might want to wait on confirmation for that, or double-check
> my claim yourself.]

Correct.  We do this check for core profile in check_valid_to_render
because a VAO is always required.

>> Signed-off-by: Marta Lofstedt <marta.lofstedt at linux.intel.com>
>> ---
>>  src/mesa/main/api_validate.c | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
>> index a46c194..c5628f5 100644
>> --- a/src/mesa/main/api_validate.c
>> +++ b/src/mesa/main/api_validate.c
>> @@ -698,6 +698,19 @@ valid_draw_indirect(struct gl_context *ctx,
>>  {
>>     const GLsizeiptr end = (GLsizeiptr)indirect + size;
>>
>> +   /*
>> +    * OpenGL ES 3.1 spec. section 10.5:
>> +    * "DrawArraysIndirect requires that all data sourced for the
>> +    * command, including the DrawArraysIndirectCommand
>> +    * structure,  be in buffer objects,  and may not be called when
>> +    * the default vertex array object is bound."
>> +    */
>> +   if (_mesa_is_gles31(ctx) && (ctx->Array.VAO == ctx->Array.DefaultVAO)) {
>> +      _mesa_error(ctx, GL_INVALID_OPERATION,
>> +                  "%s(The default VAO is bound)", name);

We should use the same error here that is used in check_valid_to_render
for core profile:

         _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no VAO bound)",
function);

>> +      return GL_FALSE;
>> +   }
>> +
>>     if (!_mesa_valid_prim_mode(ctx, mode, name))
>>        return GL_FALSE;
>>
>> --
>> 2.1.4
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list