Mesa (gallium-0.2): gallium: more vertex count checks

Alan Hourihane alanh at kemper.freedesktop.org
Wed Dec 10 12:09:18 UTC 2008


Module: Mesa
Branch: gallium-0.2
Commit: a8e7852b05f95cc695f3a05692a6ccd36298faf7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8e7852b05f95cc695f3a05692a6ccd36298faf7

Author: Alan Hourihane <alanh at tungstengraphics.com>
Date:   Wed Dec 10 12:02:24 2008 +0000

gallium: more vertex count checks

---

 src/gallium/auxiliary/draw/draw_pt_emit.c          |   11 +++++++++--
 src/gallium/auxiliary/draw/draw_pt_fetch_emit.c    |   10 ++++++++++
 .../auxiliary/draw/draw_pt_fetch_shade_emit.c      |   14 ++++++++++++--
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index 9c73d9c..c4fc93f 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -165,8 +165,10 @@ void draw_pt_emit( struct pt_emit *emit,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
-   if (count > 65535) /* FIXME */
-      return FALSE;
+   if (vertex_count > 65535) { /* FIXME */
+      assert(0);
+      return;
+   }
 
    /* XXX: and work out some way to coordinate the render primitive
     * between vbuf.c and here...
@@ -229,6 +231,11 @@ void draw_pt_emit_linear(struct pt_emit *emit,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
+   if (count > 65535) { /* FIXME */
+      assert(0);
+      return;
+   }
+
    /* XXX: and work out some way to coordinate the render primitive
     * between vbuf.c and here...
     */
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index 8ab0895..5727b91 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -229,6 +229,11 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
+   if (fetch_count > 65535) { /* FIXME */
+      assert(0);
+      return;
+   }
+
    hw_verts = draw->render->allocate_vertices( draw->render,
                                                (ushort)feme->translate->key.output_stride,
                                                (ushort)fetch_count );
@@ -283,6 +288,11 @@ static void fetch_emit_run_linear( struct draw_pt_middle_end *middle,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
+   if (count > 65535) { /* FIXME */
+      assert(0);
+      return;
+   }
+
    hw_verts = draw->render->allocate_vertices( draw->render,
                                                (ushort)feme->translate->key.output_stride,
                                                (ushort)count );
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index 77e630c..69580f1 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -234,8 +234,10 @@ static void fse_run_linear( struct draw_pt_middle_end *middle,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
-   if (count > 65535) /* FIXME */
-      return FALSE;
+   if (count > 65535) { /* FIXME */
+      assert(0);
+      return;
+   }
 
    hw_verts = draw->render->allocate_vertices( draw->render,
                                                (ushort)fse->key.output_stride,
@@ -296,6 +298,11 @@ fse_run(struct draw_pt_middle_end *middle,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
+   if (fetch_count > 65535) { /* FIXME */
+      assert(0);
+      return;
+   }
+
    hw_verts = draw->render->allocate_vertices( draw->render,
                                                (ushort)fse->key.output_stride,
                                                (ushort)fetch_count );
@@ -350,6 +357,9 @@ static boolean fse_run_linear_elts( struct draw_pt_middle_end *middle,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
+   if (count > 65535) /* FIXME */
+      return FALSE;
+
    hw_verts = draw->render->allocate_vertices( draw->render,
                                                (ushort)fse->key.output_stride,
                                                (ushort)count );




More information about the mesa-commit mailing list