summaryrefslogtreecommitdiffstats
path: root/src/mesa/program/arbprogparse.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-04-15 19:04:57 -0700
committerIan Romanick <[email protected]>2011-04-21 17:33:29 -0700
commit4d203a01e20dedcfaab09c18922e8ed9dcb39729 (patch)
treedc971f5c91cbca5f7d4f7a6c071baf498db243cc /src/mesa/program/arbprogparse.c
parentdf7555e763b9a4d989788e9b1cd25e8740649e79 (diff)
mesa: Kill gl_fragment_program::FogOption with fire
All drivers expect this to always be GL_NONE. Don't let there be any opportunity for a bad value to leak out and infect some unsuspecting driver. If any driver for hardware that had fixed-function per-fragment fog (i915 and perhaps some r300-ish) was ever going to add support, it would have done it by now. Reviewed-by: Eric Anholt <[email protected]> Acked-by: Corbin Simpson <[email protected]> Acked-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/mesa/program/arbprogparse.c')
-rw-r--r--src/mesa/program/arbprogparse.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
index 7f778c3c381..dffc8abf735 100644
--- a/src/mesa/program/arbprogparse.c
+++ b/src/mesa/program/arbprogparse.c
@@ -116,20 +116,11 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
program->Base.SamplersUsed |= (1 << i);
}
program->Base.ShadowSamplers = prog.ShadowSamplers;
- switch (state.option.Fog) {
- case OPTION_FOG_EXP: program->FogOption = GL_EXP; break;
- case OPTION_FOG_EXP2: program->FogOption = GL_EXP2; break;
- case OPTION_FOG_LINEAR: program->FogOption = GL_LINEAR; break;
- default: program->FogOption = GL_NONE; break;
- }
program->OriginUpperLeft = state.option.OriginUpperLeft;
program->PixelCenterInteger = state.option.PixelCenterInteger;
program->UsesKill = state.fragment.UsesKill;
- if (program->FogOption)
- program->Base.InputsRead |= FRAG_BIT_FOGC;
-
if (program->Base.Instructions)
free(program->Base.Instructions);
program->Base.Instructions = prog.Instructions;
@@ -143,12 +134,15 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
* there's no hardware that wants to do fog in a discrete stage separate
* from the fragment shader.
*/
- if (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, GL_TRUE);
- program->FogOption = GL_NONE;
+ _mesa_append_fog_code(ctx, program, fog_modes[state.option.Fog], GL_TRUE);
}
#if DEBUG_FP