- if (program->FogOption != GL_NONE) {
- _mesa_append_fog_code(ctx, program);
- program->FogOption = GL_NONE;
+ if (state.option.Fog != OPTION_NONE) {
+ static const GLenum fog_modes[4] = {
+ GL_NONE, GL_EXP, GL_EXP2, GL_LINEAR
+ };
+
+ /* XXX: we should somehow recompile this to remove clamping if disabled
+ * On the ATI driver, this is unclampled if fragment clamping is disabled
+ */
+ _mesa_append_fog_code(ctx, program, fog_modes[state.option.Fog], GL_TRUE);