diff options
Diffstat (limited to 'mesalib/src/mesa/program/prog_statevars.c')
-rw-r--r-- | mesalib/src/mesa/program/prog_statevars.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c index 7f5daf8c6..57b25a7e3 100644 --- a/mesalib/src/mesa/program/prog_statevars.c +++ b/mesalib/src/mesa/program/prog_statevars.c @@ -29,6 +29,7 @@ */ +#include <stdio.h> #include "main/glheader.h" #include "main/context.h" #include "main/blend.h" @@ -41,6 +42,9 @@ #include "main/samplerobj.h" +#define ONE_DIV_SQRT_LN2 (1.201122408786449815) + + /** * Use the list of tokens in the state[] array to find global GL state * and return it in <value>. Usually, four values are returned in <value> @@ -58,9 +62,9 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], /* state[1] is either 0=front or 1=back side */ const GLuint face = (GLuint) state[1]; const struct gl_material *mat = &ctx->Light.Material; - ASSERT(face == 0 || face == 1); + assert(face == 0 || face == 1); /* we rely on tokens numbered so that _BACK_ == _FRONT_+ 1 */ - ASSERT(MAT_ATTRIB_FRONT_AMBIENT + 1 == MAT_ATTRIB_BACK_AMBIENT); + assert(MAT_ATTRIB_FRONT_AMBIENT + 1 == MAT_ATTRIB_BACK_AMBIENT); /* XXX we could get rid of this switch entirely with a little * work in arbprogparse.c's parse_state_single_item(). */ @@ -170,7 +174,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], const GLuint ln = (GLuint) state[1]; const GLuint face = (GLuint) state[2]; GLint i; - ASSERT(face == 0 || face == 1); + assert(face == 0 || face == 1); switch (state[3]) { case STATE_AMBIENT: for (i = 0; i < 3; i++) { @@ -295,8 +299,8 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], const gl_state_index modifier = state[4]; const GLfloat *m; GLuint row, i; - ASSERT(firstRow < 4); - ASSERT(lastRow < 4); + assert(firstRow < 4); + assert(lastRow < 4); if (mat == STATE_MODELVIEW_MATRIX) { matrix = ctx->ModelviewMatrixStack.Top; } @@ -307,11 +311,11 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], matrix = &ctx->_ModelProjectMatrix; } else if (mat == STATE_TEXTURE_MATRIX) { - ASSERT(index < Elements(ctx->TextureMatrixStack)); + assert(index < ARRAY_SIZE(ctx->TextureMatrixStack)); matrix = ctx->TextureMatrixStack[index].Top; } else if (mat == STATE_PROGRAM_MATRIX) { - ASSERT(index < Elements(ctx->ProgramMatrixStack)); + assert(index < ARRAY_SIZE(ctx->ProgramMatrixStack)); matrix = ctx->ProgramMatrixStack[index].Top; } else { |