[Mesa-dev] [PATCH 4/8] draw/gs: fix segfault in glsl-1.50-gs-mismatch-prim-type triangles_adjacency

Dave Airlie airlied at gmail.com
Mon Jun 9 22:57:04 PDT 2014


From: Dave Airlie <airlied at redhat.com>

This crashes on softpipe due to a lack of output memory allocated,

it appears we allocate memory for enough primtives, but not vertices
so convert to number of vertices.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/auxiliary/draw/draw_gs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index fc4f697..0a9bf81 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -555,7 +555,7 @@ 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 */
    unsigned total_verts_per_buffer = shader->primitive_boundary *
-      num_in_primitives;
+      max_out_prims * u_vertices_per_prim(shader->output_primitive);
 
    //Assume at least one primitive
    max_out_prims = MAX2(max_out_prims, 1);
-- 
1.9.3



More information about the mesa-dev mailing list