Mesa (master): draw: make sure that the gs never outputs more data than we allocated for
Zack Rusin
zack at kemper.freedesktop.org
Thu Jun 10 09:16:23 UTC 2010
Module: Mesa
Branch: master
Commit: 9ef6d34f7e03f3d33c0ebad4191f3300a9062c4a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9ef6d34f7e03f3d33c0ebad4191f3300a9062c4a
Author: Zack Rusin <zack at kde.org>
Date: Thu Jun 10 05:15:55 2010 -0400
draw: make sure that the gs never outputs more data than we allocated for
---
.../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 42 ++++++++++++--------
1 files changed, 25 insertions(+), 17 deletions(-)
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 152437c..4f88b27 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 */
More information about the mesa-commit
mailing list