summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-07-22 11:18:45 -0600
committerBrian Paul <[email protected]>2010-07-22 11:18:54 -0600
commitca3238f3fce89b4641833d1722d03c5d23b3e081 (patch)
tree73e9e5bba33c8d0f8011accf254d27d18db38074 /src/gallium
parent63ba1ec3c1192a1b7299e5768e7721638cd5fa0b (diff)
draw: added new assertions to clipping code
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index 122b1c79689..1cf6ee7a7f9 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -262,6 +262,7 @@ do_clip_tri( struct draw_stage *stage,
clipmask &= ~(1<<plane_idx);
+ assert(n < MAX_CLIPPED_VERTICES);
inlist[n] = inlist[0]; /* prevent rotation of vertices */
for (i = 1; i <= n; i++) {
@@ -270,11 +271,17 @@ do_clip_tri( struct draw_stage *stage,
float dp = dot4( vert->clip, plane );
if (!IS_NEGATIVE(dp_prev)) {
+ assert(outcount < MAX_CLIPPED_VERTICES);
outlist[outcount++] = vert_prev;
}
if (DIFFERENT_SIGNS(dp, dp_prev)) {
- struct vertex_header *new_vert = clipper->stage.tmp[tmpnr++];
+ struct vertex_header *new_vert;
+
+ assert(tmpnr < MAX_CLIPPED_VERTICES+1);
+ new_vert = clipper->stage.tmp[tmpnr++];
+
+ assert(outcount < MAX_CLIPPED_VERTICES);
outlist[outcount++] = new_vert;
if (IS_NEGATIVE(dp)) {
@@ -317,12 +324,14 @@ do_clip_tri( struct draw_stage *stage,
if (clipper->flat) {
if (stage->draw->rasterizer->flatshade_first) {
if (inlist[0] != header->v[0]) {
+ assert(tmpnr < MAX_CLIPPED_VERTICES + 1);
inlist[0] = dup_vert(stage, inlist[0], tmpnr++);
copy_colors(stage, inlist[0], header->v[0]);
}
}
else {
if (inlist[0] != header->v[2]) {
+ assert(tmpnr < MAX_CLIPPED_VERTICES + 1);
inlist[0] = dup_vert(stage, inlist[0], tmpnr++);
copy_colors(stage, inlist[0], header->v[2]);
}