* Also, precompute some lighting values such as the products of light
* source and material ambient, diffuse and specular coefficients.
*/
-void
+GLbitfield
_mesa_update_lighting( struct gl_context *ctx )
{
GLbitfield flags = 0;
+ bool old_need_eye_coords = ctx->Light._NeedEyeCoords;
ctx->Light._NeedEyeCoords = GL_FALSE;
- if (!ctx->Light.Enabled)
- return;
+ if (!ctx->Light.Enabled) {
+ return old_need_eye_coords != ctx->Light._NeedEyeCoords ?
+ _NEW_TNL_SPACES : 0;
+ }
GLbitfield mask = ctx->Light._EnabledLights;
while (mask) {
*/
if (ctx->Light._NeedVertices)
ctx->Light._NeedEyeCoords = GL_TRUE;
+
+ return old_need_eye_coords != ctx->Light._NeedEyeCoords ?
+ _NEW_TNL_SPACES : 0;
}
void
_mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag )
{
ctx->_ForceEyeCoords = !flag;
- ctx->NewState |= _NEW_POINT; /* for _mesa_update_tnl_spaces */
+ ctx->NewState |= _NEW_TNL_SPACES;
}
GLuint legal,
const char * );
-extern void _mesa_update_lighting( struct gl_context *ctx );
+extern GLbitfield _mesa_update_lighting( struct gl_context *ctx );
extern void _mesa_update_light_materials(struct gl_context *ctx);
extern bool _mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state );
#define _NEW_TEXTURE_MATRIX (1u << 2) /**< gl_context::TextureMatrix */
#define _NEW_COLOR (1u << 3) /**< gl_context::Color */
#define _NEW_DEPTH (1u << 4) /**< gl_context::Depth */
-/* gap */
+#define _NEW_TNL_SPACES (1u << 5) /**< _mesa_update_tnl_spaces */
#define _NEW_FOG (1u << 6) /**< gl_context::Fog */
#define _NEW_HINT (1u << 7) /**< gl_context::Hint */
#define _NEW_LIGHT_CONSTANTS (1u << 8) /**< gl_context::Light */
case GL_DISTANCE_ATTENUATION_EXT:
if (TEST_EQ_3V(ctx->Point.Params, params))
return;
- FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_FF_VERT_PROGRAM, GL_POINT_BIT);
+ FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_FF_VERT_PROGRAM |
+ _NEW_TNL_SPACES, GL_POINT_BIT);
COPY_3V(ctx->Point.Params, params);
ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0F ||
ctx->Point.Params[1] != 0.0F ||
new_state |= _mesa_update_texture_state(ctx);
if (new_state & _NEW_LIGHT_CONSTANTS)
- _mesa_update_lighting(ctx);
+ new_state |= _mesa_update_lighting(ctx);
/* ctx->_NeedEyeCoords is determined here.
*
* If the lighting space hasn't changed, may still need to recompute
* light positions & normal transforms for other reasons.
*/
- if (new_state & (_NEW_LIGHT_CONSTANTS | _NEW_TEXTURE_STATE |
- _NEW_POINT | _NEW_MODELVIEW)) {
+ if (new_state & (_NEW_TNL_SPACES | _NEW_LIGHT_CONSTANTS |
+ _NEW_MODELVIEW)) {
if (_mesa_update_tnl_spaces(ctx, new_state))
new_state |= _NEW_FF_VERT_PROGRAM;
}
/* TODO: only set this if there are actual changes */
ctx->NewState |= _NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE;
+ GLbitfield old_genflags = ctx->Texture._GenFlags;
GLbitfield old_enabled_coord_units = ctx->Texture._EnabledCoordUnits;
GLbitfield old_texgen_enabled = ctx->Texture._TexGenEnabled;
GLbitfield old_texmat_enabled = ctx->Texture._TexMatEnabled;
new_state |= _NEW_FF_VERT_PROGRAM | _NEW_FF_FRAG_PROGRAM;
}
+ if (old_genflags != ctx->Texture._GenFlags)
+ new_state |= _NEW_TNL_SPACES;
+
return new_state;
}