diff options
author | Matt Turner <mattst88@gmail.com> | 2015-02-20 20:18:47 -0800 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2015-02-23 10:49:47 -0800 |
commit | bfcdb843830bba0190e00e35e3c5c18c4bdb5de1 (patch) | |
tree | d4e8eebb5d58b3b1ac6caa383bfcda258b19c6c1 /src/mesa/main | |
parent | 52049f8fd83f2ef31c2a4d645cfb7d7b2ab518a6 (diff) |
mesa: Use assert() instead of ASSERT wrapper.
Acked-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/mesa/main')
60 files changed, 319 insertions, 330 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 536326f6e14..ea015fd65bf 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1548,7 +1548,7 @@ _ae_update_state(struct gl_context *ctx) */ at->array = attribArray; at->binding = &vao->VertexBinding[attribArray->VertexBinding]; - ASSERT(!at->array->Normalized); + assert(!at->array->Normalized); at->func = AttribFuncsNV[at->array->Normalized] [at->array->Size-1] [TYPE_IDX(at->array->Type)]; @@ -1610,8 +1610,8 @@ _ae_update_state(struct gl_context *ctx) check_vbo(actx, vao->IndexBufferObj); - ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX); - ASSERT(aa - actx->arrays < 32); + assert(at - actx->attribs <= VERT_ATTRIB_MAX); + assert(aa - actx->arrays < 32); at->func = NULL; /* terminate the list */ aa->offset = -1; /* terminate the list */ diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index fe8cd6bbce0..f474951d729 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -118,8 +118,8 @@ _mesa_BindProgramARB(GLenum target, GLuint id) } /* Never null pointers */ - ASSERT(ctx->VertexProgram.Current); - ASSERT(ctx->FragmentProgram.Current); + assert(ctx->VertexProgram.Current); + assert(ctx->FragmentProgram.Current); if (ctx->Driver.BindProgram) ctx->Driver.BindProgram(ctx, target, newProg); @@ -524,7 +524,7 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, if (get_local_param_pointer(ctx, "glProgramLocalParameterARB", target, index, ¶m)) { - ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS); + assert(index < MAX_PROGRAM_LOCAL_PARAMS); ASSIGN_4V(param, x, y, z, w); } } @@ -639,8 +639,8 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) return; } - ASSERT(prog); - ASSERT(limits); + assert(prog); + assert(limits); /* Queries supported for both vertex and fragment programs */ switch (pname) { @@ -817,7 +817,7 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) return; } - ASSERT(prog); + assert(prog); if (pname != GL_PROGRAM_STRING_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(pname)"); diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 6440ea670b2..bdbd169ef9f 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -143,7 +143,7 @@ _mesa_reference_vao_(struct gl_context *ctx, struct gl_vertex_array_object *oldObj = *ptr; mtx_lock(&oldObj->Mutex); - ASSERT(oldObj->RefCount > 0); + assert(oldObj->RefCount > 0); oldObj->RefCount--; #if 0 printf("ArrayObj %p %d DECR to %d\n", @@ -153,13 +153,13 @@ _mesa_reference_vao_(struct gl_context *ctx, mtx_unlock(&oldObj->Mutex); if (deleteFlag) { - ASSERT(ctx->Driver.DeleteArrayObject); + assert(ctx->Driver.DeleteArrayObject); ctx->Driver.DeleteArrayObject(ctx, oldObj); } *ptr = NULL; } - ASSERT(!*ptr); + assert(!*ptr); if (vao) { /* reference new array object */ @@ -335,7 +335,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) struct gl_vertex_array_object * const oldObj = ctx->Array.VAO; struct gl_vertex_array_object *newObj = NULL; - ASSERT(oldObj != NULL); + assert(oldObj != NULL); if ( oldObj->Name == id ) return; /* rebinding the same array object- no change */ @@ -456,7 +456,7 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids) struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, ids[i]); if ( obj != NULL ) { - ASSERT( obj->Name == ids[i] ); + assert( obj->Name == ids[i] ); /* If the array object is currently bound, the spec says "the binding * for that object reverts to zero and the default vertex array diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c index 1eab7731aea..9d967b9e67e 100644 --- a/src/mesa/main/atifragshader.c +++ b/src/mesa/main/atifragshader.c @@ -255,7 +255,7 @@ _mesa_BindFragmentShaderATI(GLuint id) /* do actual bind */ ctx->ATIFragmentShader.Current = newProg; - ASSERT(ctx->ATIFragmentShader.Current); + assert(ctx->ATIFragmentShader.Current); if (newProg) newProg->RefCount++; diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index c37c0fea52b..b941937d82d 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -799,7 +799,7 @@ get_clamp_color(const struct gl_framebuffer *fb, GLenum clamp) if (clamp == GL_TRUE || clamp == GL_FALSE) return clamp; - ASSERT(clamp == GL_FIXED_ONLY); + assert(clamp == GL_FIXED_ONLY); if (!fb) return GL_TRUE; diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c index b97b564793c..b244c8de846 100644 --- a/src/mesa/main/blit.c +++ b/src/mesa/main/blit.c @@ -505,7 +505,7 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, return; } - ASSERT(ctx->Driver.BlitFramebuffer); + assert(ctx->Driver.BlitFramebuffer); ctx->Driver.BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index b372c68f21c..f026fc39341 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -446,7 +446,7 @@ _mesa_reference_buffer_object_(struct gl_context *ctx, struct gl_buffer_object *oldObj = *ptr; mtx_lock(&oldObj->Mutex); - ASSERT(oldObj->RefCount > 0); + assert(oldObj->RefCount > 0); oldObj->RefCount--; #if 0 printf("BufferObj %p %d DECR to %d\n", @@ -460,18 +460,18 @@ _mesa_reference_buffer_object_(struct gl_context *ctx, /* some sanity checking: don't delete a buffer still in use */ #if 0 /* unfortunately, these tests are invalid during context tear-down */ - ASSERT(ctx->Array.ArrayBufferObj != bufObj); - ASSERT(ctx->Array.VAO->IndexBufferObj != bufObj); - ASSERT(ctx->Array.VAO->Vertex.BufferObj != bufObj); + assert(ctx->Array.ArrayBufferObj != bufObj); + assert(ctx->Array.VAO->IndexBufferObj != bufObj); + assert(ctx->Array.VAO->Vertex.BufferObj != bufObj); #endif - ASSERT(ctx->Driver.DeleteBuffer); + assert(ctx->Driver.DeleteBuffer); ctx->Driver.DeleteBuffer(ctx, oldObj); } *ptr = NULL; } - ASSERT(!*ptr); + assert(!*ptr); if (bufObj) { /* reference new buffer */ @@ -614,7 +614,7 @@ _mesa_buffer_subdata( struct gl_context *ctx, GLintptrARB offset, (void) ctx; /* this should have been caught in _mesa_BufferSubData() */ - ASSERT(size + offset <= bufObj->Size); + assert(size + offset <= bufObj->Size); if (bufObj->Data) { memcpy( (GLubyte *) bufObj->Data + offset, data, size ); @@ -679,7 +679,7 @@ _mesa_buffer_clear_subdata(struct gl_context *ctx, GLsizeiptr i; GLubyte *dest; - ASSERT(ctx->Driver.MapBufferRange); + assert(ctx->Driver.MapBufferRange); dest = ctx->Driver.MapBufferRange(ctx, offset, size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT, @@ -908,7 +908,7 @@ _mesa_handle_bind_buffer_gen(struct gl_context *ctx, /* If this is a new buffer object id, or one which was generated but * never used before, allocate a buffer object now. */ - ASSERT(ctx->Driver.NewBufferObject); + assert(ctx->Driver.NewBufferObject); buf = ctx->Driver.NewBufferObject(ctx, buffer); if (!buf) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller); @@ -1124,7 +1124,7 @@ _mesa_buffer_unmap_all_mappings(struct gl_context *ctx, for (i = 0; i < MAP_COUNT; i++) { if (_mesa_bufferobj_mapped(bufObj, i)) { ctx->Driver.UnmapBuffer(ctx, bufObj, i); - ASSERT(bufObj->Mappings[i].Pointer == NULL); + assert(bufObj->Mappings[i].Pointer == NULL); bufObj->Mappings[i].AccessFlags = 0; } } @@ -1174,7 +1174,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) struct gl_vertex_array_object *vao = ctx->Array.VAO; GLuint j; - ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject); + assert(bufObj->Name == ids[i] || bufObj == &DummyBufferObject); _mesa_buffer_unmap_all_mappings(ctx, bufObj); @@ -1387,7 +1387,7 @@ _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data, bufObj->Written = GL_TRUE; bufObj->Immutable = GL_TRUE; - ASSERT(ctx->Driver.BufferData); + assert(ctx->Driver.BufferData); if (!ctx->Driver.BufferData(ctx, target, size, data, GL_DYNAMIC_DRAW, flags, bufObj)) { if (target == GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD) { @@ -1477,7 +1477,7 @@ _mesa_BufferData(GLenum target, GLsizeiptrARB size, size += 100; #endif - ASSERT(ctx->Driver.BufferData); + assert(ctx->Driver.BufferData); if (!ctx->Driver.BufferData(ctx, target, size, data, usage, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | @@ -1525,7 +1525,7 @@ _mesa_BufferSubData(GLenum target, GLintptrARB offset, bufObj->Written = GL_TRUE; - ASSERT(ctx->Driver.BufferSubData); + assert(ctx->Driver.BufferSubData); ctx->Driver.BufferSubData( ctx, offset, size, data, bufObj ); } @@ -1545,7 +1545,7 @@ _mesa_GetBufferSubData(GLenum target, GLintptrARB offset, return; } - ASSERT(ctx->Driver.GetBufferSubData); + assert(ctx->Driver.GetBufferSubData); ctx->Driver.GetBufferSubData( ctx, offset, size, data, bufObj ); } @@ -1722,7 +1722,7 @@ _mesa_MapBuffer(GLenum target, GLenum access) return NULL; } - ASSERT(ctx->Driver.MapBufferRange); + assert(ctx->Driver.MapBufferRange); map = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size, accessFlags, bufObj, MAP_USER); if (!map) { @@ -1734,9 +1734,9 @@ _mesa_MapBuffer(GLenum target, GLenum access) * This is important because other modules (like VBO) might call * the driver function directly. */ - ASSERT(bufObj->Mappings[MAP_USER].Pointer == map); - ASSERT(bufObj->Mappings[MAP_USER].Length == bufObj->Size); - ASSERT(bufObj->Mappings[MAP_USER].Offset == 0); + assert(bufObj->Mappings[MAP_USER].Pointer == map); + assert(bufObj->Mappings[MAP_USER].Length == bufObj->Size); + assert(bufObj->Mappings[MAP_USER].Offset == 0); bufObj->Mappings[MAP_USER].AccessFlags = accessFlags; } @@ -1824,9 +1824,9 @@ _mesa_UnmapBuffer(GLenum target) status = ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_USER); bufObj->Mappings[MAP_USER].AccessFlags = 0; - ASSERT(bufObj->Mappings[MAP_USER].Pointer == NULL); - ASSERT(bufObj->Mappings[MAP_USER].Offset == 0); - ASSERT(bufObj->Mappings[MAP_USER].Length == 0); + assert(bufObj->Mappings[MAP_USER].Pointer == NULL); + assert(bufObj->Mappings[MAP_USER].Offset == 0); + assert(bufObj->Mappings[MAP_USER].Length == 0); return status; } @@ -2203,7 +2203,7 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, return bufObj->Mappings[MAP_USER].Pointer; } - ASSERT(ctx->Driver.MapBufferRange); + assert(ctx->Driver.MapBufferRange); map = ctx->Driver.MapBufferRange(ctx, offset, length, access, bufObj, MAP_USER); if (!map) { @@ -2214,10 +2214,10 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, * This is important because other modules (like VBO) might call * the driver function directly. */ - ASSERT(bufObj->Mappings[MAP_USER].Pointer == map); - ASSERT(bufObj->Mappings[MAP_USER].Length == length); - ASSERT(bufObj->Mappings[MAP_USER].Offset == offset); - ASSERT(bufObj->Mappings[MAP_USER].AccessFlags == access); + assert(bufObj->Mappings[MAP_USER].Pointer == map); + assert(bufObj->Mappings[MAP_USER].Length == length); + assert(bufObj->Mappings[MAP_USER].Offset == offset); + assert(bufObj->Mappings[MAP_USER].AccessFlags == access); } return map; @@ -2278,7 +2278,7 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) return; } - ASSERT(bufObj->Mappings[MAP_USER].AccessFlags & GL_MAP_WRITE_BIT); + assert(bufObj->Mappings[MAP_USER].AccessFlags & GL_MAP_WRITE_BIT); if (ctx->Driver.FlushMappedBufferRange) ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj, diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index e5076e9bbde..37a9790923b 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -502,7 +502,7 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers, GLuint output; for (output = 0; output < n; output++) { mask[output] = draw_buffer_enum_to_bitmask(ctx, buffers[output]); - ASSERT(mask[output] != BAD_MASK); + assert(mask[output] != BAD_MASK); mask[output] &= supportedMask; } destMask = mask; @@ -533,7 +533,7 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers, if (destMask[buf]) { GLint bufIndex = ffs(destMask[buf]) - 1; /* only one bit should be set in the destMask[buf] field */ - ASSERT(_mesa_bitcount(destMask[buf]) == 1); + assert(_mesa_bitcount(destMask[buf]) == 1); if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) { updated_drawbuffers(ctx); fb->_ColorDrawBufferIndexes[buf] = bufIndex; diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 3c4ced8ed06..8d707bc34a1 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -218,7 +218,7 @@ _mesa_Clear( GLbitfield mask ) bufferMask |= BUFFER_BIT_ACCUM; } - ASSERT(ctx->Driver.Clear); + assert(ctx->Driver.Clear); ctx->Driver.Clear(ctx, bufferMask); } } diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 91a6cd136f4..9a5dbcfd3a4 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -200,16 +200,6 @@ static inline GLuint CPU_TO_LE32(GLuint x) #endif -/** - * ASSERT macro - */ -#if defined(DEBUG) -# define ASSERT(X) assert(X) -#else -# define ASSERT(X) -#endif - - /* * A trick to suppress uninitialized variable warning without generating any * code diff --git a/src/mesa/main/condrender.c b/src/mesa/main/condrender.c index 75f9d74bc88..77e4b95ee8f 100644 --- a/src/mesa/main/condrender.c +++ b/src/mesa/main/condrender.c @@ -55,7 +55,7 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode) return; } - ASSERT(ctx->Query.CondRenderMode == GL_NONE); + assert(ctx->Query.CondRenderMode == GL_NONE); /* Section 2.14 (Conditional Rendering) of the OpenGL 3.0 spec says: * @@ -70,7 +70,7 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode) "glBeginConditionalRender(bad queryId=%u)", queryId); return; } - ASSERT(q->Id == queryId); + assert(q->Id == queryId); switch (mode) { case GL_QUERY_WAIT: diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b186a1fad50..43acc9d283d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1644,7 +1644,7 @@ _mesa_make_current( struct gl_context *newCtx, /* We used to call _glapi_check_multithread() here. Now do it in drivers */ _glapi_set_context((void *) newCtx); - ASSERT(_mesa_get_current_context() == newCtx); + assert(_mesa_get_current_context() == newCtx); if (!newCtx) { _glapi_set_dispatch(NULL); /* none current */ @@ -1653,8 +1653,8 @@ _mesa_make_current( struct gl_context *newCtx, _glapi_set_dispatch(newCtx->CurrentDispatch); if (drawBuffer && readBuffer) { - ASSERT(_mesa_is_winsys_fbo(drawBuffer)); - ASSERT(_mesa_is_winsys_fbo(readBuffer)); + assert(_mesa_is_winsys_fbo(drawBuffer)); + assert(_mesa_is_winsys_fbo(readBuffer)); _mesa_reference_framebuffer(&newCtx->WinSysDrawBuffer, drawBuffer); _mesa_reference_framebuffer(&newCtx->WinSysReadBuffer, readBuffer); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index ec8662b3089..0c1a13fa4bf 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -824,7 +824,7 @@ struct dd_function_table { void (*BeginVertices)( struct gl_context *ctx ); /** - * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if + * If inside glBegin()/glEnd(), it should assert(0). Otherwise, if * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered * vertices, if FLUSH_UPDATE_CURRENT bit is set updates * __struct gl_contextRec::Current and gl_light_attrib::Material diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 025f6abd227..ff9ab07c6ec 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1035,7 +1035,7 @@ dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8) } else { /* make sure instruction size agrees */ - ASSERT(numNodes == InstSize[opcode]); + assert(numNodes == InstSize[opcode]); } } @@ -5089,7 +5089,7 @@ save_Attr1fNV(GLenum attr, GLfloat x) n[2].f = x; } - ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 1; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); @@ -5111,7 +5111,7 @@ save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y) n[3].f = y; } - ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 2; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); @@ -5134,7 +5134,7 @@ save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z) n[4].f = z; } - ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 3; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); @@ -5158,7 +5158,7 @@ save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) n[5].f = w; } - ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 4; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); @@ -5180,7 +5180,7 @@ save_Attr1fARB(GLenum attr, GLfloat x) n[2].f = x; } - ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 1; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); @@ -5202,7 +5202,7 @@ save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y) n[3].f = y; } - ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 2; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); @@ -5225,7 +5225,7 @@ save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z) n[4].f = z; } - ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 3; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); @@ -5249,7 +5249,7 @@ save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) n[5].f = w; } - ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 4; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 1865a66b9da..55035f214b3 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -173,7 +173,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, ctx->Current.RasterTexCoords[0] ); } else { - ASSERT(ctx->RenderMode == GL_SELECT); + assert(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } @@ -279,7 +279,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, ctx->Current.RasterTexCoords[0] ); } else { - ASSERT(ctx->RenderMode == GL_SELECT); + assert(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } @@ -355,7 +355,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, ctx->Current.RasterTexCoords[0] ); } else { - ASSERT(ctx->RenderMode == GL_SELECT); + assert(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } diff --git a/src/mesa/main/drawtex.c b/src/mesa/main/drawtex.c index 7c0ec832bb9..9c4fdf90e3b 100644 --- a/src/mesa/main/drawtex.c +++ b/src/mesa/main/drawtex.c @@ -46,7 +46,7 @@ draw_texture(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, if (ctx->NewState) _mesa_update_state(ctx); - ASSERT(ctx->Driver.DrawTex); + assert(ctx->Driver.DrawTex); ctx->Driver.DrawTex(ctx, x, y, z, width, height); _mesa_set_vp_override(ctx, GL_FALSE); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 11365ecc404..9008a386343 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1060,7 +1060,7 @@ void _mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state) { - ASSERT(state == 0 || state == 1); + assert(state == 0 || state == 1); switch (cap) { case GL_BLEND: if (!ctx->Extensions.EXT_draw_buffers2) { diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 478e4ed33db..f16b33fa378 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -1465,7 +1465,7 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) /* Too long error message. Whoever calls _mesa_error should use * shorter strings. */ - ASSERT(0); + assert(0); return; } @@ -1473,7 +1473,7 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) _mesa_lookup_enum_by_nr(error), s); if (len >= MAX_DEBUG_MESSAGE_LENGTH) { /* Same as above. */ - ASSERT(0); + assert(0); return; } diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 84cd7563be4..86c8f75a1d2 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -309,7 +309,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLfloat *pnts; struct gl_1d_map *map = NULL; - ASSERT(type == GL_FLOAT || type == GL_DOUBLE); + assert(type == GL_FLOAT || type == GL_DOUBLE); if (u1 == u2) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" ); @@ -391,7 +391,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat *pnts; struct gl_2d_map *map = NULL; - ASSERT(type == GL_FLOAT || type == GL_DOUBLE); + assert(type == GL_FLOAT || type == GL_DOUBLE); if (u1==u2) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" ); @@ -505,7 +505,7 @@ _mesa_GetnMapdvARB( GLenum target, GLenum query, GLsizei bufSize, GLdouble *v ) map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); - ASSERT(map1d || map2d); + assert(map1d || map2d); switch (query) { case GL_COEFF: @@ -595,7 +595,7 @@ _mesa_GetnMapfvARB( GLenum target, GLenum query, GLsizei bufSize, GLfloat *v ) map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); - ASSERT(map1d || map2d); + assert(map1d || map2d); switch (query) { case GL_COEFF: @@ -687,7 +687,7 @@ _mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v ) map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); - ASSERT(map1d || map2d); + assert(map1d || map2d); switch (query) { case GL_COEFF: diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 30536229764..f8d0d92bfb7 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -324,14 +324,14 @@ remove_attachment(struct gl_context *ctx, ctx->Driver.FinishRenderTexture(ctx, rb); if (att->Type == GL_TEXTURE) { - ASSERT(att->Texture); + assert(att->Texture); _mesa_reference_texobj(&att->Texture, NULL); /* unbind */ - ASSERT(!att->Texture); + assert(!att->Texture); } if (att->Type == GL_TEXTURE || att->Type == GL_RENDERBUFFER_EXT) { - ASSERT(!att->Texture); + assert(!att->Texture); _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); /* unbind */ - ASSERT(!att->Renderbuffer); + assert(!att->Renderbuffer); } att->Type = GL_NONE; att->Complete = GL_TRUE; @@ -433,7 +433,7 @@ set_texture_attachment(struct gl_context *ctx, if (att->Texture == texObj) { /* re-attaching same texture */ - ASSERT(att->Type == GL_TEXTURE); + assert(att->Type == GL_TEXTURE); } else { /* new attachment */ @@ -488,7 +488,7 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, mtx_lock(&fb->Mutex); att = get_attachment(ctx, fb, attachment); - ASSERT(att); + assert(att); if (rb) { set_renderbuffer_attachment(ctx, att, rb); if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { @@ -809,7 +809,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format, } } else { - ASSERT(format == GL_STENCIL); + assert(format == GL_STENCIL); if (ctx->Extensions.ARB_depth_texture && baseFormat == GL_DEPTH_STENCIL) { /* OK */ @@ -826,7 +826,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format, const GLenum baseFormat = _mesa_get_format_base_format(att->Renderbuffer->Format); - ASSERT(att->Renderbuffer); + assert(att->Renderbuffer); if (!att->Renderbuffer->InternalFormat || att->Renderbuffer->Width < 1 || att->Renderbuffer->Height < 1) { @@ -868,7 +868,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format, } } else { - ASSERT(att->Type == GL_NONE); + assert(att->Type == GL_NONE); /* complete */ return; } @@ -1239,7 +1239,7 @@ bind_renderbuffer(GLenum target, GLuint renderbuffer, bool allow_user_names) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindRenderbufferEXT"); return; } - ASSERT(newRb->AllocStorage); + assert(newRb->AllocStorage); _mesa_HashInsert(ctx->Shared->RenderBuffers, renderbuffer, newRb); newRb->RefCount = 1; /* referenced by hash table */ } @@ -1248,7 +1248,7 @@ bind_renderbuffer(GLenum target, GLuint renderbuffer, bool allow_user_names) newRb = NULL; } - ASSERT(newRb != &DummyRenderbuffer); + assert(newRb != &DummyRenderbuffer); _mesa_reference_renderbuffer(&ctx->CurrentRenderbuffer, newRb); } @@ -1339,7 +1339,7 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers) /* check if deleting currently bound renderbuffer object */ if (rb == ctx->CurrentRenderbuffer) { /* bind default */ - ASSERT(rb->RefCount >= 2); + assert(rb->RefCount >= 2); _mesa_BindRenderbuffer(GL_RENDERBUFFER_EXT, 0); } @@ -1838,7 +1838,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, rb->NumSamples = samples; /* Now allocate the storage */ - ASSERT(rb->AllocStorage); + assert(rb->AllocStorage); if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) { /* No error - check/set fields now */ /* If rb->Format == MESA_FORMAT_NONE, the format is unsupported. */ @@ -2036,7 +2036,7 @@ static void check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) { GLuint i; - ASSERT(ctx->Driver.RenderTexture); + assert(ctx->Driver.RenderTexture); if (_mesa_is_winsys_fbo(fb)) return; /* can't render to texture with winsys framebuffers */ @@ -2134,8 +2134,8 @@ bind_framebuffer(GLenum target, GLuint framebuffer, bool allow_user_names) newReadFb = ctx->WinSysReadBuffer; } - ASSERT(newDrawFb); - ASSERT(newDrawFb != &DummyFramebuffer); + assert(newDrawFb); + assert(newDrawFb != &DummyFramebuffer); /* save pointers to current/old framebuffers */ oldDrawFb = ctx->DrawBuffer; @@ -2227,17 +2227,17 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers) struct gl_framebuffer *fb; fb = _mesa_lookup_framebuffer(ctx, framebuffers[i]); if (fb) { - ASSERT(fb == &DummyFramebuffer || fb->Name == framebuffers[i]); + assert(fb == &DummyFramebuffer || fb->Name == framebuffers[i]); /* check if deleting currently bound framebuffer object */ if (fb == ctx->DrawBuffer) { /* bind default */ - ASSERT(fb->RefCount >= 2); + assert(fb->RefCount >= 2); _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } if (fb == ctx->ReadBuffer) { /* bind default */ - ASSERT(fb->RefCount >= 2); + assert(fb->RefCount >= 2); _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, 0); } diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index c51c20ddf02..395b00e1528 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -479,7 +479,7 @@ static struct ureg register_const4f( struct tnl_program *p, values[3].f = s3; idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4, &swizzle ); - ASSERT(swizzle == SWIZZLE_NOOP); + assert(swizzle == SWIZZLE_NOOP); return make_ureg(PROGRAM_CONSTANT, idx); } @@ -530,7 +530,7 @@ static void emit_arg( struct prog_src_register *src, src->Abs = 0; src->RelAddr = 0; /* Check that bitfield sizes aren't exceeded */ - ASSERT(src->Index == reg.idx); + assert(src->Index == reg.idx); } @@ -544,7 +544,7 @@ static void emit_dst( struct prog_dst_register *dst, dst->CondMask = COND_TR; /* always pass cond test */ dst->CondSwizzle = SWIZZLE_NOOP; /* Check that bitfield sizes aren't exceeded */ - ASSERT(dst->Index == reg.idx); + assert(dst->Index == reg.idx); } diff --git a/src/mesa/main/format_unpack.py b/src/mesa/main/format_unpack.py index 2276a1063f5..53bdf641d12 100644 --- a/src/mesa/main/format_unpack.py +++ b/src/mesa/main/format_unpack.py @@ -463,8 +463,8 @@ unpack_float_z_X8_UINT_Z24_UNORM(GLuint n, const void *src, GLfloat *dst) GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLfloat) ((s[i] >> 8) * scale); - ASSERT(dst[i] >= 0.0F); - ASSERT(dst[i] <= 1.0F); + assert(dst[i] >= 0.0F); + assert(dst[i] <= 1.0F); } } @@ -477,8 +477,8 @@ unpack_float_z_Z24_UNORM_X8_UINT(GLuint n, const void *src, GLfloat *dst) GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLfloat) ((s[i] & 0x00ffffff) * scale); - ASSERT(dst[i] >= 0.0F); - ASSERT(dst[i] <= 1.0F); + assert(dst[i] >= 0.0F); + assert(dst[i] <= 1.0F); } } diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 958d6f245ea..df852f303e5 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -107,8 +107,8 @@ GLint _mesa_get_format_bytes(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); - ASSERT(info->BytesPerBlock); - ASSERT(info->BytesPerBlock <= MAX_PIXEL_BYTES || + assert(info->BytesPerBlock); + assert(info->BytesPerBlock <= MAX_PIXEL_BYTES || _mesa_is_format_compressed(format)); return info->BytesPerBlock; } diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index dc0386d23be..5df1ecc4f07 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -223,8 +223,8 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb) if (att->Texture) { _mesa_reference_texobj(&att->Texture, NULL); } - ASSERT(!att->Renderbuffer); - ASSERT(!att->Texture); + assert(!att->Renderbuffer); + assert(!att->Texture); att->Type = GL_NONE; } } @@ -245,7 +245,7 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr, struct gl_framebuffer *oldFb = *ptr; mtx_lock(&oldFb->Mutex); - ASSERT(oldFb->RefCount > 0); + assert(oldFb->RefCount > 0); oldFb->RefCount--; deleteFlag = (oldFb->RefCount == 0); mtx_unlock(&oldFb->Mutex); @@ -296,8 +296,8 @@ _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, /* only resize if size is changing */ if (rb->Width != width || rb->Height != height) { if (rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height)) { - ASSERT(rb->Width == width); - ASSERT(rb->Height == height); + assert(rb->Width == width); + assert(rb->Height == height); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Resizing framebuffer"); @@ -402,8 +402,8 @@ _mesa_scissor_bounding_box(const struct gl_context *ctx, } } - ASSERT(bbox[0] <= bbox[1]); - ASSERT(bbox[2] <= bbox[3]); + assert(bbox[0] <= bbox[1]); + assert(bbox[2] <= bbox[3]); } /** @@ -621,8 +621,8 @@ update_color_read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb) fb->_ColorReadBuffer = NULL; /* legal! */ } else { - ASSERT(fb->_ColorReadBufferIndex >= 0); - ASSERT(fb->_ColorReadBufferIndex < BUFFER_COUNT); + assert(fb->_ColorReadBufferIndex >= 0); + assert(fb->_ColorReadBufferIndex < BUFFER_COUNT); fb->_ColorReadBuffer = fb->Attachment[fb->_ColorReadBufferIndex].Renderbuffer; } @@ -756,7 +756,7 @@ renderbuffer_exists(struct gl_context *ctx, if (!readBuf) { return GL_FALSE; } - ASSERT(_mesa_get_format_bits(readBuf->Format, GL_RED_BITS) > 0 || + assert(_mesa_get_format_bits(readBuf->Format, GL_RED_BITS) > 0 || _mesa_get_format_bits(readBuf->Format, GL_ALPHA_BITS) > 0 || _mesa_get_format_bits(readBuf->Format, GL_TEXTURE_LUMINANCE_SIZE) > 0 || _mesa_get_format_bits(readBuf->Format, GL_TEXTURE_INTENSITY_SIZE) > 0 || diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 3f9d745161d..2f4693ad6a0 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -758,7 +758,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_COMPRESSED_TEXTURE_FORMATS_ARB: v->value_int_n.n = _mesa_get_compressed_formats(ctx, v->value_int_n.ints); - ASSERT(v->value_int_n.n <= (int) ARRAY_SIZE(v->value_int_n.ints)); + assert(v->value_int_n.n <= (int) ARRAY_SIZE(v->value_int_n.ints)); break; case GL_MAX_VARYING_FLOATS_ARB: diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 1a152ec340c..d04cccd94d2 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -371,8 +371,8 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table, { struct hash_entry *entry; - ASSERT(table); - ASSERT(callback); + assert(table); + assert(callback); mtx_lock(&table->Mutex); table->InDeleteAll = GL_TRUE; hash_table_foreach(table->ht, entry) { @@ -401,7 +401,7 @@ _mesa_HashClone(const struct _mesa_HashTable *table) struct hash_entry *entry; struct _mesa_HashTable *clonetable; - ASSERT(table); + assert(table); mtx_lock(&table2->Mutex); clonetable = _mesa_NewHashTable(); @@ -437,8 +437,8 @@ _mesa_HashWalk(const struct _mesa_HashTable *table, struct _mesa_HashTable *table2 = (struct _mesa_HashTable *) table; struct hash_entry *entry; - ASSERT(table); - ASSERT(callback); + assert(table); + assert(callback); mtx_lock(&table2->WalkMutex); hash_table_foreach(table->ht, entry) { callback((uintptr_t)entry->key, entry->data, userData); diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index e97b006e071..711a19062a9 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -118,7 +118,7 @@ _mesa_image_offset( GLuint dimensions, GLint skipimages; /* for 3-D volume images */ GLintptr offset; - ASSERT(dimensions >= 1 && dimensions <= 3); + assert(dimensions >= 1 && dimensions <= 3); alignment = packing->Alignment; if (packing->RowLength > 0) { @@ -174,7 +174,7 @@ _mesa_image_offset( GLuint dimensions, if (remainder > 0) bytes_per_row += (alignment - remainder); - ASSERT(bytes_per_row % alignment == 0); + assert(bytes_per_row % alignment == 0); bytes_per_image = bytes_per_row * rows_per_image; @@ -288,7 +288,7 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, { GLint bytesPerRow, remainder; - ASSERT(packing); + assert(packing); if (type == GL_BITMAP) { if (packing->RowLength == 0) { @@ -336,7 +336,7 @@ _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, { GLint bytesPerRow, bytesPerImage, remainder; - ASSERT(packing); + assert(packing); if (type == GL_BITMAP) { if (packing->RowLength == 0) { @@ -476,7 +476,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src, if (!tempBuffer) return; - ASSERT(srcType != dstType); + assert(srcType != dstType); switch (srcType) { case GL_UNSIGNED_BYTE: @@ -499,7 +499,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src, const GLubyte (*src1)[4] = (const GLubyte (*)[4]) src; GLfloat (*dst4)[4] = (GLfloat (*)[4]) (useTemp ? tempBuffer : dst); GLuint i; - ASSERT(dstType == GL_FLOAT); + assert(dstType == GL_FLOAT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst4[i][RCOMP] = UBYTE_TO_FLOAT(src1[i][RCOMP]); @@ -532,7 +532,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src, const GLushort (*src2)[4] = (const GLushort (*)[4]) src; GLfloat (*dst4)[4] = (GLfloat (*)[4]) (useTemp ? tempBuffer : dst); GLuint i; - ASSERT(dstType == GL_FLOAT); + assert(dstType == GL_FLOAT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst4[i][RCOMP] = USHORT_TO_FLOAT(src2[i][RCOMP]); @@ -561,7 +561,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src, const GLfloat (*src4)[4] = (const GLfloat (*)[4]) src; GLushort (*dst2)[4] = (GLushort (*)[4]) (useTemp ? tempBuffer : dst); GLuint i; - ASSERT(dstType == GL_UNSIGNED_SHORT); + assert(dstType == GL_UNSIGNED_SHORT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { UNCLAMPED_FLOAT_TO_USHORT(dst2[i][RCOMP], src4[i][RCOMP]); @@ -607,8 +607,8 @@ _mesa_clip_drawpixels(const struct gl_context *ctx, unpack->RowLength = *width; } - ASSERT(ctx->Pixel.ZoomX == 1.0F); - ASSERT(ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F); + assert(ctx->Pixel.ZoomX == 1.0F); + assert(ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F); /* left clipping */ if (*destX < buffer->_Xmin) { @@ -792,20 +792,20 @@ clip_right_or_top(GLint *srcX0, GLint *srcX1, if (*dstX1 > maxValue) { /* X1 outside right edge */ - ASSERT(*dstX0 < maxValue); /* X0 should be inside right edge */ + assert(*dstX0 < maxValue); /* X0 should be inside right edge */ t = (GLfloat) (maxValue - *dstX0) / (GLfloat) (*dstX1 - *dstX0); /* chop off [t, 1] part */ - ASSERT(t >= 0.0 && t <= 1.0); + assert(t >= 0.0 && t <= 1.0); *dstX1 = maxValue; bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; *srcX1 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias); } else if (*dstX0 > maxValue) { /* X0 outside right edge */ - ASSERT(*dstX1 < maxValue); /* X1 should be inside right edge */ + assert(*dstX1 < maxValue); /* X1 should be inside right edge */ t = (GLfloat) (maxValue - *dstX1) / (GLfloat) (*dstX0 - *dstX1); /* chop off [t, 1] part */ - ASSERT(t >= 0.0 && t <= 1.0); + assert(t >= 0.0 && t <= 1.0); *dstX0 = maxValue; bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F; *srcX0 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias); @@ -825,20 +825,20 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1, if (*dstX0 < minValue) { /* X0 outside left edge */ - ASSERT(*dstX1 > minValue); /* X1 should be inside left edge */ + assert(*dstX1 > minValue); /* X1 should be inside left edge */ t = (GLfloat) (minValue - *dstX0) / (GLfloat) (*dstX1 - *dstX0); /* chop off [0, t] part */ - ASSERT(t >= 0.0 && t <= 1.0); + assert(t >= 0.0 && t <= 1.0); *dstX0 = minValue; bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; *srcX0 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias); } else if (*dstX1 < minValue) { /* X1 outside left edge */ - ASSERT(*dstX0 > minValue); /* X0 should be inside left edge */ + assert(*dstX0 > minValue); /* X0 should be inside left edge */ t = (GLfloat) (minValue - *dstX1) / (GLfloat) (*dstX0 - *dstX1); /* chop off [0, t] part */ - ASSERT(t >= 0.0 && t <= 1.0); + assert(t >= 0.0 && t <= 1.0); *dstX1 = minValue; bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F; *srcX1 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias); @@ -936,25 +936,25 @@ _mesa_clip_blit(struct gl_context *ctx, *srcY0, *srcY1, *dstY0, *dstY1); */ - ASSERT(*dstX0 >= dstXmin); - ASSERT(*dstX0 <= dstXmax); - ASSERT(*dstX1 >= dstXmin); - ASSERT(*dstX1 <= dstXmax); - - ASSERT(*dstY0 >= dstYmin); - ASSERT(*dstY0 <= dstYmax); - ASSERT(*dstY1 >= dstYmin); - ASSERT(*dstY1 <= dstYmax); - - ASSERT(*srcX0 >= srcXmin); - ASSERT(*srcX0 <= srcXmax); - ASSERT(*srcX1 >= srcXmin); - ASSERT(*srcX1 <= srcXmax); - - ASSERT(*srcY0 >= srcYmin); - ASSERT(*srcY0 <= srcYmax); - ASSERT(*srcY1 >= srcYmin); - ASSERT(*srcY1 <= srcYmax); + assert(*dstX0 >= dstXmin); + assert(*dstX0 <= dstXmax); + assert(*dstX1 >= dstXmin); + assert(*dstX1 <= dstXmax); + + assert(*dstY0 >= dstYmin); + assert(*dstY0 <= dstYmax); + assert(*dstY1 >= dstYmin); + assert(*dstY1 <= dstYmax); + + assert(*srcX0 >= srcXmin); + assert(*srcX0 <= srcXmax); + assert(*srcX1 >= srcXmin); + assert(*srcX1 <= srcXmax); + + assert(*srcY0 >= srcYmin); + assert(*srcY0 <= srcYmax); + assert(*srcY1 >= srcYmin); + assert(*srcY1 <= srcYmax); return GL_TRUE; } diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 4f5a2d11fa9..7997b0e0c36 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -92,7 +92,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) #else uintptr_t ptr, buf; - ASSERT( alignment > 0 ); + assert( alignment > 0 ); ptr = (uintptr_t)malloc(bytes + alignment + sizeof(void *)); if (!ptr) @@ -141,7 +141,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) #else uintptr_t ptr, buf; - ASSERT( alignment > 0 ); + assert( alignment > 0 ); ptr = (uintptr_t)calloc(1, bytes + alignment + sizeof(void *)); if (!ptr) diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index e483b826e91..7a1afd95930 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -101,7 +101,7 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa { struct gl_light *light; - ASSERT(lnum < MAX_LIGHTS); + assert(lnum < MAX_LIGHTS); light = &ctx->Light.Light[lnum]; switch (pname) { @@ -142,15 +142,15 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa COPY_3V(light->SpotDirection, params); break; case GL_SPOT_EXPONENT: - ASSERT(params[0] >= 0.0); - ASSERT(params[0] <= ctx->Const.MaxSpotExponent); + assert(params[0] >= 0.0); + assert(params[0] <= ctx->Const.MaxSpotExponent); if (light->SpotExponent == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); light->SpotExponent = params[0]; break; case GL_SPOT_CUTOFF: - ASSERT(params[0] == 180.0 || (params[0] >= 0.0 && params[0] <= 90.0)); + assert(params[0] == 180.0 || (params[0] >= 0.0 && params[0] <= 90.0)); if (light->SpotCutoff == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); @@ -164,21 +164,21 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa light->_Flags &= ~LIGHT_SPOT; break; case GL_CONSTANT_ATTENUATION: - ASSERT(params[0] >= 0.0); + assert(params[0] >= 0.0); if (light->ConstantAttenuation == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); light->ConstantAttenuation = params[0]; break; case GL_LINEAR_ATTENUATION: - ASSERT(params[0] >= 0.0); + assert(params[0] >= 0.0); if (light->LinearAttenuation == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); light->LinearAttenuation = params[0]; break; case GL_QUADRATIC_ATTENUATION: - ASSERT(params[0] >= 0.0); + assert(params[0] >= 0.0); if (light->QuadraticAttenuation == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); @@ -808,7 +808,7 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) GLuint f; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; - ASSERT(ctx->API == API_OPENGL_COMPAT); + assert(ctx->API == API_OPENGL_COMPAT); FLUSH_VERTICES(ctx, 0); /* update materials */ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index cf1f0e9c957..11e3b2a62d4 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -621,7 +621,7 @@ COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const GLfloat src[4], break; default: ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */ - ASSERT(!"Unexpected type in COPY_CLEAN_4V_TYPE_AS_FLOAT macro"); + assert(!"Unexpected type in COPY_CLEAN_4V_TYPE_AS_FLOAT macro"); } COPY_SZ_4V(dst, sz, src); } diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 0539caa4722..4a2ce751aa5 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -176,7 +176,7 @@ _mesa_MatrixMode( GLenum mode ) return; } #endif - ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack)); + assert(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack)); ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; break; case GL_MATRIX0_ARB: diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 75a12cd165b..7732d09b2ec 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -153,8 +153,8 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1; const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2; - ASSERT(comps >= 1); - ASSERT(comps <= 4); + assert(comps >= 1); + assert(comps <= 4); /* This assertion is no longer valid with non-power-of-2 textures assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth); @@ -788,8 +788,8 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth, const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2; GLuint i, j, k; - ASSERT(comps >= 1); - ASSERT(comps <= 4); + assert(comps >= 1); + assert(comps <= 4); if ((datatype == GL_UNSIGNED_BYTE) && (comps == 4)) { DECLARE_ROW_POINTERS(GLubyte, 4); @@ -1650,7 +1650,7 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, } else { /* average border pixels from adjacent src image pairs */ - ASSERT(srcDepthNB == 2 * dstDepthNB); + assert(srcDepthNB == 2 * dstDepthNB); for (img = 0; img < dstDepthNB; img++) { const GLubyte *srcA, *srcB; GLubyte *dst; @@ -1902,7 +1902,7 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target, /* get src image parameters */ srcImage = _mesa_select_tex_image(texObj, target, level); - ASSERT(srcImage); + assert(srcImage); srcWidth = srcImage->Width; srcHeight = srcImage->Height; srcDepth = srcImage->Depth; @@ -2097,7 +2097,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, /* get src image parameters */ srcImage = _mesa_select_tex_image(texObj, target, level); - ASSERT(srcImage); + assert(srcImage); srcWidth = srcImage->Width; srcHeight = srcImage->Height; srcDepth = srcImage->Depth; @@ -2192,12 +2192,12 @@ _mesa_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_image *srcImage; GLint maxLevel; - ASSERT(texObj); + assert(texObj); srcImage = _mesa_select_tex_image(texObj, target, texObj->BaseLevel); - ASSERT(srcImage); + assert(srcImage); maxLevel = _mesa_max_texture_levels(ctx, texObj->Target) - 1; - ASSERT(maxLevel >= 0); /* bad target */ + assert(maxLevel >= 0); /* bad target */ maxLevel = MIN2(maxLevel, texObj->MaxLevel); diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c index 2111a760400..3b77c494f91 100644 --- a/src/mesa/main/pack.c +++ b/src/mesa/main/pack.c @@ -257,9 +257,9 @@ extract_uint_indexes(GLuint n, GLuint indexes[], GLenum srcFormat, GLenum srcType, const GLvoid *src, const struct gl_pixelstore_attrib *unpack ) { - ASSERT(srcFormat == GL_COLOR_INDEX || srcFormat == GL_STENCIL_INDEX); + assert(srcFormat == GL_COLOR_INDEX || srcFormat == GL_STENCIL_INDEX); - ASSERT(srcType == GL_BITMAP || + assert(srcType == GL_BITMAP || srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || srcType == GL_UNSIGNED_SHORT || @@ -503,7 +503,7 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n, const struct gl_pixelstore_attrib *srcPacking, GLbitfield transferOps ) { - ASSERT(srcType == GL_BITMAP || + assert(srcType == GL_BITMAP || srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || srcType == GL_UNSIGNED_SHORT || @@ -516,7 +516,7 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n, srcType == GL_FLOAT || srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); - ASSERT(dstType == GL_UNSIGNED_BYTE || + assert(dstType == GL_UNSIGNED_BYTE || dstType == GL_UNSIGNED_SHORT || dstType == GL_UNSIGNED_INT || dstType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); @@ -988,7 +988,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n, else if (dstType == GL_UNSIGNED_SHORT) { GLushort *zValues = (GLushort *) dest; GLuint i; - ASSERT(depthMax <= 0xffff); + assert(depthMax <= 0xffff); for (i = 0; i < n; i++) { zValues[i] = (GLushort) (depthValues[i] * (GLfloat) depthMax); } @@ -1004,7 +1004,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n, } } else { - ASSERT(0); + assert(0); } free(depthTemp); diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index a0d61a6436b..5c906ed749a 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -182,7 +182,7 @@ _mesa_map_validate_pbo_source(struct gl_context *ctx, GLsizei clientMemSize, const GLvoid *ptr, const char *where) { - ASSERT(dimensions == 1 || dimensions == 2 || dimensions == 3); + assert(dimensions == 1 || dimensions == 2 || dimensions == 3); if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, format, type, clientMemSize, ptr)) { @@ -220,7 +220,7 @@ void _mesa_unmap_pbo_source(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack) { - ASSERT(unpack != &ctx->Pack); /* catch pack/unpack mismatch */ + assert(unpack != &ctx->Pack); /* catch pack/unpack mismatch */ if (_mesa_is_bufferobj(unpack->BufferObj)) { ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL); } @@ -279,7 +279,7 @@ _mesa_map_validate_pbo_dest(struct gl_context *ctx, GLenum format, GLenum type, GLsizei clientMemSize, GLvoid *ptr, const char *where) { - ASSERT(dimensions == 1 || dimensions == 2 || dimensions == 3); + assert(dimensions == 1 || dimensions == 2 || dimensions == 3); if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, format, type, clientMemSize, ptr)) { @@ -317,7 +317,7 @@ void _mesa_unmap_pbo_dest(struct gl_context *ctx, const struct gl_pixelstore_attrib *pack) { - ASSERT(pack != &ctx->Unpack); /* catch pack/unpack mismatch */ + assert(pack != &ctx->Unpack); /* catch pack/unpack mismatch */ if (_mesa_is_bufferobj(pack->BufferObj)) { ctx->Driver.UnmapBuffer(ctx, pack->BufferObj, MAP_INTERNAL); } diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index b713d956f78..fb241af1e31 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -187,7 +187,7 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, struct gl_pipeline_object *oldObj = *ptr; mtx_lock(&oldObj->Mutex); - ASSERT(oldObj->RefCount > 0); + assert(oldObj->RefCount > 0); oldObj->RefCount--; deleteFlag = (oldObj->RefCount == 0); mtx_unlock(&oldObj->Mutex); @@ -198,7 +198,7 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, *ptr = NULL; } - ASSERT(!*ptr); + assert(!*ptr); if (obj) { /* reference new pipeline object */ @@ -471,7 +471,7 @@ _mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines) lookup_pipeline_object(ctx, pipelines[i]); if (obj) { - ASSERT(obj->Name == pipelines[i]); + assert(obj->Name == pipelines[i]); /* If the pipeline object is currently bound, the spec says "If an * object that is currently bound is deleted, the binding for that diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index de26bf96150..0a7807d77ac 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -103,7 +103,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) * If point parameters aren't supported, then this function shouldn't even * exist. */ - ASSERT(!(ctx->Extensions.ARB_point_sprite + assert(!(ctx->Extensions.ARB_point_sprite || ctx->Extensions.NV_point_sprite) || ctx->Extensions.EXT_point_parameters); diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index ca4b9431bbe..2e4a460c1fa 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -127,7 +127,7 @@ _mesa_readpixels_needs_slow_path(const struct gl_context *ctx, GLenum format, _mesa_get_read_renderbuffer_for_format(ctx, format); GLenum srcType; - ASSERT(rb); + assert(rb); /* There are different rules depending on the base format. */ switch (format) { @@ -180,7 +180,7 @@ readpixels_can_use_memcpy(const struct gl_context *ctx, GLenum format, GLenum ty struct gl_renderbuffer *rb = _mesa_get_read_renderbuffer_for_format(ctx, format); - ASSERT(rb); + assert(rb); if (_mesa_readpixels_needs_slow_path(ctx, format, type, GL_FALSE)) { return GL_FALSE; @@ -313,10 +313,10 @@ read_depth_pixels( struct gl_context *ctx, return; /* clipping should have been done already */ - ASSERT(x >= 0); - ASSERT(y >= 0); - ASSERT(x + width <= (GLint) rb->Width); - ASSERT(y + height <= (GLint) rb->Height); + assert(x >= 0); + assert(y >= 0); + assert(x + width <= (GLint) rb->Width); + assert(y + height <= (GLint) rb->Height); if (type == GL_UNSIGNED_INT && read_uint_depth_pixels(ctx, x, y, width, height, type, pixels, packing)) { diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c index 4a881865a44..01f7594dc49 100644 --- a/src/mesa/main/remap.c +++ b/src/mesa/main/remap.c @@ -197,7 +197,7 @@ _mesa_do_init_remap_table(const char *pool, const char *spec; /* sanity check */ - ASSERT(i == remap[i].remap_index); + assert(i == remap[i].remap_index); spec = _mesa_function_pool + remap[i].pool_index; offset = _mesa_map_function_spec(spec); diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 98f3c13b557..e9d129a1dbb 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -172,7 +172,7 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr, struct gl_renderbuffer *oldRb = *ptr; mtx_lock(&oldRb->Mutex); - ASSERT(oldRb->RefCount > 0); + assert(oldRb->RefCount > 0); oldRb->RefCount--; /*printf("RB DECR %p (%d) to %d\n", (void*) oldRb, oldRb->Name, oldRb->RefCount);*/ deleteFlag = (oldRb->RefCount == 0); diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index d62a06bf15b..d66b0b5e8d4 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -89,7 +89,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx, struct gl_sampler_object *oldSamp = *ptr; /*mtx_lock(&oldSamp->Mutex);*/ - ASSERT(oldSamp->RefCount > 0); + assert(oldSamp->RefCount > 0); oldSamp->RefCount--; #if 0 printf("SamplerObj %p %d DECR to %d\n", @@ -99,13 +99,13 @@ _mesa_reference_sampler_object_(struct gl_context *ctx, /*mtx_unlock(&oldSamp->Mutex);*/ if (deleteFlag) { - ASSERT(ctx->Driver.DeleteSamplerObject); + assert(ctx->Driver.DeleteSamplerObject); ctx->Driver.DeleteSamplerObject(ctx, oldSamp); } *ptr = NULL; } - ASSERT(!*ptr); + assert(!*ptr); if (samp) { /* reference new sampler */ diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 02ccf450bf9..d7620c8ef7e 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -67,7 +67,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, GLboolean deleteFlag = GL_FALSE; struct gl_shader *old = *ptr; - ASSERT(old->RefCount > 0); + assert(old->RefCount > 0); old->RefCount--; /*printf("SHADER DECR %p (%d) to %d\n", (void*) old, old->Name, old->RefCount);*/ @@ -207,7 +207,7 @@ _mesa_reference_shader_program_(struct gl_context *ctx, GLboolean deleteFlag = GL_FALSE; struct gl_shader_program *old = *ptr; - ASSERT(old->RefCount > 0); + assert(old->RefCount > 0); old->RefCount--; #if 0 printf("ShaderProgram %p ID=%u RefCount-- to %d\n", diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index 92f7a33eec2..3d696a1887e 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -114,7 +114,7 @@ _mesa_shader_enum_to_shader_stage(GLenum v) case GL_COMPUTE_SHADER: return MESA_SHADER_COMPUTE; default: - ASSERT(0 && "bad value in _mesa_shader_enum_to_shader_stage()"); + assert(0 && "bad value in _mesa_shader_enum_to_shader_stage()"); return MESA_SHADER_VERTEX; } } diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index ccf5355f3c4..7162bbc761e 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -159,7 +159,7 @@ delete_program_cb(GLuint id, void *data, void *userData) struct gl_program *prog = (struct gl_program *) data; struct gl_context *ctx = (struct gl_context *) userData; if(prog != &_mesa_DummyProgram) { - ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */ + assert(prog->RefCount == 1); /* should only be referenced by hash table */ prog->RefCount = 0; /* now going away */ ctx->Driver.DeleteProgram(ctx, prog); } @@ -223,7 +223,7 @@ delete_shader_cb(GLuint id, void *data, void *userData) } else { struct gl_shader_program *shProg = (struct gl_shader_program *) data; - ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA); + assert(shProg->Type == GL_SHADER_PROGRAM_MESA); ctx->Driver.DeleteShaderProgram(ctx, shProg); } } @@ -346,7 +346,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared) * Free texture objects (after FBOs since some textures might have * been bound to FBOs). */ - ASSERT(ctx->Driver.DeleteTexture); + assert(ctx->Driver.DeleteTexture); /* the default textures */ for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { ctx->Driver.DeleteTexture(ctx, shared->DefaultTex[i]); diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 45bce78fd4a..dadfb3c8c71 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -275,7 +275,7 @@ update_viewport_matrix(struct gl_context *ctx) const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; unsigned i; - ASSERT(depthMax > 0); + assert(depthMax > 0); /* Compute scale and bias values. This is really driver-specific * and should be maintained elsewhere if at all. diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index b4efeee3bcc..00234d4ccb3 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -570,8 +570,8 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, _mesa_get_format_block_size(mesaFormat, &bw, &bh); - ASSERT(col % bw == 0); - ASSERT(row % bh == 0); + assert(col % bw == 0); + assert(row % bh == 0); offset = ((width + bw - 1) / bw) * (row / bh) + col / bw; offset *= blockSize; diff --git a/src/mesa/main/texcompress_bptc.c b/src/mesa/main/texcompress_bptc.c index c944ac26f34..a600180e236 100644 --- a/src/mesa/main/texcompress_bptc.c +++ b/src/mesa/main/texcompress_bptc.c @@ -1630,7 +1630,7 @@ texstore_bptc_rgb_float(TEXSTORE_PARAMS, GLboolean _mesa_texstore_bptc_rgb_signed_float(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT); + assert(dstFormat == MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT); return texstore_bptc_rgb_float(ctx, dims, baseInternalFormat, dstFormat, dstRowStride, dstSlices, @@ -1643,7 +1643,7 @@ _mesa_texstore_bptc_rgb_signed_float(TEXSTORE_PARAMS) GLboolean _mesa_texstore_bptc_rgb_unsigned_float(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT); + assert(dstFormat == MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT); return texstore_bptc_rgb_float(ctx, dims, baseInternalFormat, dstFormat, dstRowStride, dstSlices, diff --git a/src/mesa/main/texcompress_cpal.c b/src/mesa/main/texcompress_cpal.c index 54e9af41d05..c46ef8c53fb 100644 --- a/src/mesa/main/texcompress_cpal.c +++ b/src/mesa/main/texcompress_cpal.c @@ -32,7 +32,6 @@ #include "glheader.h" -#include "compiler.h" /* for ASSERT */ #include "context.h" #include "mtypes.h" #include "imports.h" @@ -120,7 +119,7 @@ _mesa_cpal_compressed_size(int level, GLenum internalFormat, } info = &formats[internalFormat - GL_PALETTE4_RGB8_OES]; - ASSERT(info->cpal_format == internalFormat); + assert(info->cpal_format == internalFormat); expect_size = info->palette_size * info->size; for (lvl = 0; lvl < num_levels; lvl++) { diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c index 98b4fe20157..f29561cc61a 100644 --- a/src/mesa/main/texcompress_etc.c +++ b/src/mesa/main/texcompress_etc.c @@ -108,7 +108,7 @@ GLboolean _mesa_texstore_etc1_rgb8(TEXSTORE_PARAMS) { /* GL_ETC1_RGB8_OES is only valid in glCompressedTexImage2D */ - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1099,7 +1099,7 @@ etc2_unpack_srgb8_punchthrough_alpha1(uint8_t *dst_row, GLboolean _mesa_texstore_etc2_rgb8(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1107,7 +1107,7 @@ _mesa_texstore_etc2_rgb8(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_srgb8(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1115,7 +1115,7 @@ _mesa_texstore_etc2_srgb8(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_rgba8_eac(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1123,7 +1123,7 @@ _mesa_texstore_etc2_rgba8_eac(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_srgb8_alpha8_eac(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1131,7 +1131,7 @@ _mesa_texstore_etc2_srgb8_alpha8_eac(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_r11_eac(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1139,7 +1139,7 @@ _mesa_texstore_etc2_r11_eac(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_signed_r11_eac(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1147,7 +1147,7 @@ _mesa_texstore_etc2_signed_r11_eac(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_rg11_eac(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1155,7 +1155,7 @@ _mesa_texstore_etc2_rg11_eac(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_signed_rg11_eac(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1163,7 +1163,7 @@ _mesa_texstore_etc2_signed_rg11_eac(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_rgb8_punchthrough_alpha1(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } @@ -1171,7 +1171,7 @@ _mesa_texstore_etc2_rgb8_punchthrough_alpha1(TEXSTORE_PARAMS) GLboolean _mesa_texstore_etc2_srgb8_punchthrough_alpha1(TEXSTORE_PARAMS) { - ASSERT(0); + assert(0); return GL_FALSE; } diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 7b25e103905..562359410b2 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -61,7 +61,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) GLubyte *dst; const GLubyte *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1); + assert(dstFormat == MESA_FORMAT_RGB_FXT1); if (srcFormat != GL_RGB || srcType != GL_UNSIGNED_BYTE || @@ -116,7 +116,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) GLubyte *dst; const GLubyte *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1); + assert(dstFormat == MESA_FORMAT_RGBA_FXT1); if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -1264,12 +1264,12 @@ upscale_teximage2d(GLsizei inWidth, GLsizei inHeight, { GLint i, j, k; - ASSERT(outWidth >= inWidth); - ASSERT(outHeight >= inHeight); + assert(outWidth >= inWidth); + assert(outHeight >= inHeight); #if 0 - ASSERT(inWidth == 1 || inWidth == 2 || inHeight == 1 || inHeight == 2); - ASSERT((outWidth & 3) == 0); - ASSERT((outHeight & 3) == 0); + assert(inWidth == 1 || inWidth == 2 || inHeight == 1 || inHeight == 2); + assert((outWidth & 3) == 0); + assert((outHeight & 3) == 0); #endif for (i = 0; i < outHeight; i++) { diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c index e3042011a71..f40e4e6c09b 100644 --- a/src/mesa/main/texcompress_rgtc.c +++ b/src/mesa/main/texcompress_rgtc.c @@ -86,7 +86,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) GLint dstRowDiff, redRowStride; GLubyte *tempImageSlices[1]; - ASSERT(dstFormat == MESA_FORMAT_R_RGTC1_UNORM || + assert(dstFormat == MESA_FORMAT_R_RGTC1_UNORM || dstFormat == MESA_FORMAT_L_LATC1_UNORM); tempImage = malloc(srcWidth * srcHeight * 1 * sizeof(GLubyte)); @@ -139,7 +139,7 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS) GLint dstRowDiff, redRowStride; GLfloat *tempImageSlices[1]; - ASSERT(dstFormat == MESA_FORMAT_R_RGTC1_SNORM || + assert(dstFormat == MESA_FORMAT_R_RGTC1_SNORM || dstFormat == MESA_FORMAT_L_LATC1_SNORM); redRowStride = 1 * srcWidth * sizeof(GLfloat); @@ -193,7 +193,7 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) mesa_format tempFormat; GLubyte *tempImageSlices[1]; - ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2_UNORM || + assert(dstFormat == MESA_FORMAT_RG_RGTC2_UNORM || dstFormat == MESA_FORMAT_LA_LATC2_UNORM); if (baseInternalFormat == GL_RG) @@ -258,7 +258,7 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) mesa_format tempFormat; GLfloat *tempImageSlices[1]; - ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2_SNORM || + assert(dstFormat == MESA_FORMAT_RG_RGTC2_SNORM || dstFormat == MESA_FORMAT_LA_LATC2_SNORM); if (baseInternalFormat == GL_RG) diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index bfb53dce48d..41d00d4e91d 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -133,7 +133,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) GLubyte *dst; const GLubyte *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1 || + assert(dstFormat == MESA_FORMAT_RGB_DXT1 || dstFormat == MESA_FORMAT_SRGB_DXT1); if (srcFormat != GL_RGB || @@ -190,7 +190,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) GLubyte *dst; const GLubyte *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1 || + assert(dstFormat == MESA_FORMAT_RGBA_DXT1 || dstFormat == MESA_FORMAT_SRGBA_DXT1); if (srcFormat != GL_RGBA || @@ -247,7 +247,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) GLubyte *dst; const GLubyte *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3 || + assert(dstFormat == MESA_FORMAT_RGBA_DXT3 || dstFormat == MESA_FORMAT_SRGBA_DXT3); if (srcFormat != GL_RGBA || @@ -303,7 +303,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) GLubyte *dst; const GLubyte *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5 || + assert(dstFormat == MESA_FORMAT_RGBA_DXT5 || dstFormat == MESA_FORMAT_SRGBA_DXT5); if (srcFormat != GL_RGBA || diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index ec16af9d2a1..3c4baca7026 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -430,12 +430,12 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_RGB9_E5: /* GL_EXT_texture_shared_exponent -- just one format to support */ - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R9G9B9E5_FLOAT]); + assert(ctx->TextureFormatSupported[MESA_FORMAT_R9G9B9E5_FLOAT]); return MESA_FORMAT_R9G9B9E5_FLOAT; case GL_R11F_G11F_B10F: /* GL_EXT_texture_packed_float -- just one format to support */ - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R11G11B10_FLOAT]); + assert(ctx->TextureFormatSupported[MESA_FORMAT_R11G11B10_FLOAT]); return MESA_FORMAT_R11G11B10_FLOAT; case GL_DEPTH_STENCIL_EXT: @@ -445,10 +445,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, break; case GL_DEPTH_COMPONENT32F: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z_FLOAT32]); + assert(ctx->TextureFormatSupported[MESA_FORMAT_Z_FLOAT32]); return MESA_FORMAT_Z_FLOAT32; case GL_DEPTH32F_STENCIL8: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_S8X24_UINT]); + assert(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_S8X24_UINT]); return MESA_FORMAT_Z32_FLOAT_S8X24_UINT; case GL_RED_SNORM: diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 29c325bf222..f73edc3fff5 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -650,8 +650,8 @@ set_tex_image(struct gl_texture_object *tObj, { const GLuint face = _mesa_tex_target_to_face(target); - ASSERT(tObj); - ASSERT(texImage); + assert(tObj); + assert(texImage); if (target == GL_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_EXTERNAL_OES) assert(level == 0); @@ -696,7 +696,7 @@ _mesa_delete_texture_image(struct gl_context *ctx, /* Free texImage->Data and/or any other driver-specific texture * image storage. */ - ASSERT(ctx->Driver.FreeTextureImageBuffer); + assert(ctx->Driver.FreeTextureImageBuffer); ctx->Driver.FreeTextureImageBuffer( ctx, texImage ); free(texImage); } @@ -807,9 +807,9 @@ _mesa_select_tex_image(const struct gl_texture_object *texObj, { const GLuint face = _mesa_tex_target_to_face(target); - ASSERT(texObj); - ASSERT(level >= 0); - ASSERT(level < MAX_TEXTURE_LEVELS); + assert(texObj); + assert(level >= 0); + assert(level < MAX_TEXTURE_LEVELS); return texObj->Image[face][level]; } @@ -1239,7 +1239,7 @@ make_null_texture(GLint width, GLint height, GLint depth, GLenum format) static void clear_teximage_fields(struct gl_texture_image *img) { - ASSERT(img); + assert(img); img->_BaseFormat = 0; img->InternalFormat = 0; img->Border = 0; @@ -1284,14 +1284,14 @@ init_teximage_fields_ms(struct gl_context *ctx, GLuint numSamples, GLboolean fixedSampleLocations) { GLenum target; - ASSERT(img); - ASSERT(width >= 0); - ASSERT(height >= 0); - ASSERT(depth >= 0); + assert(img); + assert(width >= 0); + assert(height >= 0); + assert(depth >= 0); target = img->TexObject->Target; img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat ); - ASSERT(img->_BaseFormat != -1); + assert(img->_BaseFormat != -1); img->InternalFormat = internalFormat; img->Border = border; img->Width = width; @@ -2184,7 +2184,7 @@ texture_error_check( struct gl_context *ctx, /* additional checks for ycbcr textures */ if (internalFormat == GL_YCBCR_MESA) { - ASSERT(ctx->Extensions.MESA_ycbcr_texture); + assert(ctx->Extensions.MESA_ycbcr_texture); if (type != GL_UNSIGNED_SHORT_8_8_MESA && type != GL_UNSIGNED_SHORT_8_8_REV_MESA) { char message[100]; @@ -2933,7 +2933,7 @@ check_rtt_cb(GLuint key, void *data, void *userData) att->TextureLevel == level && att->CubeMapFace == face) { _mesa_update_texture_renderbuffer(ctx, ctx->DrawBuffer, att); - ASSERT(att->Renderbuffer->TexImage); + assert(att->Renderbuffer->TexImage); /* Mark fb status as indeterminate to force re-validation */ fb->_Status = 0; } @@ -2977,7 +2977,7 @@ check_gen_mipmap(struct gl_context *ctx, GLenum target, if (texObj->GenerateMipmap && level == texObj->BaseLevel && level < texObj->MaxLevel) { - ASSERT(ctx->Driver.GenerateMipmap); + assert(ctx->Driver.GenerateMipmap); ctx->Driver.GenerateMipmap(ctx, target, texObj); } } @@ -3054,7 +3054,7 @@ _mesa_choose_texture_format(struct gl_context *ctx, prevImage->Width > 0 && prevImage->InternalFormat == internalFormat) { /* use the same format */ - ASSERT(prevImage->TexFormat != MESA_FORMAT_NONE); + assert(prevImage->TexFormat != MESA_FORMAT_NONE); return prevImage->TexFormat; } } @@ -3093,7 +3093,7 @@ _mesa_choose_texture_format(struct gl_context *ctx, /* choose format from scratch */ f = ctx->Driver.ChooseTextureFormat(ctx, target, internalFormat, format, type); - ASSERT(f != MESA_FORMAT_NONE); + assert(f != MESA_FORMAT_NONE); return f; } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 59090db4ecf..d5aa620e1f6 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -265,7 +265,7 @@ _mesa_initialize_texture_object( struct gl_context *ctx, struct gl_texture_object *obj, GLuint name, GLenum target ) { - ASSERT(target == 0 || + assert(target == 0 || target == GL_TEXTURE_1D || target == GL_TEXTURE_2D || target == GL_TEXTURE_3D || @@ -541,11 +541,11 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr, GLboolean deleteFlag = GL_FALSE; struct gl_texture_object *oldTex = *ptr; - ASSERT(valid_texture_object(oldTex)); + assert(valid_texture_object(oldTex)); (void) valid_texture_object; /* silence warning in release builds */ mtx_lock(&oldTex->Mutex); - ASSERT(oldTex->RefCount > 0); + assert(oldTex->RefCount > 0); oldTex->RefCount--; deleteFlag = (oldTex->RefCount == 0); @@ -568,7 +568,7 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr, if (tex) { /* reference new texture */ - ASSERT(valid_texture_object(tex)); + assert(valid_texture_object(tex)); mtx_lock(&tex->Mutex); if (tex->RefCount == 0) { /* this texture's being deleted (look just above) */ @@ -730,7 +730,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, return; } - ASSERT(maxLevels > 0); + assert(maxLevels > 0); t->_MaxLevel = MIN3(t->MaxLevel, /* 'p' in the GL spec */ @@ -1724,7 +1724,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) _mesa_reference_texobj(&texUnit->CurrentTex[targetIndex], newTexObj); ctx->Texture.NumCurrentTexUsed = MAX2(ctx->Texture.NumCurrentTexUsed, ctx->Texture.CurrentUnit + 1); - ASSERT(texUnit->CurrentTex[targetIndex]); + assert(texUnit->CurrentTex[targetIndex]); if (texName != 0) texUnit->_BoundTextures |= (1 << targetIndex); @@ -1773,7 +1773,7 @@ _mesa_bind_texture_unit(struct gl_context *ctx, _mesa_reference_texobj(&texUnit->CurrentTex[texObj->TargetIndex], texObj); - ASSERT(texUnit->CurrentTex[texObj->TargetIndex]); + assert(texUnit->CurrentTex[texObj->TargetIndex]); ctx->Texture.NumCurrentTexUsed = MAX2(ctx->Texture.NumCurrentTexUsed, unit + 1); texUnit->_BoundTextures |= (1 << texObj->TargetIndex); diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index c4a5841c56c..1ef72866029 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -217,8 +217,8 @@ comp_to_swizzle(GLenum comp) static void set_swizzle_component(GLuint *swizzle, GLuint comp, GLuint swz) { - ASSERT(comp < 4); - ASSERT(swz <= SWIZZLE_NIL); + assert(comp < 4); + assert(swz <= SWIZZLE_NIL); { GLuint mask = 0x7 << (3 * comp); GLuint s = (*swizzle & ~mask) | (swz << (3 * comp)); @@ -537,7 +537,7 @@ set_tex_parameteri(struct gl_context *ctx, "glTex%sParameter(swizzle 0x%x)", suffix, params[0]); return GL_FALSE; } - ASSERT(comp < 4); + assert(comp < 4); flush(ctx); texObj->Swizzle[comp] = params[0]; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 99c7c81788a..d458b82e345 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -68,8 +68,8 @@ _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst ) { GLuint u, tex; - ASSERT(src); - ASSERT(dst); + assert(src); + assert(dst); dst->Texture.CurrentUnit = src->Texture.CurrentUnit; dst->Texture._GenFlags = src->Texture._GenFlags; @@ -292,7 +292,7 @@ _mesa_ActiveTexture(GLenum texture) k = _mesa_max_tex_unit(ctx); - ASSERT(k <= Elements(ctx->Texture.Unit)); + assert(k <= Elements(ctx->Texture.Unit)); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glActiveTexture %s\n", @@ -363,7 +363,7 @@ update_texture_matrices( struct gl_context *ctx ) ctx->Texture._TexMatEnabled = 0x0; for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { - ASSERT(u < Elements(ctx->TextureMatrixStack)); + assert(u < Elements(ctx->TextureMatrixStack)); if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) { _math_matrix_analyse( ctx->TextureMatrixStack[u].Top ); @@ -501,7 +501,7 @@ update_texgen(struct gl_context *ctx) ctx->Texture._GenFlags |= texUnit->_GenFlags; } - ASSERT(unit < Elements(ctx->TextureMatrixStack)); + assert(unit < Elements(ctx->TextureMatrixStack)); if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); } diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index abc07eafb4e..ce7b5d7f2d1 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -41,7 +41,7 @@ static inline struct gl_texture_unit * _mesa_get_tex_unit(struct gl_context *ctx, GLuint unit) { - ASSERT(unit < Elements(ctx->Texture.Unit)); + assert(unit < Elements(ctx->Texture.Unit)); return &(ctx->Texture.Unit[unit]); } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7039cdf8174..7ad9d2b68e1 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -154,9 +154,9 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffffff; GLenum dstType; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_Z_UNORM32 || + assert(dstFormat == MESA_FORMAT_Z_UNORM32 || dstFormat == MESA_FORMAT_Z_FLOAT32); - ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLuint)); + assert(_mesa_get_format_bytes(dstFormat) == sizeof(GLuint)); if (dstFormat == MESA_FORMAT_Z_UNORM32) dstType = GL_UNSIGNED_INT; @@ -191,7 +191,7 @@ _mesa_texstore_x8_z24(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_Z24_UNORM_X8_UINT); + assert(dstFormat == MESA_FORMAT_Z24_UNORM_X8_UINT); { /* general path */ @@ -221,7 +221,7 @@ _mesa_texstore_z24_x8(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_X8_UINT_Z24_UNORM); + assert(dstFormat == MESA_FORMAT_X8_UINT_Z24_UNORM); { /* general path */ @@ -254,8 +254,8 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_Z_UNORM16); - ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLushort)); + assert(dstFormat == MESA_FORMAT_Z_UNORM16); + assert(_mesa_get_format_bytes(dstFormat) == sizeof(GLushort)); { /* general path */ @@ -287,14 +287,14 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) (void) ctx; (void) dims; (void) baseInternalFormat; - ASSERT((dstFormat == MESA_FORMAT_YCBCR) || + assert((dstFormat == MESA_FORMAT_YCBCR) || (dstFormat == MESA_FORMAT_YCBCR_REV)); - ASSERT(_mesa_get_format_bytes(dstFormat) == 2); - ASSERT(ctx->Extensions.MESA_ycbcr_texture); - ASSERT(srcFormat == GL_YCBCR_MESA); - ASSERT((srcType == GL_UNSIGNED_SHORT_8_8_MESA) || + assert(_mesa_get_format_bytes(dstFormat) == 2); + assert(ctx->Extensions.MESA_ycbcr_texture); + assert(srcFormat == GL_YCBCR_MESA); + assert((srcType == GL_UNSIGNED_SHORT_8_8_MESA) || (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA)); - ASSERT(baseInternalFormat == GL_YCBCR_MESA); + assert(baseInternalFormat == GL_YCBCR_MESA); /* always just memcpy since no pixel transfer ops apply */ memcpy_texture(ctx, dims, @@ -335,11 +335,11 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) GLuint *depth = malloc(srcWidth * sizeof(GLuint)); GLubyte *stencil = malloc(srcWidth * sizeof(GLubyte)); - ASSERT(dstFormat == MESA_FORMAT_S8_UINT_Z24_UNORM); - ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || + assert(dstFormat == MESA_FORMAT_S8_UINT_Z24_UNORM); + assert(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT || srcFormat == GL_STENCIL_INDEX); - ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || + assert(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT || srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); @@ -414,11 +414,11 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) GLuint *depth; GLubyte *stencil; - ASSERT(dstFormat == MESA_FORMAT_Z24_UNORM_S8_UINT); - ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || + assert(dstFormat == MESA_FORMAT_Z24_UNORM_S8_UINT); + assert(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT || srcFormat == GL_STENCIL_INDEX); - ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || + assert(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT || srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); @@ -491,8 +491,8 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_s8(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_S_UINT8); - ASSERT(srcFormat == GL_STENCIL_INDEX); + assert(dstFormat == MESA_FORMAT_S_UINT8); + assert(srcFormat == GL_STENCIL_INDEX); { const GLint srcRowStride @@ -543,11 +543,11 @@ _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS) = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(uint64_t); - ASSERT(dstFormat == MESA_FORMAT_Z32_FLOAT_S8X24_UINT); - ASSERT(srcFormat == GL_DEPTH_STENCIL || + assert(dstFormat == MESA_FORMAT_Z32_FLOAT_S8X24_UINT); + assert(srcFormat == GL_DEPTH_STENCIL || srcFormat == GL_DEPTH_COMPONENT || srcFormat == GL_STENCIL_INDEX); - ASSERT(srcFormat != GL_DEPTH_STENCIL || + assert(srcFormat != GL_DEPTH_STENCIL || srcType == GL_UNSIGNED_INT_24_8 || srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); @@ -606,7 +606,7 @@ texstore_depth_stencil(TEXSTORE_PARAMS) initialized = GL_TRUE; } - ASSERT(table[dstFormat]); + assert(table[dstFormat]); return table[dstFormat](ctx, dims, baseInternalFormat, dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, @@ -666,7 +666,7 @@ texstore_compressed(TEXSTORE_PARAMS) initialized = GL_TRUE; } - ASSERT(table[dstFormat]); + assert(table[dstFormat]); return table[dstFormat](ctx, dims, baseInternalFormat, dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, @@ -1225,10 +1225,10 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, * have to worry about the usual image unpacking or image transfer * operations. */ - ASSERT(texImage); - ASSERT(texImage->Width > 0); - ASSERT(texImage->Height > 0); - ASSERT(texImage->Depth > 0); + assert(texImage); + assert(texImage->Width > 0); + assert(texImage->Height > 0); + assert(texImage->Depth > 0); /* allocate storage for texture data */ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) { diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index a73746335fe..1e23e8fc2ff 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -93,7 +93,7 @@ reference_transform_feedback_object(struct gl_transform_feedback_object **ptr, /* Unreference the old object */ struct gl_transform_feedback_object *oldObj = *ptr; - ASSERT(oldObj->RefCount > 0); + assert(oldObj->RefCount > 0); oldObj->RefCount--; if (oldObj->RefCount == 0) { @@ -104,7 +104,7 @@ reference_transform_feedback_object(struct gl_transform_feedback_object **ptr, *ptr = NULL; } - ASSERT(!*ptr); + assert(!*ptr); if (obj) { /* reference new object */ @@ -143,7 +143,7 @@ void _mesa_init_transform_feedback(struct gl_context *ctx) { /* core mesa expects this, even a dummy one, to be available */ - ASSERT(ctx->Driver.NewTransformFeedback); + assert(ctx->Driver.NewTransformFeedback); ctx->TransformFeedback.DefaultObject = ctx->Driver.NewTransformFeedback(ctx, 0); @@ -185,7 +185,7 @@ void _mesa_free_transform_feedback(struct gl_context *ctx) { /* core mesa expects this, even a dummy one, to be available */ - ASSERT(ctx->Driver.NewTransformFeedback); + assert(ctx->Driver.NewTransformFeedback); _mesa_reference_buffer_object(ctx, &ctx->TransformFeedback.CurrentBuffer, diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 978ec7b535b..6df50de6aa0 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -356,7 +356,7 @@ update_array_format(struct gl_context *ctx, return false; } - ASSERT(size <= 4); + assert(size <= 4); elementSize = _mesa_bytes_per_vertex_attrib(size, type); assert(elementSize != -1); @@ -714,7 +714,7 @@ _mesa_EnableVertexAttribArray(GLuint index) vao = ctx->Array.VAO; - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); if (!vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was disabled, now being enabled */ @@ -740,7 +740,7 @@ _mesa_DisableVertexAttribArray(GLuint index) vao = ctx->Array.VAO; - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); if (vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was enabled, now being disabled */ @@ -769,7 +769,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, return 0; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); array = &vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)]; @@ -834,7 +834,7 @@ get_current_attrib(struct gl_context *ctx, GLuint index, const char *function) return NULL; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->VertexAttrib)); FLUSH_CURRENT(ctx, 0); return ctx->Current.Attrib[VERT_ATTRIB_GENERIC(index)]; @@ -956,7 +956,7 @@ _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer) return; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->VertexAttrib)); *pointer = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr; } @@ -1348,7 +1348,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor) return; } - ASSERT(genericIndex < Elements(ctx->Array.VAO->VertexAttrib)); + assert(genericIndex < Elements(ctx->Array.VAO->VertexAttrib)); /* The ARB_vertex_attrib_binding spec says: * @@ -1802,7 +1802,7 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex) return; } - ASSERT(VERT_ATTRIB_GENERIC(attribIndex) < + assert(VERT_ATTRIB_GENERIC(attribIndex) < Elements(ctx->Array.VAO->VertexAttrib)); vertex_attrib_binding(ctx, VERT_ATTRIB_GENERIC(attribIndex), |