aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-05 22:17:40 +0100
committermarha <marha@users.sourceforge.net>2015-03-05 22:17:40 +0100
commit8574eba804031f6b19713f0b02952280730bf62e (patch)
tree9afa4d6fe299d43ab7e580dc08a5547120274561 /mesalib/src/mesa/swrast
parenteef70231353a6103f47fcae88a6e89e765e5cd47 (diff)
downloadvcxsrv-8574eba804031f6b19713f0b02952280730bf62e.tar.gz
vcxsrv-8574eba804031f6b19713f0b02952280730bf62e.tar.bz2
vcxsrv-8574eba804031f6b19713f0b02952280730bf62e.zip
fontconfig mesa git update 5 Mar 2015
Diffstat (limited to 'mesalib/src/mesa/swrast')
-rw-r--r--mesalib/src/mesa/swrast/s_aaline.c5
-rw-r--r--mesalib/src/mesa/swrast/s_aatriangle.c8
-rw-r--r--mesalib/src/mesa/swrast/s_aatritemp.h2
-rw-r--r--mesalib/src/mesa/swrast/s_alpha.c2
-rw-r--r--mesalib/src/mesa/swrast/s_atifragshader.c2
-rw-r--r--mesalib/src/mesa/swrast/s_bitmap.c6
-rw-r--r--mesalib/src/mesa/swrast/s_blend.c96
-rw-r--r--mesalib/src/mesa/swrast/s_blit.c22
-rw-r--r--mesalib/src/mesa/swrast/s_context.c5
-rw-r--r--mesalib/src/mesa/swrast/s_copypix.c4
-rw-r--r--mesalib/src/mesa/swrast/s_drawpix.c6
-rw-r--r--mesalib/src/mesa/swrast/s_fog.c25
-rw-r--r--mesalib/src/mesa/swrast/s_fragprog.c2
-rw-r--r--mesalib/src/mesa/swrast/s_lines.c10
-rw-r--r--mesalib/src/mesa/swrast/s_linetemp.h4
-rw-r--r--mesalib/src/mesa/swrast/s_logic.c4
-rw-r--r--mesalib/src/mesa/swrast/s_masking.c4
-rw-r--r--mesalib/src/mesa/swrast/s_points.c4
-rw-r--r--mesalib/src/mesa/swrast/s_renderbuffer.c2
-rw-r--r--mesalib/src/mesa/swrast/s_span.c70
-rw-r--r--mesalib/src/mesa/swrast/s_stencil.c2
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c6
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c4
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c145
-rw-r--r--mesalib/src/mesa/swrast/s_texrender.c2
-rw-r--r--mesalib/src/mesa/swrast/s_triangle.c28
-rw-r--r--mesalib/src/mesa/swrast/s_tritemp.h9
-rw-r--r--mesalib/src/mesa/swrast/s_zoom.c60
28 files changed, 275 insertions, 264 deletions
diff --git a/mesalib/src/mesa/swrast/s_aaline.c b/mesalib/src/mesa/swrast/s_aaline.c
index 6aea9d545..f3258e813 100644
--- a/mesalib/src/mesa/swrast/s_aaline.c
+++ b/mesalib/src/mesa/swrast/s_aaline.c
@@ -23,6 +23,7 @@
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/imports.h"
#include "main/macros.h"
@@ -203,7 +204,7 @@ compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4],
if (rho2 == 0.0F)
return 0.0;
else
- return (GLfloat) (LOGF(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */
+ return logf(rho2) * 1.442695f * 0.5f;/* 1.442695 = 1/log(2) */
}
@@ -477,7 +478,7 @@ _swrast_choose_aa_line_function(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- ASSERT(ctx->Line.SmoothFlag);
+ assert(ctx->Line.SmoothFlag);
if (ctx->Texture._EnabledCoordUnits != 0
|| _swrast_use_fragment_program(ctx)
diff --git a/mesalib/src/mesa/swrast/s_aatriangle.c b/mesalib/src/mesa/swrast/s_aatriangle.c
index 219282748..1d076cc7d 100644
--- a/mesalib/src/mesa/swrast/s_aatriangle.c
+++ b/mesalib/src/mesa/swrast/s_aatriangle.c
@@ -102,7 +102,7 @@ do { \
static inline GLfloat
solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4])
{
- ASSERT(plane[2] != 0.0F);
+ assert(plane[2] != 0.0F);
return (plane[3] + plane[0] * x + plane[1] * y) / -plane[2];
}
@@ -201,7 +201,7 @@ compute_coveragef(const GLfloat v0[3], const GLfloat v1[3],
GLint stop = 4, i;
GLfloat insideCount = 16.0F;
- ASSERT(dx0 * dy1 - dx1 * dy0 >= 0.0); /* area >= 0.0 */
+ assert(dx0 * dy1 - dx1 * dy0 >= 0.0); /* area >= 0.0 */
for (i = 0; i < stop; i++) {
const GLfloat sx = x + samples[i][0];
@@ -282,7 +282,7 @@ _swrast_set_aa_triangle_function(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- ASSERT(ctx->Polygon.SmoothFlag);
+ assert(ctx->Polygon.SmoothFlag);
if (ctx->Texture._EnabledCoordUnits != 0
|| _swrast_use_fragment_program(ctx)
@@ -294,5 +294,5 @@ _swrast_set_aa_triangle_function(struct gl_context *ctx)
SWRAST_CONTEXT(ctx)->Triangle = rgba_aa_tri;
}
- ASSERT(SWRAST_CONTEXT(ctx)->Triangle);
+ assert(SWRAST_CONTEXT(ctx)->Triangle);
}
diff --git a/mesalib/src/mesa/swrast/s_aatritemp.h b/mesalib/src/mesa/swrast/s_aatritemp.h
index fd374a524..230dab816 100644
--- a/mesalib/src/mesa/swrast/s_aatritemp.h
+++ b/mesalib/src/mesa/swrast/s_aatritemp.h
@@ -284,7 +284,7 @@
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
SWspanarrays *array = span.array;
- ASSERT(ix >= 0);
+ assert(ix >= 0);
array->coverage[ix] = coverage;
#ifdef DO_Z
array->z[ix] = (GLuint) solve_plane(cx, cy, zPlane);
diff --git a/mesalib/src/mesa/swrast/s_alpha.c b/mesalib/src/mesa/swrast/s_alpha.c
index fba143a52..b1a7ff132 100644
--- a/mesalib/src/mesa/swrast/s_alpha.c
+++ b/mesalib/src/mesa/swrast/s_alpha.c
@@ -130,7 +130,7 @@ _swrast_alpha_test(const struct gl_context *ctx, SWspan *span)
}
else {
/* Interpolate alpha values */
- ASSERT(span->interpMask & SPAN_RGBA);
+ assert(span->interpMask & SPAN_RGBA);
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
const GLfixed alphaStep = span->alphaStep;
GLfixed alpha = span->alpha;
diff --git a/mesalib/src/mesa/swrast/s_atifragshader.c b/mesalib/src/mesa/swrast/s_atifragshader.c
index 1e91e2bee..0bf03771f 100644
--- a/mesalib/src/mesa/swrast/s_atifragshader.c
+++ b/mesalib/src/mesa/swrast/s_atifragshader.c
@@ -571,7 +571,7 @@ _swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span)
GLuint i;
/* incoming colors should be floats */
- ASSERT(span->array->ChanType == GL_FLOAT);
+ assert(span->array->ChanType == GL_FLOAT);
for (i = 0; i < span->end; i++) {
if (span->array->mask[i]) {
diff --git a/mesalib/src/mesa/swrast/s_bitmap.c b/mesalib/src/mesa/swrast/s_bitmap.c
index e364ec129..324daea36 100644
--- a/mesalib/src/mesa/swrast/s_bitmap.c
+++ b/mesalib/src/mesa/swrast/s_bitmap.c
@@ -55,7 +55,7 @@ _swrast_Bitmap( struct gl_context *ctx, GLint px, GLint py,
GLuint count = 0;
SWspan span;
- ASSERT(ctx->RenderMode == GL_RENDER);
+ assert(ctx->RenderMode == GL_RENDER);
if (!_mesa_check_conditional_render(ctx))
return; /* don't draw */
@@ -154,8 +154,8 @@ _swrast_Bitmap( struct gl_context *ctx, GLint px, GLint py,
GLint row, col;
SWspan span;
- ASSERT(ctx->RenderMode == GL_RENDER);
- ASSERT(bitmap);
+ assert(ctx->RenderMode == GL_RENDER);
+ assert(bitmap);
swrast_render_start(ctx);
diff --git a/mesalib/src/mesa/swrast/s_blend.c b/mesalib/src/mesa/swrast/s_blend.c
index 1037b6236..7cb119407 100644
--- a/mesalib/src/mesa/swrast/s_blend.c
+++ b/mesalib/src/mesa/swrast/s_blend.c
@@ -75,10 +75,10 @@ blend_noop(struct gl_context *ctx, GLuint n, const GLubyte mask[],
{
GLint bytes;
- ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ZERO);
- ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE);
+ assert(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].SrcRGB == GL_ZERO);
+ assert(ctx->Color.Blend[0].DstRGB == GL_ONE);
(void) ctx;
/* just memcpy */
@@ -101,10 +101,10 @@ static void _BLENDAPI
blend_replace(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
- ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ONE);
- ASSERT(ctx->Color.Blend[0].DstRGB == GL_ZERO);
+ assert(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].SrcRGB == GL_ONE);
+ assert(ctx->Color.Blend[0].DstRGB == GL_ZERO);
(void) ctx;
(void) n;
(void) mask;
@@ -125,13 +125,13 @@ blend_transparency_ubyte(struct gl_context *ctx, GLuint n, const GLubyte mask[],
const GLubyte (*dest)[4] = (const GLubyte (*)[4]) dst;
GLuint i;
- ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
- ASSERT(chanType == GL_UNSIGNED_BYTE);
+ assert(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
+ assert(chanType == GL_UNSIGNED_BYTE);
(void) ctx;
@@ -148,10 +148,10 @@ blend_transparency_ubyte(struct gl_context *ctx, GLuint n, const GLubyte mask[],
const GLint g = DIV255((rgba[i][GCOMP] - dest[i][GCOMP]) * t) + dest[i][GCOMP];
const GLint b = DIV255((rgba[i][BCOMP] - dest[i][BCOMP]) * t) + dest[i][BCOMP];
const GLint a = DIV255((rgba[i][ACOMP] - dest[i][ACOMP]) * t) + dest[i][ACOMP];
- ASSERT(r <= 255);
- ASSERT(g <= 255);
- ASSERT(b <= 255);
- ASSERT(a <= 255);
+ assert(r <= 255);
+ assert(g <= 255);
+ assert(b <= 255);
+ assert(a <= 255);
rgba[i][RCOMP] = (GLubyte) r;
rgba[i][GCOMP] = (GLubyte) g;
rgba[i][BCOMP] = (GLubyte) b;
@@ -170,13 +170,13 @@ blend_transparency_ushort(struct gl_context *ctx, GLuint n, const GLubyte mask[]
const GLushort (*dest)[4] = (const GLushort (*)[4]) dst;
GLuint i;
- ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
- ASSERT(chanType == GL_UNSIGNED_SHORT);
+ assert(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
+ assert(chanType == GL_UNSIGNED_SHORT);
(void) ctx;
@@ -208,13 +208,13 @@ blend_transparency_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst;
GLuint i;
- ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
- ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
- ASSERT(chanType == GL_FLOAT);
+ assert(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
+ assert(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
+ assert(chanType == GL_FLOAT);
(void) ctx;
@@ -248,10 +248,10 @@ blend_add(struct gl_context *ctx, GLuint n, const GLubyte mask[],
{
GLuint i;
- ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
- ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ONE);
- ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE);
+ assert(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
+ assert(ctx->Color.Blend[0].SrcRGB == GL_ONE);
+ assert(ctx->Color.Blend[0].DstRGB == GL_ONE);
(void) ctx;
if (chanType == GL_UNSIGNED_BYTE) {
@@ -289,7 +289,7 @@ blend_add(struct gl_context *ctx, GLuint n, const GLubyte mask[],
else {
GLfloat (*rgba)[4] = (GLfloat (*)[4]) src;
const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst;
- ASSERT(chanType == GL_FLOAT);
+ assert(chanType == GL_FLOAT);
for (i=0;i<n;i++) {
if (mask[i]) {
/* don't RGB clamp to max */
@@ -313,8 +313,8 @@ blend_min(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLuint i;
- ASSERT(ctx->Color.Blend[0].EquationRGB == GL_MIN);
- ASSERT(ctx->Color.Blend[0].EquationA == GL_MIN);
+ assert(ctx->Color.Blend[0].EquationRGB == GL_MIN);
+ assert(ctx->Color.Blend[0].EquationA == GL_MIN);
(void) ctx;
if (chanType == GL_UNSIGNED_BYTE) {
@@ -344,7 +344,7 @@ blend_min(struct gl_context *ctx, GLuint n, const GLubyte mask[],
else {
GLfloat (*rgba)[4] = (GLfloat (*)[4]) src;
const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst;
- ASSERT(chanType == GL_FLOAT);
+ assert(chanType == GL_FLOAT);
for (i=0;i<n;i++) {
if (mask[i]) {
rgba[i][RCOMP] = MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
@@ -366,8 +366,8 @@ blend_max(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLuint i;
- ASSERT(ctx->Color.Blend[0].EquationRGB == GL_MAX);
- ASSERT(ctx->Color.Blend[0].EquationA == GL_MAX);
+ assert(ctx->Color.Blend[0].EquationRGB == GL_MAX);
+ assert(ctx->Color.Blend[0].EquationA == GL_MAX);
(void) ctx;
if (chanType == GL_UNSIGNED_BYTE) {
@@ -397,7 +397,7 @@ blend_max(struct gl_context *ctx, GLuint n, const GLubyte mask[],
else {
GLfloat (*rgba)[4] = (GLfloat (*)[4]) src;
const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst;
- ASSERT(chanType == GL_FLOAT);
+ assert(chanType == GL_FLOAT);
for (i=0;i<n;i++) {
if (mask[i]) {
rgba[i][RCOMP] = MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
@@ -450,7 +450,7 @@ blend_modulate(struct gl_context *ctx, GLuint n, const GLubyte mask[],
else {
GLfloat (*rgba)[4] = (GLfloat (*)[4]) src;
const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst;
- ASSERT(chanType == GL_FLOAT);
+ assert(chanType == GL_FLOAT);
for (i=0;i<n;i++) {
if (mask[i]) {
rgba[i][RCOMP] = rgba[i][RCOMP] * dest[i][RCOMP];
@@ -998,9 +998,9 @@ _swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *s
SWcontext *swrast = SWRAST_CONTEXT(ctx);
void *rbPixels;
- ASSERT(span->end <= SWRAST_MAX_WIDTH);
- ASSERT(span->arrayMask & SPAN_RGBA);
- ASSERT(!ctx->Color.ColorLogicOpEnabled);
+ assert(span->end <= SWRAST_MAX_WIDTH);
+ assert(span->arrayMask & SPAN_RGBA);
+ assert(!ctx->Color.ColorLogicOpEnabled);
rbPixels = _swrast_get_dest_rgba(ctx, rb, span);
diff --git a/mesalib/src/mesa/swrast/s_blit.c b/mesalib/src/mesa/swrast/s_blit.c
index 16e5b8c1c..3e838a41d 100644
--- a/mesalib/src/mesa/swrast/s_blit.c
+++ b/mesalib/src/mesa/swrast/s_blit.c
@@ -52,8 +52,8 @@ NAME(GLint srcWidth, GLint dstWidth, \
if (flip) { \
for (dstCol = 0; dstCol < dstWidth; dstCol++) { \
GLint srcCol = (dstCol * srcWidth) / dstWidth; \
- ASSERT(srcCol >= 0); \
- ASSERT(srcCol < srcWidth); \
+ assert(srcCol >= 0); \
+ assert(srcCol < srcWidth); \
srcCol = srcWidth - 1 - srcCol; /* flip */ \
if (SIZE == 1) { \
dst[dstCol] = src[srcCol]; \
@@ -73,8 +73,8 @@ NAME(GLint srcWidth, GLint dstWidth, \
else { \
for (dstCol = 0; dstCol < dstWidth; dstCol++) { \
GLint srcCol = (dstCol * srcWidth) / dstWidth; \
- ASSERT(srcCol >= 0); \
- ASSERT(srcCol < srcWidth); \
+ assert(srcCol >= 0); \
+ assert(srcCol < srcWidth); \
if (SIZE == 1) { \
dst[dstCol] = src[srcCol]; \
} \
@@ -299,8 +299,8 @@ blit_nearest(struct gl_context *ctx,
GLint srcRow = IROUND(srcRowF);
GLubyte *dstRowStart = dstMap + dstRowStride * dstRow;
- ASSERT(srcRow >= 0);
- ASSERT(srcRow < srcHeight);
+ assert(srcRow >= 0);
+ assert(srcRow < srcHeight);
if (invertY) {
srcRow = srcHeight - 1 - srcRow;
@@ -412,8 +412,8 @@ resample_linear_row_ub(GLint srcWidth, GLint dstWidth,
GLfloat colWeight = srcCol - srcCol0; /* fractional part of srcCol */
GLfloat red, green, blue, alpha;
- ASSERT(srcCol0 < srcWidth);
- ASSERT(srcCol1 <= srcWidth);
+ assert(srcCol0 < srcWidth);
+ assert(srcCol1 <= srcWidth);
if (srcCol1 == srcWidth) {
/* last column fudge */
@@ -467,8 +467,8 @@ resample_linear_row_float(GLint srcWidth, GLint dstWidth,
GLfloat colWeight = srcCol - srcCol0; /* fractional part of srcCol */
GLfloat red, green, blue, alpha;
- ASSERT(srcCol0 < srcWidth);
- ASSERT(srcCol1 <= srcWidth);
+ assert(srcCol0 < srcWidth);
+ assert(srcCol1 <= srcWidth);
if (srcCol1 == srcWidth) {
/* last column fudge */
@@ -801,7 +801,7 @@ _swrast_BlitFramebuffer(struct gl_context *ctx,
}
}
else {
- ASSERT(filter == GL_LINEAR);
+ assert(filter == GL_LINEAR);
if (mask & GL_COLOR_BUFFER_BIT) { /* depth/stencil not allowed */
blit_linear(ctx, readFb, drawFb, srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1);
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index ad11aa2c1..51cc22760 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -251,6 +251,7 @@ _swrast_update_fog_state( struct gl_context *ctx )
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
assert(fp == NULL || fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB);
+ (void) fp; /* silence unused var warning */
/* determine if fog is needed, and if so, which fog mode */
swrast->_FogEnabled = (!_swrast_use_fragment_program(ctx) &&
@@ -351,7 +352,7 @@ _swrast_validate_triangle( struct gl_context *ctx,
_swrast_validate_derived( ctx );
swrast->choose_triangle( ctx );
- ASSERT(swrast->Triangle);
+ assert(swrast->Triangle);
if (swrast->SpecularVertexAdd) {
/* separate specular color, but no texture */
@@ -373,7 +374,7 @@ _swrast_validate_line( struct gl_context *ctx, const SWvertex *v0, const SWverte
_swrast_validate_derived( ctx );
swrast->choose_line( ctx );
- ASSERT(swrast->Line);
+ assert(swrast->Line);
if (swrast->SpecularVertexAdd) {
swrast->SpecLine = swrast->Line;
diff --git a/mesalib/src/mesa/swrast/s_copypix.c b/mesalib/src/mesa/swrast/s_copypix.c
index e21c69dbc..17140ad2d 100644
--- a/mesalib/src/mesa/swrast/s_copypix.c
+++ b/mesalib/src/mesa/swrast/s_copypix.c
@@ -158,7 +158,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
p = NULL;
}
- ASSERT(width < SWRAST_MAX_WIDTH);
+ assert(width < SWRAST_MAX_WIDTH);
for (row = 0; row < height; row++, sy += stepy, dy += stepy) {
GLvoid *rgba = span.array->attribs[VARYING_SLOT_COL0];
@@ -468,7 +468,7 @@ swrast_fast_copy_pixels(struct gl_context *ctx,
dstRb = dstFb->Attachment[BUFFER_DEPTH].Renderbuffer;
}
else {
- ASSERT(type == GL_DEPTH_STENCIL_EXT);
+ assert(type == GL_DEPTH_STENCIL_EXT);
/* XXX correct? */
srcRb = srcFb->Attachment[BUFFER_DEPTH].Renderbuffer;
dstRb = dstFb->Attachment[BUFFER_DEPTH].Renderbuffer;
diff --git a/mesalib/src/mesa/swrast/s_drawpix.c b/mesalib/src/mesa/swrast/s_drawpix.c
index c99251904..bf427266c 100644
--- a/mesalib/src/mesa/swrast/s_drawpix.c
+++ b/mesalib/src/mesa/swrast/s_drawpix.c
@@ -373,7 +373,7 @@ draw_depth_pixels( struct gl_context *ctx, GLint x, GLint y,
while (skipPixels < width) {
const GLint spanWidth = MIN2(width - skipPixels, SWRAST_MAX_WIDTH);
GLint row;
- ASSERT(span.end <= SWRAST_MAX_WIDTH);
+ assert(span.end <= SWRAST_MAX_WIDTH);
for (row = 0; row < height; row++) {
const GLvoid *zSrc = _mesa_image_address2d(unpack,
pixels, width, height,
@@ -595,8 +595,8 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
depthRb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
stencilRb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
- ASSERT(depthRb);
- ASSERT(stencilRb);
+ assert(depthRb);
+ assert(stencilRb);
if (depthRb == stencilRb &&
(depthRb->Format == MESA_FORMAT_S8_UINT_Z24_UNORM ||
diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c
index 34b7c2d28..e270b7e24 100644
--- a/mesalib/src/mesa/swrast/s_fog.c
+++ b/mesalib/src/mesa/swrast/s_fog.c
@@ -23,6 +23,7 @@
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/macros.h"
@@ -49,12 +50,12 @@ _swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z)
return CLAMP(f, 0.0F, 1.0F);
case GL_EXP:
d = ctx->Fog.Density;
- f = EXPF(-d * z);
+ f = expf(-d * z);
f = CLAMP(f, 0.0F, 1.0F);
return f;
case GL_EXP2:
d = ctx->Fog.Density;
- f = EXPF(-(d * d * z * z));
+ f = expf(-(d * d * z * z));
f = CLAMP(f, 0.0F, 1.0F);
return f;
default:
@@ -66,14 +67,14 @@ _swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z)
#define LINEAR_FOG(f, coord) f = (fogEnd - coord) * fogScale
-#define EXP_FOG(f, coord) f = EXPF(density * coord)
+#define EXP_FOG(f, coord) f = expf(density * coord)
#define EXP2_FOG(f, coord) \
do { \
GLfloat tmp = negDensitySquared * coord * coord; \
if (tmp < FLT_MIN_10_EXP) \
tmp = FLT_MIN_10_EXP; \
- f = EXPF(tmp); \
+ f = expf(tmp); \
} while(0)
@@ -91,7 +92,7 @@ if (span->arrayAttribs & VARYING_BIT_FOGC) { \
GLuint i; \
for (i = 0; i < span->end; i++) { \
const GLfloat fogCoord = span->array->attribs[VARYING_SLOT_FOGC][i][0]; \
- const GLfloat c = FABSF(fogCoord); \
+ const GLfloat c = fabsf(fogCoord); \
GLfloat f, oneMinusF; \
FOG_FUNC(f, c); \
f = CLAMP(f, 0.0F, 1.0F); \
@@ -108,7 +109,7 @@ else { \
GLfloat w = span->attrStart[VARYING_SLOT_POS][3]; \
GLuint i; \
for (i = 0; i < span->end; i++) { \
- const GLfloat c = FABSF(fogCoord) / w; \
+ const GLfloat c = fabsf(fogCoord) / w; \
GLfloat f, oneMinusF; \
FOG_FUNC(f, c); \
f = CLAMP(f, 0.0F, 1.0F); \
@@ -134,8 +135,8 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
const SWcontext *swrast = CONST_SWRAST_CONTEXT(ctx);
GLfloat rFog, gFog, bFog;
- ASSERT(swrast->_FogEnabled);
- ASSERT(span->arrayMask & SPAN_RGBA);
+ assert(swrast->_FogEnabled);
+ assert(span->arrayMask & SPAN_RGBA);
/* compute (scaled) fog color */
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
@@ -174,7 +175,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
}
else {
GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
- ASSERT(span->array->ChanType == GL_FLOAT);
+ assert(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, LINEAR_FOG);
}
}
@@ -193,7 +194,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
}
else {
GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
- ASSERT(span->array->ChanType == GL_FLOAT);
+ assert(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, EXP_FOG);
}
}
@@ -212,7 +213,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
}
else {
GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
- ASSERT(span->array->ChanType == GL_FLOAT);
+ assert(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, EXP2_FOG);
}
}
@@ -237,7 +238,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
}
else {
GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
- ASSERT(span->array->ChanType == GL_FLOAT);
+ assert(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, BLEND_FOG);
}
}
diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c
index 1d7c33619..12bcda311 100644
--- a/mesalib/src/mesa/swrast/s_fragprog.c
+++ b/mesalib/src/mesa/swrast/s_fragprog.c
@@ -273,7 +273,7 @@ _swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span )
/* incoming colors should be floats */
if (program->Base.InputsRead & VARYING_BIT_COL0) {
- ASSERT(span->array->ChanType == GL_FLOAT);
+ assert(span->array->ChanType == GL_FLOAT);
}
run_program(ctx, span, 0, span->end);
diff --git a/mesalib/src/mesa/swrast/s_lines.c b/mesalib/src/mesa/swrast/s_lines.c
index b63296aa4..3e626b9e0 100644
--- a/mesalib/src/mesa/swrast/s_lines.c
+++ b/mesalib/src/mesa/swrast/s_lines.c
@@ -67,7 +67,7 @@ draw_wide_line( struct gl_context *ctx, SWspan *span, GLboolean xMajor )
ctx->Const.MaxLineWidth);
GLint start;
- ASSERT(span->end < SWRAST_MAX_WIDTH);
+ assert(span->end < SWRAST_MAX_WIDTH);
if (width & 1)
start = width / 2;
@@ -233,7 +233,7 @@ _swrast_choose_line( struct gl_context *ctx )
if (ctx->Line.SmoothFlag) {
/* antialiased lines */
_swrast_choose_aa_line_function(ctx);
- ASSERT(swrast->Line);
+ assert(swrast->Line);
}
else if (ctx->Texture._EnabledCoordUnits
|| _swrast_use_fragment_program(ctx)
@@ -252,8 +252,8 @@ _swrast_choose_line( struct gl_context *ctx )
#endif
}
else {
- ASSERT(!ctx->Depth.Test);
- ASSERT(ctx->Line.Width == 1.0);
+ assert(!ctx->Depth.Test);
+ assert(ctx->Line.Width == 1.0);
/* simple lines */
USE(simple_no_z_rgba_line);
}
@@ -262,7 +262,7 @@ _swrast_choose_line( struct gl_context *ctx )
USE(_swrast_feedback_line);
}
else {
- ASSERT(ctx->RenderMode == GL_SELECT);
+ assert(ctx->RenderMode == GL_SELECT);
USE(_swrast_select_line);
}
}
diff --git a/mesalib/src/mesa/swrast/s_linetemp.h b/mesalib/src/mesa/swrast/s_linetemp.h
index 7b1eac36a..352c88428 100644
--- a/mesalib/src/mesa/swrast/s_linetemp.h
+++ b/mesalib/src/mesa/swrast/s_linetemp.h
@@ -212,8 +212,8 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 )
#endif
}
- ASSERT(dx >= 0);
- ASSERT(dy >= 0);
+ assert(dx >= 0);
+ assert(dy >= 0);
numPixels = MAX2(dx, dy);
diff --git a/mesalib/src/mesa/swrast/s_logic.c b/mesalib/src/mesa/swrast/s_logic.c
index f68273fd2..c7cac2e40 100644
--- a/mesalib/src/mesa/swrast/s_logic.c
+++ b/mesalib/src/mesa/swrast/s_logic.c
@@ -193,8 +193,8 @@ _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
{
void *rbPixels;
- ASSERT(span->end < SWRAST_MAX_WIDTH);
- ASSERT(span->arrayMask & SPAN_RGBA);
+ assert(span->end < SWRAST_MAX_WIDTH);
+ assert(span->arrayMask & SPAN_RGBA);
rbPixels = _swrast_get_dest_rgba(ctx, rb, span);
diff --git a/mesalib/src/mesa/swrast/s_masking.c b/mesalib/src/mesa/swrast/s_masking.c
index c3aa41891..c95587b20 100644
--- a/mesalib/src/mesa/swrast/s_masking.c
+++ b/mesalib/src/mesa/swrast/s_masking.c
@@ -46,8 +46,8 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
const GLuint n = span->end;
void *rbPixels;
- ASSERT(n < SWRAST_MAX_WIDTH);
- ASSERT(span->arrayMask & SPAN_RGBA);
+ assert(n < SWRAST_MAX_WIDTH);
+ assert(span->arrayMask & SPAN_RGBA);
rbPixels = _swrast_get_dest_rgba(ctx, rb, span);
diff --git a/mesalib/src/mesa/swrast/s_points.c b/mesalib/src/mesa/swrast/s_points.c
index b9bec237e..8180483ba 100644
--- a/mesalib/src/mesa/swrast/s_points.c
+++ b/mesalib/src/mesa/swrast/s_points.c
@@ -140,7 +140,7 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert)
if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) {
/* a texcoord attribute */
const GLuint u = attr - VARYING_SLOT_TEX0;
- ASSERT(u < Elements(ctx->Point.CoordReplace));
+ assert(u < ARRAY_SIZE(ctx->Point.CoordReplace));
if (ctx->Point.CoordReplace[u]) {
tCoords[numTcoords++] = attr;
@@ -504,7 +504,7 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert)
span->array->z[count] = (GLint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F);
span->end = count + 1;
- ASSERT(span->end <= SWRAST_MAX_WIDTH);
+ assert(span->end <= SWRAST_MAX_WIDTH);
}
diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c
index dfd3a6057..d8c4ed386 100644
--- a/mesalib/src/mesa/swrast/s_renderbuffer.c
+++ b/mesalib/src/mesa/swrast/s_renderbuffer.c
@@ -153,7 +153,7 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
else {
/* the internalFormat should have been error checked long ago */
- ASSERT(rb->_BaseFormat);
+ assert(rb->_BaseFormat);
}
return GL_TRUE;
diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c
index 321959df9..5d618f048 100644
--- a/mesalib/src/mesa/swrast/s_span.c
+++ b/mesalib/src/mesa/swrast/s_span.c
@@ -31,6 +31,7 @@
* \author Brian Paul
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/format_pack.h"
@@ -205,7 +206,7 @@ interpolate_active_attribs(struct gl_context *ctx, SWspan *span,
v3 += dv3dx;
w += dwdx;
}
- ASSERT((span->arrayAttribs & BITFIELD64_BIT(attr)) == 0);
+ assert((span->arrayAttribs & BITFIELD64_BIT(attr)) == 0);
span->arrayAttribs |= BITFIELD64_BIT(attr);
}
ATTRIB_LOOP_END
@@ -223,7 +224,7 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span)
const GLuint n = span->end;
GLuint i;
- ASSERT(!(span->arrayMask & SPAN_RGBA));
+ assert(!(span->arrayMask & SPAN_RGBA));
#endif
switch (span->array->ChanType) {
@@ -336,7 +337,7 @@ interpolate_float_colors(SWspan *span)
}
else {
/* interpolate red/green/blue/alpha to get float colors */
- ASSERT(span->interpMask & SPAN_RGBA);
+ assert(span->interpMask & SPAN_RGBA);
if (span->interpMask & SPAN_FLAT) {
GLfloat r = FixedToFloat(span->red);
GLfloat g = FixedToFloat(span->green);
@@ -383,7 +384,7 @@ _swrast_span_interpolate_z( const struct gl_context *ctx, SWspan *span )
const GLuint n = span->end;
GLuint i;
- ASSERT(!(span->arrayMask & SPAN_Z));
+ assert(!(span->arrayMask & SPAN_Z));
if (ctx->DrawBuffer->Visual.depthBits <= 16) {
GLfixed zval = span->z;
@@ -443,10 +444,10 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
GLfloat dsdy2 = (s + dsdy) / (q + dqdy) - s * invQ;
GLfloat dtdy2 = (t + dtdy) / (q + dqdy) - t * invQ;
GLfloat maxU, maxV, rho, lambda;
- dsdx2 = FABSF(dsdx2);
- dsdy2 = FABSF(dsdy2);
- dtdx2 = FABSF(dtdx2);
- dtdy2 = FABSF(dtdy2);
+ dsdx2 = fabsf(dsdx2);
+ dsdy2 = fabsf(dsdy2);
+ dtdx2 = fabsf(dtdx2);
+ dtdy2 = fabsf(dtdy2);
maxU = MAX2(dsdx2, dsdy2) * texW;
maxV = MAX2(dtdx2, dtdy2) * texH;
rho = MAX2(maxU, maxV);
@@ -658,7 +659,7 @@ stipple_polygon_span(struct gl_context *ctx, SWspan *span)
{
GLubyte *mask = span->array->mask;
- ASSERT(ctx->Polygon.StippleFlag);
+ assert(ctx->Polygon.StippleFlag);
if (span->arrayMask & SPAN_XY) {
/* arrays of x/y pixel coords */
@@ -748,7 +749,7 @@ clip_span( struct gl_context *ctx, SWspan *span )
/* Clip to right */
if (x + n > xmax) {
- ASSERT(x < xmax);
+ assert(x < xmax);
n = span->end = xmax - x;
}
@@ -757,8 +758,8 @@ clip_span( struct gl_context *ctx, SWspan *span )
const GLint leftClip = xmin - x;
GLuint i;
- ASSERT(leftClip > 0);
- ASSERT(x + n > xmin);
+ assert(leftClip > 0);
+ assert(x + n > xmin);
/* Clip 'leftClip' pixels from the left side.
* The span->leftClip field will be applied when we interpolate
@@ -813,10 +814,10 @@ clip_span( struct gl_context *ctx, SWspan *span )
span->writeAll = GL_FALSE;
}
- ASSERT(span->x >= xmin);
- ASSERT(span->x + span->end <= xmax);
- ASSERT(span->y >= ymin);
- ASSERT(span->y < ymax);
+ assert(span->x >= xmin);
+ assert(span->x + span->end <= xmax);
+ assert(span->y >= ymin);
+ assert(span->y < ymax);
return GL_TRUE; /* some pixels visible */
}
@@ -837,9 +838,9 @@ add_specular(struct gl_context *ctx, SWspan *span)
GLfloat (*col1)[4] = span->array->attribs[VARYING_SLOT_COL1];
GLuint i;
- ASSERT(!_swrast_use_fragment_program(ctx));
- ASSERT(span->arrayMask & SPAN_RGBA);
- ASSERT(swrast->_ActiveAttribMask & VARYING_BIT_COL1);
+ assert(!_swrast_use_fragment_program(ctx));
+ assert(span->arrayMask & SPAN_RGBA);
+ assert(swrast->_ActiveAttribMask & VARYING_BIT_COL1);
(void) swrast; /* silence warning */
if (span->array->ChanType == GL_FLOAT) {
@@ -859,8 +860,8 @@ add_specular(struct gl_context *ctx, SWspan *span)
interpolate_active_attribs(ctx, span, VARYING_BIT_COL1);
}
- ASSERT(span->arrayAttribs & VARYING_BIT_COL0);
- ASSERT(span->arrayAttribs & VARYING_BIT_COL1);
+ assert(span->arrayAttribs & VARYING_BIT_COL0);
+ assert(span->arrayAttribs & VARYING_BIT_COL1);
for (i = 0; i < span->end; i++) {
if (mask[i]) {
@@ -887,8 +888,8 @@ apply_aa_coverage(SWspan *span)
for (i = 0; i < span->end; i++) {
const GLfloat a = rgba[i][ACOMP] * coverage[i];
rgba[i][ACOMP] = (GLubyte) CLAMP(a, 0.0, 255.0);
- ASSERT(coverage[i] >= 0.0);
- ASSERT(coverage[i] <= 1.0);
+ assert(coverage[i] >= 0.0);
+ assert(coverage[i] <= 1.0);
}
}
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
@@ -916,7 +917,7 @@ clamp_colors(SWspan *span)
{
GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
GLuint i;
- ASSERT(span->array->ChanType == GL_FLOAT);
+ assert(span->array->ChanType == GL_FLOAT);
for (i = 0; i < span->end; i++) {
rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
@@ -945,7 +946,7 @@ convert_color_type(SWspan *span, GLenum srcType, GLenum newType, GLuint output)
src = span->array->rgba8;
}
else {
- ASSERT(srcType == GL_UNSIGNED_SHORT);
+ assert(srcType == GL_UNSIGNED_SHORT);
src = span->array->rgba16;
}
@@ -1008,7 +1009,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span)
_swrast_exec_fragment_program(ctx, span);
}
else {
- ASSERT(ctx->ATIFragmentShader._Enabled);
+ assert(ctx->ATIFragmentShader._Enabled);
_swrast_exec_fragment_shader(ctx, span);
}
}
@@ -1147,7 +1148,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
span->interpMask, span->arrayMask);
*/
- ASSERT(span->primitive == GL_POINT ||
+ assert(span->primitive == GL_POINT ||
span->primitive == GL_LINE ||
span->primitive == GL_POLYGON ||
span->primitive == GL_BITMAP);
@@ -1167,7 +1168,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
return;
}
- ASSERT(span->end <= SWRAST_MAX_WIDTH);
+ assert(span->end <= SWRAST_MAX_WIDTH);
/* Depth bounds test */
if (ctx->Depth.BoundsTest && fb->Visual.depthBits > 0) {
@@ -1229,8 +1230,8 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
}
else if (fb->Visual.depthBits > 0) {
/* Just regular depth testing */
- ASSERT(ctx->Depth.Test);
- ASSERT(span->arrayMask & SPAN_Z);
+ assert(ctx->Depth.Test);
+ assert(span->arrayMask & SPAN_Z);
if (!_swrast_depth_test_span(ctx, span)) {
/* all fragments failed test */
goto end;
@@ -1272,7 +1273,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
}
#endif
- ASSERT(span->arrayMask & SPAN_RGBA);
+ assert(span->arrayMask & SPAN_RGBA);
if (span->primitive == GL_BITMAP || !swrast->SpecularVertexAdd) {
/* Add primary and specular (diffuse + specular) colors */
@@ -1353,7 +1354,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
4 * span->end * sizeof(GLchan));
}
- ASSERT(rb->_BaseFormat == GL_RGBA ||
+ assert(rb->_BaseFormat == GL_RGBA ||
rb->_BaseFormat == GL_RGB ||
rb->_BaseFormat == GL_RED ||
rb->_BaseFormat == GL_RG ||
@@ -1457,8 +1458,8 @@ _swrast_read_rgba_span( struct gl_context *ctx, struct gl_renderbuffer *rb,
length = (GLint) n;
}
- ASSERT(rb);
- ASSERT(rb->_BaseFormat == GL_RGBA ||
+ assert(rb);
+ assert(rb->_BaseFormat == GL_RGBA ||
rb->_BaseFormat == GL_RGB ||
rb->_BaseFormat == GL_RG ||
rb->_BaseFormat == GL_RED ||
@@ -1468,6 +1469,7 @@ _swrast_read_rgba_span( struct gl_context *ctx, struct gl_renderbuffer *rb,
rb->_BaseFormat == GL_ALPHA);
assert(srb->Map);
+ (void) srb; /* silence unused var warning */
src = _swrast_pixel_address(rb, x + skip, y);
diff --git a/mesalib/src/mesa/swrast/s_stencil.c b/mesalib/src/mesa/swrast/s_stencil.c
index eba9da863..294b593a2 100644
--- a/mesalib/src/mesa/swrast/s_stencil.c
+++ b/mesalib/src/mesa/swrast/s_stencil.c
@@ -280,7 +280,7 @@ compute_pass_fail_masks(GLuint n, const GLubyte origMask[],
{
GLuint i;
for (i = 0; i < n; i++) {
- ASSERT(newMask[i] == 0 || newMask[i] == 1);
+ assert(newMask[i] == 0 || newMask[i] == 1);
passMask[i] = origMask[i] & newMask[i];
failMask[i] = origMask[i] & (newMask[i] ^ 1);
}
diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c
index def5eb19e..58ff16465 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.c
+++ b/mesalib/src/mesa/swrast/s_texcombine.c
@@ -188,7 +188,7 @@ texture_combine( struct gl_context *ctx, GLuint unit,
/* ARB_texture_env_crossbar source */
{
const GLuint srcUnit = srcRGB - GL_TEXTURE0;
- ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
+ assert(srcUnit < ctx->Const.MaxTextureUnits);
if (!ctx->Texture.Unit[srcUnit]._Current)
goto end;
argRGB[term] = get_texel_array(swrast, srcUnit);
@@ -278,7 +278,7 @@ texture_combine( struct gl_context *ctx, GLuint unit,
/* ARB_texture_env_crossbar source */
{
const GLuint srcUnit = srcA - GL_TEXTURE0;
- ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
+ assert(srcUnit < ctx->Const.MaxTextureUnits);
if (!ctx->Texture.Unit[srcUnit]._Current)
goto end;
argA[term] = get_texel_array(swrast, srcUnit);
@@ -628,7 +628,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
return;
}
- ASSERT(span->end <= SWRAST_MAX_WIDTH);
+ assert(span->end <= SWRAST_MAX_WIDTH);
/*
* Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR)
diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index 9629024b9..3c4ee15ba 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -573,7 +573,7 @@ set_fetch_functions(const struct gl_sampler_object *samp,
}
#endif
- STATIC_ASSERT(Elements(texfetch_funcs) == MESA_FORMAT_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(texfetch_funcs) == MESA_FORMAT_COUNT);
if (samp->sRGBDecode == GL_SKIP_DECODE_EXT &&
_mesa_get_format_color_encoding(format) == GL_SRGB) {
@@ -598,7 +598,7 @@ set_fetch_functions(const struct gl_sampler_object *samp,
texImage->FetchCompressedTexel = _mesa_get_compressed_fetch_func(format);
- ASSERT(texImage->FetchTexel);
+ assert(texImage->FetchTexel);
}
void
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index fa79fdc5b..3ade99519 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -23,6 +23,7 @@
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/colormac.h"
@@ -223,7 +224,7 @@ linear_texel_locations(GLenum wrapMode,
}
break;
case GL_MIRROR_CLAMP_EXT:
- u = FABSF(s);
+ u = fabsf(s);
if (u >= 1.0F)
u = (GLfloat) size;
else
@@ -233,7 +234,7 @@ linear_texel_locations(GLenum wrapMode,
*i1 = *i0 + 1;
break;
case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- u = FABSF(s);
+ u = fabsf(s);
if (u >= 1.0F)
u = (GLfloat) size;
else
@@ -250,7 +251,7 @@ linear_texel_locations(GLenum wrapMode,
{
const GLfloat min = -1.0F / (2.0F * size);
const GLfloat max = 1.0F - min;
- u = FABSF(s);
+ u = fabsf(s);
if (u <= min)
u = min * size;
else if (u >= max)
@@ -354,7 +355,7 @@ nearest_texel_location(GLenum wrapMode,
{
/* s limited to [0,1] */
/* i limited to [0,size-1] */
- const GLfloat u = FABSF(s);
+ const GLfloat u = fabsf(s);
if (u <= 0.0F)
i = 0;
else if (u >= 1.0F)
@@ -369,7 +370,7 @@ nearest_texel_location(GLenum wrapMode,
/* i limited to [0, size-1] */
const GLfloat min = 1.0F / (2.0F * size);
const GLfloat max = 1.0F - min;
- const GLfloat u = FABSF(s);
+ const GLfloat u = fabsf(s);
if (u < min)
i = 0;
else if (u > max)
@@ -384,7 +385,7 @@ nearest_texel_location(GLenum wrapMode,
/* i limited to [0, size-1] */
const GLfloat min = -1.0F / (2.0F * size);
const GLfloat max = 1.0F - min;
- const GLfloat u = FABSF(s);
+ const GLfloat u = fabsf(s);
if (u < min)
i = -1;
else if (u > max)
@@ -668,7 +669,7 @@ compute_min_mag_ranges(const struct gl_sampler_object *samp,
GLfloat minMagThresh;
/* we shouldn't be here if minfilter == magfilter */
- ASSERT(samp->MinFilter != samp->MagFilter);
+ assert(samp->MinFilter != samp->MagFilter);
/* This bit comes from the OpenGL spec: */
if (samp->MagFilter == GL_LINEAR
@@ -690,12 +691,12 @@ compute_min_mag_ranges(const struct gl_sampler_object *samp,
printf("lambda delta = %g\n", lambda[0] - lambda[n-1]);
if (lambda[0] >= lambda[n-1]) { /* decreasing */
for (i = 0; i < n - 1; i++) {
- ASSERT((GLint) (lambda[i] * 10) >= (GLint) (lambda[i+1] * 10));
+ assert((GLint) (lambda[i] * 10) >= (GLint) (lambda[i+1] * 10));
}
}
else { /* increasing */
for (i = 0; i < n - 1; i++) {
- ASSERT((GLint) (lambda[i] * 10) <= (GLint) (lambda[i+1] * 10));
+ assert((GLint) (lambda[i] * 10) <= (GLint) (lambda[i+1] * 10));
}
}
}
@@ -749,13 +750,13 @@ compute_min_mag_ranges(const struct gl_sampler_object *samp,
for (i = 0; i < n; i++) {
if (lambda[i] > minMagThresh) {
/* minification */
- ASSERT(i >= *minStart);
- ASSERT(i < *minEnd);
+ assert(i >= *minStart);
+ assert(i < *minEnd);
}
else {
/* magnification */
- ASSERT(i >= *magStart);
- ASSERT(i < *magEnd);
+ assert(i >= *magStart);
+ assert(i < *magEnd);
}
}
}
@@ -920,7 +921,7 @@ sample_1d_nearest_mipmap_nearest(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = nearest_mipmap_level(tObj, lambda[i]);
sample_1d_nearest(ctx, samp, tObj->Image[0][level], texcoord[i], rgba[i]);
@@ -936,7 +937,7 @@ sample_1d_linear_mipmap_nearest(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = nearest_mipmap_level(tObj, lambda[i]);
sample_1d_linear(ctx, samp, tObj->Image[0][level], texcoord[i], rgba[i]);
@@ -952,7 +953,7 @@ sample_1d_nearest_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -978,7 +979,7 @@ sample_1d_linear_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -1042,7 +1043,7 @@ sample_lambda_1d( struct gl_context *ctx,
GLuint magStart, magEnd; /* texels with magnification */
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
compute_min_mag_ranges(samp, n, lambda,
&minStart, &minEnd, &magStart, &magEnd);
@@ -1226,10 +1227,10 @@ sample_2d_linear_repeat(struct gl_context *ctx,
(void) ctx;
- ASSERT(samp->WrapS == GL_REPEAT);
- ASSERT(samp->WrapT == GL_REPEAT);
- ASSERT(img->Border == 0);
- ASSERT(swImg->_IsPowerOfTwo);
+ assert(samp->WrapS == GL_REPEAT);
+ assert(samp->WrapT == GL_REPEAT);
+ assert(img->Border == 0);
+ assert(swImg->_IsPowerOfTwo);
linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi);
linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
@@ -1266,7 +1267,7 @@ sample_2d_linear_mipmap_nearest(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = nearest_mipmap_level(tObj, lambda[i]);
sample_2d_linear(ctx, samp, tObj->Image[0][level], texcoord[i], rgba[i]);
@@ -1282,7 +1283,7 @@ sample_2d_nearest_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -1308,7 +1309,7 @@ sample_2d_linear_mipmap_linear( struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4] )
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -1334,9 +1335,9 @@ sample_2d_linear_mipmap_linear_repeat(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
- ASSERT(samp->WrapS == GL_REPEAT);
- ASSERT(samp->WrapT == GL_REPEAT);
+ assert(lambda != NULL);
+ assert(samp->WrapS == GL_REPEAT);
+ assert(samp->WrapT == GL_REPEAT);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -1426,11 +1427,11 @@ opt_sample_rgb_2d(struct gl_context *ctx,
GLuint k;
(void) ctx;
(void) lambda;
- ASSERT(samp->WrapS==GL_REPEAT);
- ASSERT(samp->WrapT==GL_REPEAT);
- ASSERT(img->Border==0);
- ASSERT(img->TexFormat == MESA_FORMAT_BGR_UNORM8);
- ASSERT(swImg->_IsPowerOfTwo);
+ assert(samp->WrapS==GL_REPEAT);
+ assert(samp->WrapT==GL_REPEAT);
+ assert(img->Border==0);
+ assert(img->TexFormat == MESA_FORMAT_BGR_UNORM8);
+ assert(swImg->_IsPowerOfTwo);
(void) swImg;
for (k=0; k<n; k++) {
@@ -1471,11 +1472,11 @@ opt_sample_rgba_2d(struct gl_context *ctx,
GLuint i;
(void) ctx;
(void) lambda;
- ASSERT(samp->WrapS==GL_REPEAT);
- ASSERT(samp->WrapT==GL_REPEAT);
- ASSERT(img->Border==0);
- ASSERT(img->TexFormat == MESA_FORMAT_A8B8G8R8_UNORM);
- ASSERT(swImg->_IsPowerOfTwo);
+ assert(samp->WrapS==GL_REPEAT);
+ assert(samp->WrapT==GL_REPEAT);
+ assert(img->Border==0);
+ assert(img->TexFormat == MESA_FORMAT_A8B8G8R8_UNORM);
+ assert(swImg->_IsPowerOfTwo);
(void) swImg;
for (i = 0; i < n; i++) {
@@ -1511,7 +1512,7 @@ sample_lambda_2d(struct gl_context *ctx,
swImg->RowStride)
&& swImg->_IsPowerOfTwo;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
compute_min_mag_ranges(samp, n, lambda,
&minStart, &minEnd, &magStart, &magEnd);
@@ -1674,7 +1675,7 @@ sample_2d_ewa(struct gl_context *ctx,
GLfloat F = A*C-B*B/4.0f;
/* check if it is an ellipse */
- /* ASSERT(F > 0.0); */
+ /* assert(F > 0.0); */
/* Compute the ellipse's (u,v) bounding box in texture space */
GLfloat d = -B*B+4.0f*C*A;
@@ -2164,7 +2165,7 @@ sample_3d_linear_mipmap_nearest(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = nearest_mipmap_level(tObj, lambda[i]);
sample_3d_linear(ctx, samp, tObj->Image[0][level], texcoord[i], rgba[i]);
@@ -2180,7 +2181,7 @@ sample_3d_nearest_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -2206,7 +2207,7 @@ sample_3d_linear_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -2270,7 +2271,7 @@ sample_lambda_3d(struct gl_context *ctx,
GLuint magStart, magEnd; /* texels with magnification */
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
compute_min_mag_ranges(samp, n, lambda,
&minStart, &minEnd, &magStart, &magEnd);
@@ -2358,7 +2359,7 @@ choose_cube_face(const struct gl_texture_object *texObj,
const GLfloat rx = texcoord[0];
const GLfloat ry = texcoord[1];
const GLfloat rz = texcoord[2];
- const GLfloat arx = FABSF(rx), ary = FABSF(ry), arz = FABSF(rz);
+ const GLfloat arx = fabsf(rx), ary = fabsf(ry), arz = fabsf(rz);
GLuint face;
GLfloat sc, tc, ma;
@@ -2471,7 +2472,7 @@ sample_cube_nearest_mipmap_nearest(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
GLfloat newCoord[4];
@@ -2506,7 +2507,7 @@ sample_cube_linear_mipmap_nearest(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
GLfloat newCoord[4];
@@ -2531,7 +2532,7 @@ sample_cube_nearest_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
GLfloat newCoord[4];
@@ -2566,7 +2567,7 @@ sample_cube_linear_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
GLfloat newCoord[4];
@@ -2604,7 +2605,7 @@ sample_lambda_cube(struct gl_context *ctx,
GLuint minStart, minEnd; /* texels with minification */
GLuint magStart, magEnd; /* texels with magnification */
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
compute_min_mag_ranges(samp, n, lambda,
&minStart, &minEnd, &magStart, &magEnd);
@@ -2687,10 +2688,10 @@ sample_nearest_rect(struct gl_context *ctx,
(void) ctx;
(void) lambda;
- ASSERT(samp->WrapS == GL_CLAMP ||
+ assert(samp->WrapS == GL_CLAMP ||
samp->WrapS == GL_CLAMP_TO_EDGE ||
samp->WrapS == GL_CLAMP_TO_BORDER);
- ASSERT(samp->WrapT == GL_CLAMP ||
+ assert(samp->WrapT == GL_CLAMP ||
samp->WrapT == GL_CLAMP_TO_EDGE ||
samp->WrapT == GL_CLAMP_TO_BORDER);
@@ -2722,10 +2723,10 @@ sample_linear_rect(struct gl_context *ctx,
(void) ctx;
(void) lambda;
- ASSERT(samp->WrapS == GL_CLAMP ||
+ assert(samp->WrapS == GL_CLAMP ||
samp->WrapS == GL_CLAMP_TO_EDGE ||
samp->WrapS == GL_CLAMP_TO_BORDER);
- ASSERT(samp->WrapT == GL_CLAMP ||
+ assert(samp->WrapT == GL_CLAMP ||
samp->WrapT == GL_CLAMP_TO_EDGE ||
samp->WrapT == GL_CLAMP_TO_BORDER);
@@ -2947,7 +2948,7 @@ sample_2d_array_linear_mipmap_nearest(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = nearest_mipmap_level(tObj, lambda[i]);
sample_2d_array_linear(ctx, samp, tObj->Image[0][level],
@@ -2964,7 +2965,7 @@ sample_2d_array_nearest_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -2992,7 +2993,7 @@ sample_2d_array_linear_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -3059,7 +3060,7 @@ sample_lambda_2d_array(struct gl_context *ctx,
GLuint magStart, magEnd; /* texels with magnification */
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
compute_min_mag_ranges(samp, n, lambda,
&minStart, &minEnd, &magStart, &magEnd);
@@ -3242,7 +3243,7 @@ sample_1d_array_linear_mipmap_nearest(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = nearest_mipmap_level(tObj, lambda[i]);
sample_1d_array_linear(ctx, samp, tObj->Image[0][level],
@@ -3259,7 +3260,7 @@ sample_1d_array_nearest_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -3285,7 +3286,7 @@ sample_1d_array_linear_mipmap_linear(struct gl_context *ctx,
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
@@ -3349,7 +3350,7 @@ sample_lambda_1d_array(struct gl_context *ctx,
GLuint magStart, magEnd; /* texels with magnification */
GLuint i;
- ASSERT(lambda != NULL);
+ assert(lambda != NULL);
compute_min_mag_ranges(samp, n, lambda,
&minStart, &minEnd, &magStart, &magEnd);
@@ -3555,10 +3556,10 @@ sample_depth_texture( struct gl_context *ctx,
GLenum function;
GLfloat result;
- ASSERT(img->_BaseFormat == GL_DEPTH_COMPONENT ||
+ assert(img->_BaseFormat == GL_DEPTH_COMPONENT ||
img->_BaseFormat == GL_DEPTH_STENCIL_EXT);
- ASSERT(tObj->Target == GL_TEXTURE_1D ||
+ assert(tObj->Target == GL_TEXTURE_1D ||
tObj->Target == GL_TEXTURE_2D ||
tObj->Target == GL_TEXTURE_RECTANGLE_NV ||
tObj->Target == GL_TEXTURE_1D_ARRAY_EXT ||
@@ -3595,7 +3596,7 @@ sample_depth_texture( struct gl_context *ctx,
}
else {
GLuint i;
- ASSERT(samp->MagFilter == GL_LINEAR);
+ assert(samp->MagFilter == GL_LINEAR);
for (i = 0; i < n; i++) {
GLfloat depth00, depth01, depth10, depth11, depthRef;
GLint i0, i1, j0, j1;
@@ -3730,7 +3731,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_linear_1d;
}
else {
- ASSERT(sampler->MinFilter == GL_NEAREST);
+ assert(sampler->MinFilter == GL_NEAREST);
return &sample_nearest_1d;
}
case GL_TEXTURE_2D:
@@ -3755,7 +3756,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
swrast_texture_image_const(img);
texture_sample_func func;
- ASSERT(sampler->MinFilter == GL_NEAREST);
+ assert(sampler->MinFilter == GL_NEAREST);
func = &sample_nearest_2d;
if (sampler->WrapS == GL_REPEAT &&
sampler->WrapT == GL_REPEAT &&
@@ -3777,7 +3778,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_linear_3d;
}
else {
- ASSERT(sampler->MinFilter == GL_NEAREST);
+ assert(sampler->MinFilter == GL_NEAREST);
return &sample_nearest_3d;
}
case GL_TEXTURE_CUBE_MAP:
@@ -3788,7 +3789,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_linear_cube;
}
else {
- ASSERT(sampler->MinFilter == GL_NEAREST);
+ assert(sampler->MinFilter == GL_NEAREST);
return &sample_nearest_cube;
}
case GL_TEXTURE_RECTANGLE_NV:
@@ -3802,7 +3803,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_linear_rect;
}
else {
- ASSERT(sampler->MinFilter == GL_NEAREST);
+ assert(sampler->MinFilter == GL_NEAREST);
return &sample_nearest_rect;
}
case GL_TEXTURE_1D_ARRAY_EXT:
@@ -3816,7 +3817,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_linear_1d_array;
}
else {
- ASSERT(sampler->MinFilter == GL_NEAREST);
+ assert(sampler->MinFilter == GL_NEAREST);
return &sample_nearest_1d_array;
}
case GL_TEXTURE_2D_ARRAY_EXT:
@@ -3830,7 +3831,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_linear_2d_array;
}
else {
- ASSERT(sampler->MinFilter == GL_NEAREST);
+ assert(sampler->MinFilter == GL_NEAREST);
return &sample_nearest_2d_array;
}
default:
diff --git a/mesalib/src/mesa/swrast/s_texrender.c b/mesalib/src/mesa/swrast/s_texrender.c
index d67e48ad3..29bb270d6 100644
--- a/mesalib/src/mesa/swrast/s_texrender.c
+++ b/mesalib/src/mesa/swrast/s_texrender.c
@@ -18,7 +18,7 @@
static void
delete_texture_wrapper(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
- ASSERT(rb->RefCount == 0);
+ assert(rb->RefCount == 0);
free(rb);
}
diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c
index 1d8e31c2e..af039c359 100644
--- a/mesalib/src/mesa/swrast/s_triangle.c
+++ b/mesalib/src/mesa/swrast/s_triangle.c
@@ -78,8 +78,8 @@ _swrast_culltriangle( struct gl_context *ctx,
#define NAME flat_rgba_triangle
#define INTERP_Z 1
#define SETUP_CODE \
- ASSERT(ctx->Texture._EnabledCoordUnits == 0);\
- ASSERT(ctx->Light.ShadeModel==GL_FLAT); \
+ assert(ctx->Texture._EnabledCoordUnits == 0);\
+ assert(ctx->Light.ShadeModel==GL_FLAT); \
span.interpMask |= SPAN_RGBA; \
span.red = ChanToFixed(v2->color[0]); \
span.green = ChanToFixed(v2->color[1]); \
@@ -104,8 +104,8 @@ _swrast_culltriangle( struct gl_context *ctx,
#define SETUP_CODE \
{ \
/* texturing must be off */ \
- ASSERT(ctx->Texture._EnabledCoordUnits == 0); \
- ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \
+ assert(ctx->Texture._EnabledCoordUnits == 0); \
+ assert(ctx->Light.ShadeModel==GL_SMOOTH); \
}
#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span);
#include "s_tritemp.h"
@@ -137,7 +137,7 @@ _swrast_culltriangle( struct gl_context *ctx,
const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \
const GLint smask = texImg->Width - 1; \
const GLint tmask = texImg->Height - 1; \
- ASSERT(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \
+ assert(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \
if (!rb || !texture) { \
return; \
}
@@ -195,7 +195,7 @@ _swrast_culltriangle( struct gl_context *ctx,
const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \
const GLint smask = texImg->Width - 1; \
const GLint tmask = texImg->Height - 1; \
- ASSERT(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \
+ assert(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \
if (!rb || !texture) { \
return; \
}
@@ -513,7 +513,7 @@ affine_span(struct gl_context *ctx, SWspan *span,
break;
}
span->interpMask &= ~SPAN_RGBA;
- ASSERT(span->arrayMask & SPAN_RGBA);
+ assert(span->arrayMask & SPAN_RGBA);
_swrast_write_rgba_span(ctx, span);
@@ -783,7 +783,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
break;
}
- ASSERT(span->arrayMask & SPAN_RGBA);
+ assert(span->arrayMask & SPAN_RGBA);
_swrast_write_rgba_span(ctx, span);
#undef SPAN_NEAREST
@@ -885,9 +885,9 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
struct gl_renderbuffer *rb = \
ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; \
struct gl_query_object *q = ctx->Query.CurrentOcclusionObject; \
- ASSERT(ctx->Depth.Test); \
- ASSERT(!ctx->Depth.Mask); \
- ASSERT(ctx->Depth.Func == GL_LESS); \
+ assert(ctx->Depth.Test); \
+ assert(!ctx->Depth.Mask); \
+ assert(ctx->Depth.Func == GL_LESS); \
assert(rb->Format == MESA_FORMAT_Z_UNORM16); \
if (!q) { \
return; \
@@ -1015,7 +1015,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
if (ctx->Polygon.SmoothFlag) {
_swrast_set_aa_triangle_function(ctx);
- ASSERT(swrast->Triangle);
+ assert(swrast->Triangle);
return;
}
@@ -1134,8 +1134,8 @@ _swrast_choose_triangle( struct gl_context *ctx )
}
}
else {
- ASSERT(!swrast->_FogEnabled);
- ASSERT(!_mesa_need_secondary_color(ctx));
+ assert(!swrast->_FogEnabled);
+ assert(!_mesa_need_secondary_color(ctx));
if (ctx->Light.ShadeModel==GL_SMOOTH) {
/* smooth shaded, no texturing, stippled or some raster ops */
#if CHAN_BITS != 8
diff --git a/mesalib/src/mesa/swrast/s_tritemp.h b/mesalib/src/mesa/swrast/s_tritemp.h
index 8a278dff6..fb73b2d59 100644
--- a/mesalib/src/mesa/swrast/s_tritemp.h
+++ b/mesalib/src/mesa/swrast/s_tritemp.h
@@ -91,6 +91,11 @@
*/
+#ifndef MAX_GLUINT
+#define MAX_GLUINT 0xffffffff
+#endif
+
+
/*
* Some code we unfortunately need to prevent negative interpolated colors.
*/
@@ -380,7 +385,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
# endif /* INTERP_ALPHA */
}
else {
- ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+ assert(ctx->Light.ShadeModel == GL_FLAT);
span.interpMask |= SPAN_FLAT;
span.attrStepX[VARYING_SLOT_COL0][0] = span.attrStepY[VARYING_SLOT_COL0][0] = 0.0F;
span.attrStepX[VARYING_SLOT_COL0][1] = span.attrStepY[VARYING_SLOT_COL0][1] = 0.0F;
@@ -662,7 +667,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
# endif
}
else {
- ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+ assert(ctx->Light.ShadeModel == GL_FLAT);
rLeft = ChanToFixed(v2->color[RCOMP]);
gLeft = ChanToFixed(v2->color[GCOMP]);
bLeft = ChanToFixed(v2->color[BCOMP]);
diff --git a/mesalib/src/mesa/swrast/s_zoom.c b/mesalib/src/mesa/swrast/s_zoom.c
index 352c61ad2..ab22652c7 100644
--- a/mesalib/src/mesa/swrast/s_zoom.c
+++ b/mesalib/src/mesa/swrast/s_zoom.c
@@ -53,8 +53,8 @@ compute_zoomed_bounds(struct gl_context *ctx, GLint imageX, GLint imageY,
const struct gl_framebuffer *fb = ctx->DrawBuffer;
GLint c0, c1, r0, r1;
- ASSERT(spanX >= imageX);
- ASSERT(spanY >= imageY);
+ assert(spanX >= imageX);
+ assert(spanY >= imageY);
/*
* Compute destination columns: [c0, c1)
@@ -149,12 +149,12 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
}
zoomedWidth = x1 - x0;
- ASSERT(zoomedWidth > 0);
- ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
+ assert(zoomedWidth > 0);
+ assert(zoomedWidth <= SWRAST_MAX_WIDTH);
/* no pixel arrays! must be horizontal spans. */
- ASSERT((span->arrayMask & SPAN_XY) == 0);
- ASSERT(span->primitive == GL_BITMAP);
+ assert((span->arrayMask & SPAN_XY) == 0);
+ assert(span->primitive == GL_BITMAP);
INIT_SPAN(zoomed, GL_BITMAP);
zoomed.x = x0;
@@ -184,7 +184,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
zoomed.interpMask = span->interpMask & ~SPAN_RGBA;
zoomed.arrayMask |= SPAN_RGBA;
zoomed.arrayAttribs |= VARYING_BIT_COL0; /* we'll produce these values */
- ASSERT(span->arrayMask & SPAN_RGBA);
+ assert(span->arrayMask & SPAN_RGBA);
}
else if (format == GL_DEPTH_COMPONENT) {
/* Copy color info */
@@ -199,7 +199,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
/* we'll generate an array of depth values */
zoomed.interpMask = span->interpMask & ~SPAN_Z;
zoomed.arrayMask |= SPAN_Z;
- ASSERT(span->arrayMask & SPAN_Z);
+ assert(span->arrayMask & SPAN_Z);
}
else {
_mesa_problem(ctx, "Bad format in zoom_span");
@@ -213,8 +213,8 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint i;
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
- ASSERT(j >= 0);
- ASSERT(j < (GLint) span->end);
+ assert(j >= 0);
+ assert(j < (GLint) span->end);
COPY_4UBV(zoomed.array->rgba8[i], rgba[j]);
}
}
@@ -223,8 +223,8 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint i;
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
- ASSERT(j >= 0);
- ASSERT(j < (GLint) span->end);
+ assert(j >= 0);
+ assert(j < (GLint) span->end);
COPY_4V(zoomed.array->rgba16[i], rgba[j]);
}
}
@@ -233,8 +233,8 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint i;
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
- ASSERT(j >= 0);
- ASSERT(j < (GLint) span->end);
+ assert(j >= 0);
+ assert(j < (GLint) span->end);
COPY_4V(zoomed.array->attribs[VARYING_SLOT_COL0][i], rgba[j]);
}
}
@@ -245,8 +245,8 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint i;
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
- ASSERT(j >= 0);
- ASSERT(j < (GLint) span->end);
+ assert(j >= 0);
+ assert(j < (GLint) span->end);
zoomed.array->rgba8[i][0] = rgb[j][0];
zoomed.array->rgba8[i][1] = rgb[j][1];
zoomed.array->rgba8[i][2] = rgb[j][2];
@@ -258,8 +258,8 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint i;
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
- ASSERT(j >= 0);
- ASSERT(j < (GLint) span->end);
+ assert(j >= 0);
+ assert(j < (GLint) span->end);
zoomed.array->rgba16[i][0] = rgb[j][0];
zoomed.array->rgba16[i][1] = rgb[j][1];
zoomed.array->rgba16[i][2] = rgb[j][2];
@@ -271,8 +271,8 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint i;
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
- ASSERT(j >= 0);
- ASSERT(j < (GLint) span->end);
+ assert(j >= 0);
+ assert(j < (GLint) span->end);
zoomed.array->attribs[VARYING_SLOT_COL0][i][0] = rgb[j][0];
zoomed.array->attribs[VARYING_SLOT_COL0][i][1] = rgb[j][1];
zoomed.array->attribs[VARYING_SLOT_COL0][i][2] = rgb[j][2];
@@ -285,8 +285,8 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint i;
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
- ASSERT(j >= 0);
- ASSERT(j < (GLint) span->end);
+ assert(j >= 0);
+ assert(j < (GLint) span->end);
zoomed.array->z[i] = zValues[j];
}
/* Now, fall into the RGB path below */
@@ -372,8 +372,8 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY
}
zoomedWidth = x1 - x0;
- ASSERT(zoomedWidth > 0);
- ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
+ assert(zoomedWidth > 0);
+ assert(zoomedWidth <= SWRAST_MAX_WIDTH);
zoomedVals = malloc(zoomedWidth * sizeof(GLubyte));
if (!zoomedVals)
@@ -382,8 +382,8 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY
/* zoom the span horizontally */
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX;
- ASSERT(j >= 0);
- ASSERT(j < width);
+ assert(j >= 0);
+ assert(j < width);
zoomedVals[i] = stencil[j];
}
@@ -417,8 +417,8 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY,
}
zoomedWidth = x1 - x0;
- ASSERT(zoomedWidth > 0);
- ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
+ assert(zoomedWidth > 0);
+ assert(zoomedWidth <= SWRAST_MAX_WIDTH);
zoomedVals = malloc(zoomedWidth * sizeof(GLuint));
if (!zoomedVals)
@@ -427,8 +427,8 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY,
/* zoom the span horizontally */
for (i = 0; i < zoomedWidth; i++) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX;
- ASSERT(j >= 0);
- ASSERT(j < width);
+ assert(j >= 0);
+ assert(j < width);
zoomedVals[i] = zVals[j];
}