*/
+#include <stdio.h>
#include "main/glheader.h"
#include "main/context.h"
#include "main/blend.h"
#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>
/* 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().
*/
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++) {
{
/* state[1] is the texture unit */
const GLuint unit = (GLuint) state[1];
- if (_mesa_get_clamp_fragment_color(ctx))
+ if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
COPY_4V(value, ctx->Texture.Unit[unit].EnvColor);
else
COPY_4V(value, ctx->Texture.Unit[unit].EnvColorUnclamped);
}
return;
case STATE_FOG_COLOR:
- if (_mesa_get_clamp_fragment_color(ctx))
+ if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
COPY_4V(value, ctx->Fog.Color);
else
COPY_4V(value, ctx->Fog.ColorUnclamped);
const gl_state_index modifier = state[4];
const GLfloat *m;
GLuint row, i;
- ASSERT(firstRow >= 0);
- ASSERT(firstRow < 4);
- ASSERT(lastRow >= 0);
- ASSERT(lastRow < 4);
+ assert(firstRow < 4);
+ assert(lastRow < 4);
if (mat == STATE_MODELVIEW_MATRIX) {
matrix = ctx->ModelviewMatrixStack.Top;
}
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 {
* single MAD.
* linear: fogcoord * -1/(end-start) + end/(end-start)
* exp: 2^-(density/ln(2) * fogcoord)
- * exp2: 2^-((density/(ln(2)^2) * fogcoord)^2)
+ * exp2: 2^-((density/(sqrt(ln(2))) * fogcoord)^2)
*/
value[0] = (ctx->Fog.End == ctx->Fog.Start)
? 1.0f : (GLfloat)(-1.0F / (ctx->Fog.End - ctx->Fog.Start));
}
return;
- case STATE_ROT_MATRIX_0:
- {
- const int unit = (int) state[2];
- GLfloat *rotMat22 = ctx->Texture.Unit[unit].RotMatrix;
- value[0] = rotMat22[0];
- value[1] = rotMat22[2];
- value[2] = 0.0;
- value[3] = 0.0;
- }
- return;
-
- case STATE_ROT_MATRIX_1:
- {
- const int unit = (int) state[2];
- GLfloat *rotMat22 = ctx->Texture.Unit[unit].RotMatrix;
- value[0] = rotMat22[1];
- value[1] = rotMat22[3];
- value[2] = 0.0;
- value[3] = 0.0;
- }
- return;
-
/* XXX: make sure new tokens added here are also handled in the
* _mesa_program_state_flags() switch, below.
*/
return _NEW_MODELVIEW;
case STATE_TEXRECT_SCALE:
- case STATE_ROT_MATRIX_0:
- case STATE_ROT_MATRIX_1:
return _NEW_TEXTURE;
case STATE_FOG_PARAMS_OPTIMIZED:
return _NEW_FOG;
case STATE_FB_WPOS_Y_TRANSFORM:
append(dst, "FbWposYTransform");
break;
- case STATE_ROT_MATRIX_0:
- append(dst, "rotMatrixRow0");
- break;
- case STATE_ROT_MATRIX_1:
- append(dst, "rotMatrixRow1");
- break;
default:
/* probably STATE_INTERNAL_DRIVER+i (driver private state) */
append(dst, "driverState");
break;
}
- return _mesa_strdup(str);
+ return strdup(str);
}