-/* $Id: state.c,v 1.17 2000/06/23 20:28:30 brianp Exp $ */
+/* $Id: state.c,v 1.37 2000/10/30 13:32:01 keithw Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
#include "clip.h"
#include "colortab.h"
#include "context.h"
+#include "convolve.h"
#include "copypix.h"
#include "cva.h"
#include "depth.h"
exec->FeedbackBuffer = _mesa_FeedbackBuffer;
exec->Finish = _mesa_Finish;
exec->Flush = _mesa_Flush;
+
+ exec->FogCoordfEXT = _mesa_FogCoordfEXT;
+ exec->FogCoordfvEXT = _mesa_FogCoordfvEXT;
+ exec->FogCoorddEXT = _mesa_FogCoorddEXT;
+ exec->FogCoorddvEXT = _mesa_FogCoorddvEXT;
+ exec->FogCoordPointerEXT = _mesa_FogCoordPointerEXT;
+
exec->Fogf = _mesa_Fogf;
exec->Fogfv = _mesa_Fogfv;
exec->Fogi = _mesa_Fogi;
exec->Scaled = _mesa_Scaled;
exec->Scalef = _mesa_Scalef;
exec->Scissor = _mesa_Scissor;
+ exec->SecondaryColor3bEXT = _mesa_SecondaryColor3bEXT;
+ exec->SecondaryColor3bvEXT = _mesa_SecondaryColor3bvEXT;
+ exec->SecondaryColor3sEXT = _mesa_SecondaryColor3sEXT;
+ exec->SecondaryColor3svEXT = _mesa_SecondaryColor3svEXT;
+ exec->SecondaryColor3iEXT = _mesa_SecondaryColor3iEXT;
+ exec->SecondaryColor3ivEXT = _mesa_SecondaryColor3ivEXT;
+ exec->SecondaryColor3fEXT = _mesa_SecondaryColor3fEXT;
+ exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3fvEXT;
+ exec->SecondaryColor3dEXT = _mesa_SecondaryColor3dEXT;
+ exec->SecondaryColor3dvEXT = _mesa_SecondaryColor3dvEXT;
+ exec->SecondaryColor3ubEXT = _mesa_SecondaryColor3ubEXT;
+ exec->SecondaryColor3ubvEXT = _mesa_SecondaryColor3ubvEXT;
+ exec->SecondaryColor3usEXT = _mesa_SecondaryColor3usEXT;
+ exec->SecondaryColor3usvEXT = _mesa_SecondaryColor3usvEXT;
+ exec->SecondaryColor3uiEXT = _mesa_SecondaryColor3uiEXT;
+ exec->SecondaryColor3uivEXT = _mesa_SecondaryColor3uivEXT;
+ exec->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
exec->SelectBuffer = _mesa_SelectBuffer;
exec->ShadeModel = _mesa_ShadeModel;
exec->StencilFunc = _mesa_StencilFunc;
/**********************************************************************/
-/*
- * Since the device driver may or may not support pixel logic ops we
- * have to make some extensive tests to determine whether or not
- * software-implemented logic operations have to be used.
- */
-static void update_pixel_logic( GLcontext *ctx )
-{
- if (ctx->Visual->RGBAflag) {
- /* RGBA mode blending w/ Logic Op */
- if (ctx->Color.ColorLogicOpEnabled) {
- if (ctx->Driver.LogicOp
- && (*ctx->Driver.LogicOp)( ctx, ctx->Color.LogicOp )) {
- /* Device driver can do logic, don't have to do it in software */
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
- }
- else {
- /* Device driver can't do logic op so we do it in software */
- ctx->Color.SWLogicOpEnabled = GL_TRUE;
- }
- }
- else {
- /* no logic op */
- if (ctx->Driver.LogicOp) {
- (void) (*ctx->Driver.LogicOp)( ctx, GL_COPY );
- }
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
- }
- }
- else {
- /* CI mode Logic Op */
- if (ctx->Color.IndexLogicOpEnabled) {
- if (ctx->Driver.LogicOp
- && (*ctx->Driver.LogicOp)( ctx, ctx->Color.LogicOp )) {
- /* Device driver can do logic, don't have to do it in software */
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
- }
- else {
- /* Device driver can't do logic op so we do it in software */
- ctx->Color.SWLogicOpEnabled = GL_TRUE;
- }
- }
- else {
- /* no logic op */
- if (ctx->Driver.LogicOp) {
- (void) (*ctx->Driver.LogicOp)( ctx, GL_COPY );
- }
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
- }
- }
-}
-
-
-
-/*
- * Check if software implemented RGBA or Color Index masking is needed.
- */
-static void update_pixel_masking( GLcontext *ctx )
-{
- if (ctx->Visual->RGBAflag) {
- GLuint *colorMask = (GLuint *) ctx->Color.ColorMask;
- if (*colorMask == 0xffffffff) {
- /* disable masking */
- if (ctx->Driver.ColorMask) {
- (void) (*ctx->Driver.ColorMask)( ctx, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
- }
- ctx->Color.SWmasking = GL_FALSE;
- }
- else {
- /* Ask driver to do color masking, if it can't then
- * do it in software
- */
- GLboolean red = ctx->Color.ColorMask[RCOMP] ? GL_TRUE : GL_FALSE;
- GLboolean green = ctx->Color.ColorMask[GCOMP] ? GL_TRUE : GL_FALSE;
- GLboolean blue = ctx->Color.ColorMask[BCOMP] ? GL_TRUE : GL_FALSE;
- GLboolean alpha = ctx->Color.ColorMask[ACOMP] ? GL_TRUE : GL_FALSE;
- if (ctx->Driver.ColorMask
- && (*ctx->Driver.ColorMask)( ctx, red, green, blue, alpha )) {
- ctx->Color.SWmasking = GL_FALSE;
- }
- else {
- ctx->Color.SWmasking = GL_TRUE;
- }
- }
- }
- else {
- if (ctx->Color.IndexMask==0xffffffff) {
- /* disable masking */
- if (ctx->Driver.IndexMask) {
- (void) (*ctx->Driver.IndexMask)( ctx, 0xffffffff );
- }
- ctx->Color.SWmasking = GL_FALSE;
- }
- else {
- /* Ask driver to do index masking, if it can't then
- * do it in software
- */
- if (ctx->Driver.IndexMask
- && (*ctx->Driver.IndexMask)( ctx, ctx->Color.IndexMask )) {
- ctx->Color.SWmasking = GL_FALSE;
- }
- else {
- ctx->Color.SWmasking = GL_TRUE;
- }
- }
- }
-}
-
-
-static void update_fog_mode( GLcontext *ctx )
-{
- int old_mode = ctx->FogMode;
-
- if (ctx->Fog.Enabled) {
- if (ctx->Texture.Enabled)
- ctx->FogMode = FOG_FRAGMENT;
- else if (ctx->Hint.Fog == GL_NICEST)
- ctx->FogMode = FOG_FRAGMENT;
- else
- ctx->FogMode = FOG_VERTEX;
-
- if (ctx->Driver.GetParameteri)
- if ((ctx->Driver.GetParameteri)( ctx, DD_HAVE_HARDWARE_FOG ))
- ctx->FogMode = FOG_FRAGMENT;
- }
- else {
- ctx->FogMode = FOG_NONE;
- }
-
- if (old_mode != ctx->FogMode)
- ctx->NewState |= NEW_FOG;
-}
-
/*
* Recompute the value of ctx->RasterMask, etc. according to
{
ctx->RasterMask = 0;
- if (ctx->Color.AlphaEnabled) ctx->RasterMask |= ALPHATEST_BIT;
- if (ctx->Color.BlendEnabled) ctx->RasterMask |= BLEND_BIT;
- if (ctx->Depth.Test) ctx->RasterMask |= DEPTH_BIT;
- if (ctx->FogMode==FOG_FRAGMENT) ctx->RasterMask |= FOG_BIT;
- if (ctx->Color.SWLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT;
- if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT;
- if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT;
- if (ctx->Color.SWmasking) ctx->RasterMask |= MASKING_BIT;
- if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT;
+ if (ctx->Color.AlphaEnabled) ctx->RasterMask |= ALPHATEST_BIT;
+ if (ctx->Color.BlendEnabled) ctx->RasterMask |= BLEND_BIT;
+ if (ctx->Depth.Test) ctx->RasterMask |= DEPTH_BIT;
+ if (ctx->Fog.Enabled) ctx->RasterMask |= FOG_BIT;
+ if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT;
+ if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT;
+ if (ctx->Visual.RGBAflag) {
+ const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
+ if (colorMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT;
+ if (ctx->Color.ColorLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT;
+ if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT;
+ }
+ else {
+ if (ctx->Color.IndexMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT;
+ if (ctx->Color.IndexLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT;
+ }
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP]
&& ctx->Color.DrawBuffer != GL_NONE)
ctx->RasterMask |= ALPHABUF_BIT;
- if ( ctx->Viewport.X<0
+ if ( ctx->Viewport.X < 0
|| ctx->Viewport.X + ctx->Viewport.Width > ctx->DrawBuffer->Width
- || ctx->Viewport.Y<0
+ || ctx->Viewport.Y < 0
|| ctx->Viewport.Y + ctx->Viewport.Height > ctx->DrawBuffer->Height) {
ctx->RasterMask |= WINCLIP_BIT;
}
ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW;
}
- else if (ctx->Visual->RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) {
+ else if (ctx->Visual.RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) {
/* all RGBA channels disabled */
ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW;
- ctx->Color.DrawDestMask = 0;
}
- else if (!ctx->Visual->RGBAflag && ctx->Color.IndexMask==0) {
+ else if (!ctx->Visual.RGBAflag && ctx->Color.IndexMask==0) {
/* all color index bits disabled */
ctx->RasterMask |= MULTI_DRAW_BIT;
ctx->TriangleCaps |= DD_MULTIDRAW;
- ctx->Color.DrawDestMask = 0;
}
}
void gl_print_state( const char *msg, GLuint state )
{
fprintf(stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
msg,
state,
- (state & NEW_LIGHTING) ? "lighting, " : "",
- (state & NEW_RASTER_OPS) ? "raster-ops, " : "",
- (state & NEW_TEXTURING) ? "texturing, " : "",
- (state & NEW_POLYGON) ? "polygon, " : "",
- (state & NEW_DRVSTATE0) ? "driver-0, " : "",
- (state & NEW_DRVSTATE1) ? "driver-1, " : "",
- (state & NEW_DRVSTATE2) ? "driver-2, " : "",
- (state & NEW_DRVSTATE3) ? "driver-3, " : "",
- (state & NEW_MODELVIEW) ? "modelview, " : "",
- (state & NEW_PROJECTION) ? "projection, " : "",
- (state & NEW_TEXTURE_MATRIX) ? "texture-matrix, " : "",
- (state & NEW_USER_CLIP) ? "user-clip, " : "",
- (state & NEW_TEXTURE_ENV) ? "texture-env, " : "",
- (state & NEW_CLIENT_STATE) ? "client-state, " : "",
- (state & NEW_FOG) ? "fog, " : "",
- (state & NEW_NORMAL_TRANSFORM) ? "normal-transform, " : "",
- (state & NEW_VIEWPORT) ? "viewport, " : "",
- (state & NEW_TEXTURE_ENABLE) ? "texture-enable, " : "");
+ (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "",
+ (state & _NEW_PROJECTION) ? "ctx->Projection, " : "",
+ (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "",
+ (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "",
+ (state & _NEW_ACCUM) ? "ctx->Accum, " : "",
+ (state & _NEW_COLOR) ? "ctx->Color, " : "",
+ (state & _NEW_DEPTH) ? "ctx->Depth, " : "",
+ (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "",
+ (state & _NEW_FOG) ? "ctx->Fog, " : "",
+ (state & _NEW_HINT) ? "ctx->Hint, " : "",
+ (state & _NEW_IMAGING) ? "ctx->Histogram/MinMax/Convolve/Seperable, ": "",
+ (state & _NEW_LIGHT) ? "ctx->Light, " : "",
+ (state & _NEW_LINE) ? "ctx->Line, " : "",
+ (state & _NEW_FEEDBACK_SELECT) ? "ctx->Feedback/Select, " : "",
+ (state & _NEW_PIXEL) ? "ctx->Pixel, " : "",
+ (state & _NEW_POINT) ? "ctx->Point, " : "",
+ (state & _NEW_POLYGON) ? "ctx->Polygon, " : "",
+ (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "",
+ (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "",
+ (state & _NEW_TEXTURE) ? "ctx->Texture, " : "",
+ (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "",
+ (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "",
+ (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "",
+ (state & _NEW_ARRAY) ? "ctx->Array, " : "",
+ (state & _NEW_COLORTABLE) ? "ctx->{*}ColorTable, " : "",
+ (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "",
+ (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
}
if (MESA_VERBOSE & VERBOSE_STATE)
gl_print_state("", ctx->NewState);
- if (ctx->NewState & NEW_CLIENT_STATE)
+ if (ctx->NewState & _NEW_ARRAY)
gl_update_client_state( ctx );
- if ((ctx->NewState & NEW_TEXTURE_ENABLE) &&
- (ctx->Enabled & ENABLE_TEX_ANY) != ctx->Texture.Enabled)
- ctx->NewState |= NEW_TEXTURING | NEW_RASTER_OPS;
-
- if (ctx->NewState & NEW_TEXTURE_ENV) {
- if (ctx->Texture.Unit[0].EnvMode == ctx->Texture.Unit[0].LastEnvMode &&
- ctx->Texture.Unit[1].EnvMode == ctx->Texture.Unit[1].LastEnvMode)
- ctx->NewState &= ~NEW_TEXTURE_ENV;
- ctx->Texture.Unit[0].LastEnvMode = ctx->Texture.Unit[0].EnvMode;
- ctx->Texture.Unit[1].LastEnvMode = ctx->Texture.Unit[1].EnvMode;
- }
+ if (ctx->NewState & _NEW_TEXTURE_MATRIX) {
+ ctx->Enabled &= ~(ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | ENABLE_TEXMAT2);
- if (ctx->NewState & NEW_TEXTURE_MATRIX) {
- ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1);
-
- for (i=0; i < MAX_TEXTURE_UNITS; i++) {
+ for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
if (ctx->TextureMatrix[i].flags & MAT_DIRTY_ALL_OVER) {
gl_matrix_analyze( &ctx->TextureMatrix[i] );
ctx->TextureMatrix[i].flags &= ~MAT_DIRTY_DEPENDENTS;
}
}
- if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) {
+ if (ctx->NewState & _NEW_TEXTURE) {
+ ctx->Texture.MultiTextureEnabled = GL_FALSE;
ctx->Texture.NeedNormals = GL_FALSE;
gl_update_dirty_texobjs(ctx);
- ctx->Enabled &= ~(ENABLE_TEXGEN0 | ENABLE_TEXGEN1);
+ ctx->Enabled &= ~(ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | ENABLE_TEXGEN2);
ctx->Texture.ReallyEnabled = 0;
- for (i=0; i < MAX_TEXTURE_UNITS; i++) {
+ for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
if (ctx->Texture.Unit[i].Enabled) {
gl_update_texture_unit( ctx, &ctx->Texture.Unit[i] );
ctx->Texture.NeedEyeCoords = GL_TRUE;
}
}
+
+ if (i > 0 && ctx->Texture.Unit[i].ReallyEnabled) {
+ ctx->Texture.MultiTextureEnabled = GL_TRUE;
+ }
}
+ else {
+ ctx->Texture.Unit[i].ReallyEnabled = 0;
+ }
}
-
- ctx->Texture.Enabled = ctx->Enabled & ENABLE_TEX_ANY;
+ ctx->Enabled = (ctx->Enabled & ~ENABLE_TEX_ANY) | ctx->Texture.ReallyEnabled;
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
}
- if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG | NEW_TEXTURE_ENABLE)) {
- if (ctx->NewState & (NEW_RASTER_OPS | NEW_TEXTURE_ENABLE)) {
- update_pixel_logic(ctx);
- update_pixel_masking(ctx);
- update_fog_mode(ctx);
- update_rasterflags(ctx);
- if (ctx->Driver.Dither) {
- (*ctx->Driver.Dither)( ctx, ctx->Color.DitherFlag );
- }
-
- /* update scissor region */
- ctx->DrawBuffer->Xmin = 0;
- ctx->DrawBuffer->Ymin = 0;
- ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width-1;
- ctx->DrawBuffer->Ymax = ctx->DrawBuffer->Height-1;
- if (ctx->Scissor.Enabled) {
- if (ctx->Scissor.X > ctx->DrawBuffer->Xmin) {
- ctx->DrawBuffer->Xmin = ctx->Scissor.X;
- }
- if (ctx->Scissor.Y > ctx->DrawBuffer->Ymin) {
- ctx->DrawBuffer->Ymin = ctx->Scissor.Y;
- }
- if (ctx->Scissor.X + ctx->Scissor.Width - 1 < ctx->DrawBuffer->Xmax) {
- ctx->DrawBuffer->Xmax = ctx->Scissor.X + ctx->Scissor.Width - 1;
- }
- if (ctx->Scissor.Y + ctx->Scissor.Height - 1 < ctx->DrawBuffer->Ymax) {
- ctx->DrawBuffer->Ymax = ctx->Scissor.Y + ctx->Scissor.Height - 1;
- }
- }
+ if (ctx->NewState & _SWRAST_NEW_RASTERMASK)
+ update_rasterflags(ctx);
+
+ if (ctx->NewState & (_NEW_BUFFERS|_NEW_SCISSOR)) {
+ /* update scissor region */
+ ctx->DrawBuffer->Xmin = 0;
+ ctx->DrawBuffer->Ymin = 0;
+ ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width;
+ ctx->DrawBuffer->Ymax = ctx->DrawBuffer->Height;
+ if (ctx->Scissor.Enabled) {
+ if (ctx->Scissor.X > ctx->DrawBuffer->Xmin) {
+ ctx->DrawBuffer->Xmin = ctx->Scissor.X;
+ }
+ if (ctx->Scissor.Y > ctx->DrawBuffer->Ymin) {
+ ctx->DrawBuffer->Ymin = ctx->Scissor.Y;
+ }
+ if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->Xmax) {
+ ctx->DrawBuffer->Xmax = ctx->Scissor.X + ctx->Scissor.Width;
+ }
+ if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->Ymax) {
+ ctx->DrawBuffer->Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
+ }
}
+ }
- if (ctx->NewState & NEW_LIGHTING) {
- ctx->TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
- if (ctx->Light.Enabled) {
- if (ctx->Light.Model.TwoSide)
- ctx->TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
- gl_update_lighting(ctx);
- }
+ if (ctx->NewState & _NEW_LIGHT) {
+ ctx->TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
+ if (ctx->Light.Enabled) {
+ if (ctx->Light.Model.TwoSide)
+ ctx->TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
+ gl_update_lighting(ctx);
}
}
- if (ctx->NewState & (NEW_POLYGON | NEW_LIGHTING)) {
+ if (ctx->NewState & (_NEW_POLYGON | _NEW_LIGHT)) {
ctx->TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK;
- if (ctx->NewState & NEW_POLYGON) {
+ if (ctx->NewState & _NEW_POLYGON) {
/* Setup CullBits bitmask */
if (ctx->Polygon.CullFlag) {
ctx->backface_sign = 1;
ctx->Polygon.OffsetLine ||
ctx->Polygon.OffsetFill)
ctx->TriangleCaps |= DD_TRI_OFFSET;
-
- /* reset Z offsets now */
- ctx->PointZoffset = 0.0;
- ctx->LineZoffset = 0.0;
- ctx->PolygonZoffset = 0.0;
}
}
- if (ctx->NewState & ~(NEW_CLIENT_STATE|
- NEW_DRIVER_STATE|NEW_USER_CLIP|
- NEW_POLYGON))
+ if (ctx->NewState & (_NEW_LIGHT|
+ _NEW_TEXTURE|
+ _NEW_FOG|
+ _NEW_POLYGON))
gl_update_clipmask(ctx);
- if (ctx->NewState & (NEW_LIGHTING|
- NEW_RASTER_OPS|
- NEW_TEXTURING|
- NEW_TEXTURE_ENABLE|
- NEW_TEXTURE_ENV|
- NEW_POLYGON|
- NEW_DRVSTATE0|
- NEW_DRVSTATE1|
- NEW_DRVSTATE2|
- NEW_DRVSTATE3|
- NEW_USER_CLIP))
+ if (ctx->NewState & ctx->Driver.UpdateStateNotify)
{
ctx->IndirectTriangles = ctx->TriangleCaps & ~ctx->Driver.TriangleCaps;
ctx->IndirectTriangles |= DD_SW_RASTERIZE;
/* Should only be calc'd when !need_eye_coords and not culling.
*/
- if (ctx->NewState & (NEW_MODELVIEW|NEW_PROJECTION)) {
- if (ctx->NewState & NEW_MODELVIEW) {
+ if (ctx->NewState & (_NEW_MODELVIEW|_NEW_PROJECTION)) {
+ if (ctx->NewState & _NEW_MODELVIEW) {
gl_matrix_analyze( &ctx->ModelView );
ctx->ProjectionMatrix.flags &= ~MAT_DIRTY_DEPENDENTS;
}
- if (ctx->NewState & NEW_PROJECTION) {
+ if (ctx->NewState & _NEW_PROJECTION) {
gl_matrix_analyze( &ctx->ProjectionMatrix );
ctx->ProjectionMatrix.flags &= ~MAT_DIRTY_DEPENDENTS;
}
gl_calculate_model_project_matrix( ctx );
- ctx->ModelProjectWinMatrixUptodate = 0;
}
- if (ctx->NewState & NEW_COLOR_MATRIX) {
+ if (ctx->NewState & _NEW_COLOR_MATRIX) {
gl_matrix_analyze( &ctx->ColorMatrix );
}
* can, find the current positions of the lights in object space
*/
if ((ctx->Enabled & (ENABLE_POINT_ATTEN | ENABLE_LIGHT | ENABLE_FOG |
- ENABLE_TEXGEN0 | ENABLE_TEXGEN1)) &&
- (ctx->NewState & (NEW_LIGHTING |
- NEW_FOG |
- NEW_MODELVIEW |
- NEW_PROJECTION |
- NEW_TEXTURING |
- NEW_RASTER_OPS |
- NEW_USER_CLIP)))
+ ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | ENABLE_TEXGEN2)) &&
+ (ctx->NewState & (_NEW_LIGHT |
+ _NEW_TEXTURE |
+ _NEW_FOG |
+ _NEW_TRANSFORM |
+ _NEW_MODELVIEW |
+ _NEW_PROJECTION |
+ _NEW_POINT |
+ _NEW_RENDERMODE |
+ _NEW_TRANSFORM)))
{
GLboolean oldcoord, oldnorm;
oldnorm = ctx->NeedEyeNormals;
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
- ctx->NeedEyeCoords = ((ctx->Fog.Enabled && ctx->Hint.Fog != GL_NICEST) ||
- ctx->Point.Attenuated);
+ ctx->NeedEyeCoords = (ctx->Fog.Enabled || ctx->Point.Attenuated);
ctx->NeedEyeNormals = GL_FALSE;
if (ctx->Light.Enabled) {
- if (ctx->Light.Flags & LIGHT_POSITIONAL) {
- /* Need length for attenuation */
- if (!TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_LENGTH_PRESERVING))
- ctx->NeedEyeCoords = GL_TRUE;
- } else if (ctx->Light.NeedVertices) {
- /* Need angle for spot calculations */
- if (!TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_ANGLE_PRESERVING))
- ctx->NeedEyeCoords = GL_TRUE;
+ if ((ctx->Light.Flags & LIGHT_POSITIONAL) ||
+ ctx->Light.NeedVertices ||
+ !TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_LENGTH_PRESERVING)) {
+ /* Need length for attenuation or need angle for spotlights
+ * or non-uniform scale matrix
+ */
+ ctx->NeedEyeCoords = GL_TRUE;
}
ctx->NeedEyeNormals = ctx->NeedEyeCoords;
}
- if (ctx->Texture.Enabled || ctx->RenderMode==GL_FEEDBACK) {
+ if (ctx->Texture.ReallyEnabled || ctx->RenderMode==GL_FEEDBACK) {
if (ctx->Texture.NeedEyeCoords) ctx->NeedEyeCoords = GL_TRUE;
if (ctx->Texture.NeedNormals)
ctx->NeedNormals = ctx->NeedEyeNormals = GL_TRUE;
if (ctx->Light.Enabled) {
gl_update_lighting_function(ctx);
- if ( (ctx->NewState & NEW_LIGHTING) ||
- ((ctx->NewState & (NEW_MODELVIEW| NEW_PROJECTION)) &&
+ if ( (ctx->NewState & _NEW_LIGHT) ||
+ ((ctx->NewState & (_NEW_MODELVIEW|_NEW_PROJECTION)) &&
!ctx->NeedEyeCoords) ||
oldcoord != ctx->NeedEyeCoords ||
oldnorm != ctx->NeedEyeNormals) {
}
ctx->rescale_factor = 1.0F;
-
if (ctx->ModelView.flags & (MAT_FLAG_UNIFORM_SCALE |
MAT_FLAG_GENERAL_SCALE |
MAT_FLAG_GENERAL_3D |
- MAT_FLAG_GENERAL) )
-
- {
- GLfloat *m = ctx->ModelView.inv;
- GLfloat f = m[2]*m[2] + m[6]*m[6] + m[10]*m[10];
- if (f > 1e-12 && (f-1)*(f-1) > 1e-12)
- ctx->rescale_factor = 1.0/GL_SQRT(f);
+ MAT_FLAG_GENERAL) ) {
+ const GLfloat *m = ctx->ModelView.inv;
+ const GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10];
+ if (f > 1e-12 && (f - 1.0) * (f - 1.0) > 1e-12)
+ ctx->rescale_factor = 1.0 / GL_SQRT(f);
}
}
gl_update_pipelines(ctx);
ctx->NewState = 0;
}
+
+
+
+
+/*
+ * Return a bitmask of IMAGE_*_BIT flags which to indicate which
+ * pixel transfer operations are enabled.
+ */
+void
+_mesa_update_image_transfer_state(GLcontext *ctx)
+{
+ GLuint mask = 0;
+
+ if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F ||
+ ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
+ ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F ||
+ ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
+ mask |= IMAGE_SCALE_BIAS_BIT;
+
+ if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
+ mask |= IMAGE_SHIFT_OFFSET_BIT;
+
+ if (ctx->Pixel.MapColorFlag)
+ mask |= IMAGE_MAP_COLOR_BIT;
+
+ if (ctx->Pixel.ColorTableEnabled)
+ mask |= IMAGE_COLOR_TABLE_BIT;
+
+ if (ctx->Pixel.Convolution1DEnabled ||
+ ctx->Pixel.Convolution2DEnabled ||
+ ctx->Pixel.Separable2DEnabled)
+ mask |= IMAGE_CONVOLUTION_BIT;
+
+ if (ctx->Pixel.PostConvolutionColorTableEnabled)
+ mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
+
+ if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
+ ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[0] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[1] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[2] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[3] != 0.0F)
+ mask |= IMAGE_COLOR_MATRIX_BIT;
+
+ if (ctx->Pixel.PostColorMatrixColorTableEnabled)
+ mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
+
+ if (ctx->Pixel.HistogramEnabled)
+ mask |= IMAGE_HISTOGRAM_BIT;
+
+ if (ctx->Pixel.MinMaxEnabled)
+ mask |= IMAGE_MIN_MAX_BIT;
+
+ ctx->ImageTransferState = mask;
+}