[Mesa-dev] [PATCH 06/34] draw/gs: fix allocation of buffer for GS output vertices

Zack Rusin zackr at vmware.com
Mon Jul 29 11:09:26 PDT 2013


That looks wrong to me. We already account for the "other fields" in the vertex_size.

----- Original Message -----
> From: Bryan Cain <bryancain3 at gmail.com>
> 
> Before, it accounted for the size of the vertices but not the other fields
> in the vertex_header struct, which caused memory corruption.
> ---
>  src/gallium/auxiliary/draw/draw_gs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_gs.c
> b/src/gallium/auxiliary/draw/draw_gs.c
> index cd63e2b..78727c6 100644
> --- a/src/gallium/auxiliary/draw/draw_gs.c
> +++ b/src/gallium/auxiliary/draw/draw_gs.c
> @@ -560,7 +560,8 @@ int draw_geometry_shader_run(struct draw_geometry_shader
> *shader,
>     /* we allocate exactly one extra vertex per primitive to allow the GS to
>     emit
>      * overflown vertices into some area where they won't harm anyone */
>     output_verts->verts =
> -      (struct vertex_header *)MALLOC(output_verts->vertex_size *
> +      (struct vertex_header *)MALLOC(sizeof(struct vertex_header) +
> +                                     output_verts->vertex_size *
>                                       max_out_prims *
>                                       shader->primitive_boundary);
>  
> --
> 1.8.3.4
> 
> _______________________________________________
> 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