Commit: bcddec8a45babb399dc0de4dc71aecf7774f3cb9
Author: Antony Riakiotakis
Date:   Fri Apr 17 17:31:45 2015 +0200
Branches: GPU_data_request
https://developer.blender.org/rBbcddec8a45babb399dc0de4dc71aecf7774f3cb9

Use BLI_assert instead of assert

===================================================================

M       source/blender/gpu/intern/gpux_draw.c
M       source/blender/gpu/intern/gpux_element.c
M       source/blender/gpu/intern/gpux_state.c
M       source/blender/gpu/intern/gpux_vbo.c

===================================================================

diff --git a/source/blender/gpu/intern/gpux_draw.c 
b/source/blender/gpu/intern/gpux_draw.c
index 80913f4..a1de374 100644
--- a/source/blender/gpu/intern/gpux_draw.c
+++ b/source/blender/gpu/intern/gpux_draw.c
@@ -3,11 +3,10 @@
 #include "gpux_element_private.h"
 #include "MEM_guardedalloc.h"
 
-#include <stdlib.h>
 //#include <stdio.h> /* TODO: remove */
 
 #ifdef TRUST_NO_ONE
-  #include <assert.h>
+  #include "BLI_utildefines.h"
 #endif /* TRUST_NO_ONE */
 
 #define REALLY_DRAW
@@ -25,8 +24,8 @@ void GPUx_draw_points(const VertexBuffer *vbo, const 
ElementList *el, const Poin
 
 #ifdef TRUST_NO_ONE
        if (el) {
-               assert(el->prim_type == GL_POINTS);
-               assert(max_index(el) < GPUx_vertex_ct(vbo));
+               BLI_assert(el->prim_type == GL_POINTS);
+               BLI_assert(max_index(el) < GPUx_vertex_ct(vbo));
        }
 #endif /* TRUST_NO_ONE */
 
@@ -52,8 +51,8 @@ void GPUx_draw_lines(const VertexBuffer *vbo, const 
ElementList *el, const LineD
 
 #ifdef TRUST_NO_ONE
        if (el) {
-               assert(el->prim_type == GL_LINES);
-               assert(max_index(el) < GPUx_vertex_ct(vbo));
+               BLI_assert(el->prim_type == GL_LINES);
+               BLI_assert(max_index(el) < GPUx_vertex_ct(vbo));
        }
 #endif /* TRUST_NO_ONE */
 
@@ -79,8 +78,8 @@ void GPUx_draw_triangles(const VertexBuffer *vbo, const 
ElementList *el, const P
 
 #ifdef TRUST_NO_ONE
        if (el) {
-               assert(el->prim_type == GL_TRIANGLES);
-               assert(max_index(el) < GPUx_vertex_ct(vbo));
+               BLI_assert(el->prim_type == GL_TRIANGLES);
+               BLI_assert(max_index(el) < GPUx_vertex_ct(vbo));
        }
 #endif /* TRUST_NO_ONE */
 
@@ -104,7 +103,7 @@ void GPUx_draw_primitives(const VertexBuffer *vbo, const 
ElementList *el, const
        int vert_per_prim = 0;
 
 #ifdef TRUST_NO_ONE
-       assert(max_index(el) < GPUx_vertex_ct(vbo));
+       BLI_assert(max_index(el) < GPUx_vertex_ct(vbo));
 #endif /* TRUST_NO_ONE */
 
        switch (el->prim_type) {
@@ -122,7 +121,7 @@ void GPUx_draw_primitives(const VertexBuffer *vbo, const 
ElementList *el, const
                        break;
                default:
 #ifdef TRUST_NO_ONE
-                       assert(false);
+                       BLI_assert(false);
 #else
                        return;
 #endif /* TRUST_NO_ONE */
@@ -165,8 +164,8 @@ void GPUx_draw_batch(const GPUxBatch *batch)
 
 #ifdef TRUST_NO_ONE
        if (batch->elem) {
-               assert(batch->elem->prim_type == batch->prim_type);
-               assert(max_index(batch->elem) < GPUx_vertex_ct(batch->buff));
+               BLI_assert(batch->elem->prim_type == batch->prim_type);
+               BLI_assert(max_index(batch->elem) < 
GPUx_vertex_ct(batch->buff));
        }
 #endif /* TRUST_NO_ONE */
 
@@ -185,7 +184,7 @@ void GPUx_draw_batch(const GPUxBatch *batch)
                        break;
                default:
 #ifdef TRUST_NO_ONE
-                       assert(false);
+                       BLI_assert(false);
 #else
                        return;
 #endif /* TRUST_NO_ONE */
diff --git a/source/blender/gpu/intern/gpux_element.c 
b/source/blender/gpu/intern/gpux_element.c
index 5f8adcf..cff4e97 100644
--- a/source/blender/gpu/intern/gpux_element.c
+++ b/source/blender/gpu/intern/gpux_element.c
@@ -1,7 +1,6 @@
 
 #include "gpux_element_private.h"
 #include "MEM_guardedalloc.h"
-#include <stdlib.h>
 
 /* private functions */
 
@@ -60,7 +59,7 @@ ElementList *GPUx_element_list_create(GLenum prim_type, 
unsigned prim_ct, unsign
                prim_vertex_ct = 3;
        else {
 #ifdef TRUST_NO_ONE
-               assert(false);
+               BLI_assert(false);
 #endif /* TRUST_NO_ONE */
                return NULL;
        }
@@ -110,9 +109,9 @@ void GPUx_set_point_vertex(ElementList *el, unsigned 
prim_idx, unsigned v1)
 {
        const unsigned offset = prim_idx;
 #ifdef TRUST_NO_ONE
-       assert(el->prim_type == GL_POINTS);
-       assert(prim_idx < el->prim_ct); /* prim out of range */
-       assert(v1 <= el->max_allowed_index); /* index out of range */
+       BLI_assert(el->prim_type == GL_POINTS);
+       BLI_assert(prim_idx < el->prim_ct); /* prim out of range */
+       BLI_assert(v1 <= el->max_allowed_index); /* index out of range */
 #endif /* TRUST_NO_ONE */
 #ifdef TRACK_INDEX_RANGE
        track_index_range(el, v1);
@@ -143,10 +142,10 @@ void GPUx_set_line_vertices(ElementList *el, unsigned 
prim_idx, unsigned v1, uns
 {
        const unsigned offset = prim_idx * 2;
 #ifdef TRUST_NO_ONE
-       assert(el->prim_type == GL_LINES);
-       assert(prim_idx < el->prim_ct); /* prim out of range */
-       assert(v1 <= el->max_allowed_index && v2 <= el->max_allowed_index); /* 
index out of range */
-       assert(v1 != v2); /* degenerate line */
+       BLI_assert(el->prim_type == GL_LINES);
+       BLI_assert(prim_idx < el->prim_ct); /* prim out of range */
+       BLI_assert(v1 <= el->max_allowed_index && v2 <= el->max_allowed_index); 
/* index out of range */
+       BLI_assert(v1 != v2); /* degenerate line */
 #endif /* TRUST_NO_ONE */
 #ifdef TRACK_INDEX_RANGE
        track_index_range(el, v1);
@@ -181,10 +180,10 @@ void GPUx_set_triangle_vertices(ElementList *el, unsigned 
prim_idx, unsigned v1,
 {
        const unsigned offset = prim_idx * 3;
 #ifdef TRUST_NO_ONE
-       assert(el->prim_type == GL_TRIANGLES);
-       assert(prim_idx < el->prim_ct); /* prim out of range */
-       assert(v1 <= el->max_allowed_index && v2 <= el->max_allowed_index && v3 
<= el->max_allowed_index); /* index out of range */
-       assert(v1 != v2 && v2 != v3 && v3 != v1); /* degenerate triangle */
+       BLI_assert(el->prim_type == GL_TRIANGLES);
+       BLI_assert(prim_idx < el->prim_ct); /* prim out of range */
+       BLI_assert(v1 <= el->max_allowed_index && v2 <= el->max_allowed_index 
&& v3 <= el->max_allowed_index); /* index out of range */
+       BLI_assert(v1 != v2 && v2 != v3 && v3 != v1); /* degenerate triangle */
 #endif /* TRUST_NO_ONE */
 #ifdef TRACK_INDEX_RANGE
        track_index_range(el, v1);
@@ -243,7 +242,7 @@ void GPUx_element_list_prime(ElementList *el)
        int prim_vertex_ct = 0, index_size = 0, total_size;
 
 #ifdef TRUST_NO_ONE
-       assert(el->vbo_id == 0);
+       BLI_assert(el->vbo_id == 0);
   #endif /* TRUST_NO_ONE */
 
        if (el->prim_type == GL_POINTS)
@@ -276,7 +275,7 @@ void GPUx_element_list_use_primed(const ElementList *el)
 {
 #ifdef USE_ELEM_VBO
   #ifdef TRUST_NO_ONE
-       assert(el->vbo_id);
+       BLI_assert(el->vbo_id);
   #endif /* TRUST_NO_ONE */
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, el->vbo_id);
 #else
diff --git a/source/blender/gpu/intern/gpux_state.c 
b/source/blender/gpu/intern/gpux_state.c
index 37ded07..f7cb689 100644
--- a/source/blender/gpu/intern/gpux_state.c
+++ b/source/blender/gpu/intern/gpux_state.c
@@ -5,7 +5,7 @@
 #include <string.h> /* memset */
 
 #ifdef TRUST_NO_ONE
-  #include <assert.h>
+  #include "BLI_utildefines.h"
 #endif /* TRUST_NO_ONE */
 
 const DrawState default_state = {
diff --git a/source/blender/gpu/intern/gpux_vbo.c 
b/source/blender/gpu/intern/gpux_vbo.c
index b3a1a0e..12cc082 100644
--- a/source/blender/gpu/intern/gpux_vbo.c
+++ b/source/blender/gpu/intern/gpux_vbo.c
@@ -1,7 +1,6 @@
 
 #include "GPUx_vbo.h"
 #include "MEM_guardedalloc.h"
-#include <stdlib.h>
 #include <string.h>
 
 /* VBOs are guaranteed for any GL >= 1.5
@@ -24,7 +23,7 @@
 #endif
 
 #ifdef TRUST_NO_ONE
-  #include <assert.h>
+  #include "BLI_utildefines.h"
 #endif /* TRUST_NO_ONE */
 
 #ifdef PRINT
@@ -58,7 +57,7 @@ static unsigned comp_sz(GLenum type)
 {
        const GLubyte sizes[] = {1,1,2,2,4,4,4}; /* uint32 might result in 
smaller code? */
 #ifdef TRUST_NO_ONE
-       assert(type >= GL_BYTE && type <= GL_FLOAT);
+       BLI_assert(type >= GL_BYTE && type <= GL_FLOAT);
 #endif /* TRUST_NO_ONE */
        return sizes[type - GL_BYTE];
 }
@@ -119,9 +118,9 @@ void GPUx_attrib_print(const VertexBuffer *buff, unsigned 
attrib_num)
        }
 #endif
 #ifdef TRUST_NO_ONE
-       assert(attrib_num < buff->attrib_ct);
-       assert(a->comp_type >= GL_BYTE && a->comp_type <= GL_FLOAT);
-       assert(a->data != NULL); /* attribute must be specified */
+       BLI_assert(attrib_num < buff->attrib_ct);
+       BLI_assert(a->comp_type >= GL_BYTE && a->comp_type <= GL_FLOAT);
+       BLI_assert(a->data != NULL); /* attribute must be specified */
 #endif /* TRUST_NO_ONE */
        if (a->comp_ct == 1)
                printf("attrib %s %s = {\n", singular[type_idx], var_name);
@@ -147,7 +146,7 @@ VertexBuffer *GPUx_vertex_buffer_create(unsigned a_ct, 
unsigned v_ct)
 {
        VertexBuffer *buff = MEM_callocN(sizeof(VertexBuffer), "VertexBuffer");
 #ifdef TRUST_NO_ONE
-       assert(a_ct >= 1 && a_ct <= 16);
+       BLI_assert(a_ct >= 1 && a_ct <= 16);
 #endif /* TRUST_NO_ONE */
        buff->attrib_ct = a_ct;
        buff->vertex_ct = v_ct;
@@ -182,7 +181,7 @@ static unsigned attrib_total_size(const VertexBuffer *buff, 
unsigned attrib_num)
 {
        const Attrib *attrib = buff->attribs + attrib_num;
 #ifdef TRUST_NO_ONE
-       assert(attrib_num < buff->attrib_ct);
+       BLI_assert(attrib_num < buff->attrib_ct);
 #endif /* TRUST_NO_ONE */
 
 #ifdef MESA_WORKAROUND
@@ -204,41 +203,41 @@ void GPUx_specify_attrib(VertexBuffer *buff, unsigned 
attrib_num,
 {
        Attrib *attrib;
 #ifdef TRUST_NO_ONE
-       assert(attrib_num < buff->attrib_ct);
-       assert(comp_type >= GL_BYTE && comp_type <= GL_FLOAT);
-       assert(comp_ct >= 1 && comp_ct <= 4);
+       BLI_assert(attrib_num < buff->attrib_ct);
+       BLI_assert(comp_type >= GL_BYTE && comp_type <= GL_FLOAT);
+       BLI_assert(comp_ct >= 1 && comp_ct <= 4);
 
        if (comp_type == GL_FLOAT)
-               assert(fetch_mode == KEEP_FLOAT);
+               BLI_assert(fetch_mode == KEEP_FLOAT);
        else
-               assert(fetch_mode != KEEP_FLOAT);
+               BLI_assert(fetch_mode != KEEP_FLOAT);
 
   #ifndef GENERIC_ATTRIB
        /* classic (non-generic) attributes each have their quirks
         * handle below */
        switch (attrib_array) {
                case GL_VERTEX_ARRAY:
-                       assert(comp_type == GL_FLOAT || comp_type == GL_SHORT 
|| comp_type == GL_INT);
+                       BLI_assert(comp_type == GL_FLOAT || comp_type == 
GL_SHORT || comp_type == GL_INT);
                        if (comp_type != GL_FLOAT)
-                               assert(fetch_mode == CONVERT_INT_TO_FLOAT);
-                       assert(comp_ct >= 2);
+                               BLI_assert(fetch_mode == CONVERT_INT_TO_FLOAT);
+                       BLI_assert(comp_ct >= 2);
                        break;
                case GL_NORMAL_ARRAY:
-                       assert(comp_type == GL_FLOAT || comp_type == GL_BYTE || 
comp_type == GL_SHORT || comp_type == GL_INT);
+                       BLI_assert(comp_type == GL_FLOAT || comp_type == 
GL_BYTE || comp_type == GL_SHORT || comp_type == GL_INT);
                        if (comp_type != GL_FLOAT)
-                               assert(fetch_mode == NORMALIZE_INT_TO_FLOAT);
-                       assert(comp_ct == 3);
+                               BLI_assert(fetch_mode == 
NORMALIZE_INT_TO_FLOAT);
+                       BLI_assert(comp_ct == 3);
                        break;
                case GL_COLOR_ARRAY:
                        /* any comp_type allowed */
                        if (comp_type != GL_FLOAT)
-                               assert(fetch_mode == NORMALIZE_INT_TO_FLOAT);
-                       assert(comp_ct >= 3);
+                               BLI_assert(fetch_mode == 
NORMALIZE_INT_TO_FLOAT);
+                       BLI_assert(comp_ct >= 3);

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to