From: Zack Rusin Date: Thu, 10 Jun 2010 09:15:55 +0000 (-0400) Subject: draw: make sure that the gs never outputs more data than we allocated for X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ef6d34f7e03f3d33c0ebad4191f3300a9062c4a;p=mesa.git draw: make sure that the gs never outputs more data than we allocated for --- diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 152437c4f72..4f88b27b7d5 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -191,7 +191,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle, fetch_count, fpme->vertex_size, fpme->vertex_size); - if (gshader) + if (gshader) { fetch_count = draw_geometry_shader_run(gshader, (const float (*)[4])pipeline_verts->data, @@ -200,6 +200,8 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle, fetch_count, fpme->vertex_size, fpme->vertex_size); + debug_assert(fetch_count <= alloc_count); + } } /* stream output needs to be done before clipping */ @@ -283,14 +285,17 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle, fpme->vertex_size, fpme->vertex_size); - if (geometry_shader) - count = draw_geometry_shader_run(geometry_shader, - (const float (*)[4])pipeline_verts->data, - ( float (*)[4])pipeline_verts->data, - draw->pt.user.gs_constants, - count, - fpme->vertex_size, - fpme->vertex_size); + if (geometry_shader) { + count = + draw_geometry_shader_run(geometry_shader, + (const float (*)[4])pipeline_verts->data, + ( float (*)[4])pipeline_verts->data, + draw->pt.user.gs_constants, + count, + fpme->vertex_size, + fpme->vertex_size); + debug_assert(count <= alloc_count); + } } /* stream output needs to be done before clipping */ @@ -368,14 +373,17 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle fpme->vertex_size, fpme->vertex_size); - if (geometry_shader) - count = draw_geometry_shader_run(geometry_shader, - (const float (*)[4])pipeline_verts->data, - ( float (*)[4])pipeline_verts->data, - draw->pt.user.gs_constants, - count, - fpme->vertex_size, - fpme->vertex_size); + if (geometry_shader) { + count = + draw_geometry_shader_run(geometry_shader, + (const float (*)[4])pipeline_verts->data, + ( float (*)[4])pipeline_verts->data, + draw->pt.user.gs_constants, + count, + fpme->vertex_size, + fpme->vertex_size); + debug_assert(count <= alloc_count); + } } /* stream output needs to be done before clipping */