From d970313b66b3aab3e3d12c65882febcc7c9091a8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Jul 2009 11:12:05 -0600 Subject: [PATCH] Fix state flag dependencies for fixed function fragment program updates. I started looking into why _NEW_ARRAY punishes us, and while annotating dependencies noticed that a bunch of dependencies were missing. (cherry picked from master, commit e5f63c403b767f9974e8eb5d412c012b8a69287f) --- src/mesa/main/state.c | 2 +- src/mesa/main/texenvprogram.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 94e37e3dab5..1d3758a302b 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -502,7 +502,7 @@ _mesa_update_state_locked( GLcontext *ctx ) /* Determine which state flags effect vertex/fragment program state */ if (ctx->FragmentProgram._MaintainTexEnvProgram) { prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR | - _NEW_ARRAY); + _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE); } if (ctx->VertexProgram._MaintainTnlProgram) { prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index b92ba2542d2..a3f1246c985 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -261,6 +261,7 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) */ static GLbitfield get_fp_input_mask( GLcontext *ctx ) { + /* _NEW_PROGRAM */ const GLboolean vertexShader = (ctx->Shader.CurrentProgram && ctx->Shader.CurrentProgram->VertexProgram); const GLboolean vertexProgram = ctx->VertexProgram._Enabled; @@ -274,22 +275,26 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) fp_inputs = ~0; } else if (ctx->RenderMode == GL_FEEDBACK) { + /* _NEW_RENDERMODE */ fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); } else if (!(vertexProgram || vertexShader) || !ctx->VertexProgram._Current) { /* Fixed function vertex logic */ + /* _NEW_ARRAY */ GLbitfield varying_inputs = ctx->varying_vp_inputs; /* These get generated in the setup routine regardless of the * vertex program: */ + /* _NEW_POINT */ if (ctx->Point.PointSprite) varying_inputs |= FRAG_BITS_TEX_ANY; /* First look at what values may be computed by the generated * vertex program: */ + /* _NEW_LIGHT */ if (ctx->Light.Enabled) { fp_inputs |= FRAG_BIT_COL0; @@ -297,6 +302,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) fp_inputs |= FRAG_BIT_COL1; } + /* _NEW_TEXTURE */ fp_inputs |= (ctx->Texture._TexGenEnabled | ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0; @@ -329,6 +335,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) /* These get generated in the setup routine regardless of the * vertex program: */ + /* _NEW_POINT */ if (ctx->Point.PointSprite) vp_outputs |= FRAG_BITS_TEX_ANY; @@ -355,6 +362,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) memset(key, 0, sizeof(*key)); + /* _NEW_TEXTURE */ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; GLenum format; @@ -408,11 +416,13 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) } } + /* _DD_NEW_SEPARATE_SPECULAR */ if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { key->separate_specular = 1; inputs_referenced |= FRAG_BIT_COL1; } + /* _NEW_FOG */ if (ctx->Fog.Enabled) { key->fog_enabled = 1; key->fog_mode = translate_fog_mode(ctx->Fog.Mode); -- 2.30.2