[Mesa-dev] [PATCH 4/7] gallium: drivers should reference vertex buffers

Brian Paul brianp at vmware.com
Mon Jan 3 07:43:38 PST 2011


On 12/29/2010 12:00 PM, Marek Olšák wrote:


This function should have a comment explaining exactly what it's doing:

> +static INLINE void util_copy_vertex_buffers(struct pipe_vertex_buffer *dst,
> +                                            unsigned *dst_count,
> +                                            const struct pipe_vertex_buffer *src,
> +                                            unsigned src_count)
> +{
> +   unsigned i;
> +
> +   for (i = 0; i<  src_count; i++) {
> +      pipe_resource_reference(&dst[i].buffer, src[i].buffer);
> +   }
> +   for (; i<  *dst_count; i++) {
> +      pipe_resource_reference(&dst[i].buffer, NULL);
> +   }
> +
> +   *dst_count = src_count;
> +   memcpy(dst, src, src_count * sizeof(struct pipe_vertex_buffer));
> +}
> +
>   #ifdef __cplusplus
>   }
>   #endif


More information about the mesa-dev mailing list