#include "arbparse.h"
#include "arbfragparse.h"
-static void
-debug_fp_inst(GLint num, struct fp_instruction *fp)
+void
+_mesa_debug_fp_inst(GLint num, struct fp_instruction *fp)
{
GLint a;
}
#if DEBUG_FP
- debug_fp_inst(ap.Base.NumInstructions, ap.FPInstructions);
-#else
- (void) debug_fp_inst;
+ _mesa_debug_fp_inst(ap.Base.NumInstructions, ap.FPInstructions);
#endif
program->Instructions = ap.FPInstructions;
const GLubyte * str, GLsizei len,
struct fragment_program *program);
+extern void
+_mesa_debug_fp_inst(GLint num, struct fp_instruction *fp);
+
+
#endif
else
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
- if ((ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
- || ctx->Fog.ColorSumEnabled)
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
- else
- ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
-
break;
case GL_LINE_SMOOTH:
if (ctx->Line.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.ColorSumEnabled = state;
-
- if ((ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
- || ctx->Fog.ColorSumEnabled)
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
- else
- ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
-
break;
/* GL_ARB_multisample */
CHECK_EXTENSION(NV_vertex_program, cap);
if (ctx->VertexProgram.Enabled == state)
return;
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ctx->VertexProgram.Enabled = state;
break;
case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
CHECK_EXTENSION(NV_vertex_program, cap);
if (ctx->VertexProgram.PointSizeEnabled == state)
return;
- FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ctx->VertexProgram.PointSizeEnabled = state;
break;
case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
CHECK_EXTENSION(NV_vertex_program, cap);
if (ctx->VertexProgram.TwoSideEnabled == state)
return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ctx->VertexProgram.TwoSideEnabled = state;
break;
case GL_MAP1_VERTEX_ATTRIB0_4_NV:
CHECK_EXTENSION(NV_fragment_program, cap);
if (ctx->FragmentProgram.Enabled == state)
return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ctx->FragmentProgram.Enabled = state;
break;
#endif /* FEATURE_NV_fragment_program */
CHECK_EXTENSION(ARB_fragment_program, cap);
if (ctx->FragmentProgram.Enabled == state)
return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ctx->FragmentProgram.Enabled = state;
break;
#endif /* FEATURE_ARB_fragment_program */
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Model.ColorControl = newenum;
-
- if ((ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
- || ctx->Fog.ColorSumEnabled)
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
- else
- ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
-
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
*/
/*@{*/
#define _DD_NEW_FLATSHADE _NEW_LIGHT
-#define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG)
+#define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG | _NEW_PROGRAM)
#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
#define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT
#define _DD_NEW_TRI_UNFILLED _NEW_POLYGON
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- /* texture state is dependent on current fragment and vertex programs */
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if ((target == GL_VERTEX_PROGRAM_NV
&& ctx->Extensions.NV_vertex_program) ||
/*@{*/
-/*
- * Update items which depend on vertex/fragment programs.
- */
static void
-update_program( GLcontext *ctx )
+update_separate_specular( GLcontext *ctx )
{
- if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) {
- if (ctx->FragmentProgram.Current->InputsRead & (1 << FRAG_ATTRIB_COL1))
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
- }
+ if (NEED_SECONDARY_COLOR(ctx))
+ ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
+ else
+ ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
}
*/
void _mesa_update_state( GLcontext *ctx )
{
- const GLuint new_state = ctx->NewState;
+ GLuint new_state = ctx->NewState;
if (MESA_VERBOSE & VERBOSE_STATE)
_mesa_print_state("_mesa_update_state", new_state);
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
_mesa_update_modelview_project( ctx, new_state );
- if (new_state & (_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
+ if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
_mesa_update_texture( ctx, new_state );
if (new_state & (_NEW_SCISSOR|_NEW_BUFFERS))
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_pixel( ctx, new_state );
- if (new_state & _NEW_PROGRAM)
- update_program( ctx );
+ if (new_state & _DD_NEW_SEPARATE_SPECULAR)
+ update_separate_specular( ctx );
- if (new_state & _NEW_ARRAY)
+ if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
update_arrays( ctx );
/* ctx->_NeedEyeCoords is now up to date.
* Set ctx->NewState to zero to avoid recursion if
* Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
*/
+ new_state = ctx->NewState;
ctx->NewState = 0;
ctx->Driver.UpdateState(ctx, new_state);
ctx->Array.NewState = 0;
{
GLuint unit;
+ ctx->NewState |= _NEW_TEXTURE; /* TODO: only set this if there are
+ * actual changes.
+ */
+
ctx->Texture._EnabledUnits = 0;
ctx->Texture._GenFlags = 0;
ctx->Texture._TexMatEnabled = 0;
if (new_state & _NEW_TEXTURE_MATRIX)
update_texture_matrices( ctx );
- if (new_state & _NEW_TEXTURE)
+ if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM))
update_texture_state( ctx );
}