[Mesa-dev] [PATCH V2 14/15] vbo: map indirect buffer and extract params if doing sw primitive restart

Brian Paul brianp at vmware.com
Thu Nov 7 06:53:39 PST 2013


On 11/07/2013 12:06 AM, Chris Forbes wrote:
> V2: Check for mapping failure (thanks Brian)
>
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>   src/mesa/vbo/vbo_primitive_restart.c | 33 +++++++++++++++++++++++++++++++++
>   1 file changed, 33 insertions(+)
>
> diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c
> index 48d04e1..ee84f10 100644
> --- a/src/mesa/vbo/vbo_primitive_restart.c
> +++ b/src/mesa/vbo/vbo_primitive_restart.c
> @@ -180,6 +180,39 @@ vbo_sw_primitive_restart(struct gl_context *ctx,
>      GLboolean map_ib = ib->obj->Name && !ib->obj->Pointer;
>      void *ptr;
>
> +   /* If there is an indirect buffer, map it and extract the draw params */
> +   if (indirect && prims[0].is_indirect) {
> +      struct _mesa_prim new_prim = *prims;
> +      struct _mesa_index_buffer new_ib = *ib;
> +      const uint32_t *indirect_params;
> +      if (!ctx->Driver.MapBufferRange(ctx, 0, indirect->Size, GL_MAP_READ_BIT,
> +            (struct gl_buffer_object *)indirect)) {
> +
> +         /* something went wrong with mapping, give up */
> +         _mesa_error(ctx, GL_INVALID_OPERATION,
> +                     "failed to map indirect buffer for sw primitive restart");

I suspect we'd only hit this if we ran out of memory earlier and failed 
to allocate the buffer.  So, I'd probably report GL_OUT_OF_MEMORY here. 
  I think we do that in other places where mapping fails too.

The rest of the core Mesa changes look OK to me.  For those:
Reviewed-by: Brian Paul <brianp at vmware.com>




More information about the mesa-dev mailing list