Mesa (master): draw: replace assert(0) with debug_warn_once()

Brian Paul brianp at kemper.freedesktop.org
Sat Jan 7 21:19:01 UTC 2012


Module: Mesa
Branch: master
Commit: f0f623a9075107461438468e1aea6bca3a3234f3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0f623a9075107461438468e1aea6bca3a3234f3

Author: Brian Paul <brianp at vmware.com>
Date:   Sat Jan  7 14:16:27 2012 -0700

draw: replace assert(0) with debug_warn_once()

If the assertion was hit, it probably meant that we were unable to allocate
or map a vertex buffer.  Instead of dying in a debug build, issue a warning
and continue.

---

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

diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index fbbaa81..942ddc4 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -150,7 +150,7 @@ draw_pt_emit(struct pt_emit *emit,
 
    hw_verts = render->map_vertices( render );
    if (!hw_verts) {
-      assert(0);
+      debug_warn_once("map of vertex buffer failed (out of memory?)");
       return;
    }
 
@@ -262,7 +262,7 @@ draw_pt_emit_linear(struct pt_emit *emit,
    return;
 
 fail:
-   assert(0);
+   debug_warn_once("allocate or map of vertex buffer failed (out of memory?)");
    return;
 }
 
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index 8485081..f30db13 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -201,7 +201,7 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle,
 
    hw_verts = draw->render->map_vertices( draw->render );
    if (!hw_verts) {
-      assert(0);
+      debug_warn_once("vertex buffer allocation failed (out of memory?)");
       return;
    }
 
@@ -292,7 +292,7 @@ static void fetch_emit_run_linear( struct draw_pt_middle_end *middle,
    return;
 
 fail:
-   assert(0);
+   debug_warn_once("allocate or map of vertex buffer failed (out of memory?)");
    return;
 }
 
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 b875f64..870b23b 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -236,7 +236,7 @@ fse_run_linear(struct draw_pt_middle_end *middle,
    return;
 
 fail:
-   assert(0);
+   debug_warn_once("allocate or map of vertex buffer failed (out of memory?)");
    return;
 }
 
@@ -293,7 +293,7 @@ fse_run(struct draw_pt_middle_end *middle,
    return;
 
 fail:
-   assert(0);
+   debug_warn_once("allocate or map of vertex buffer failed (out of memory?)");
    return;
 }
 




More information about the mesa-commit mailing list