Henri Verbeet wrote:
This fixes fogging for fragment programs with fog a fog option set.


------------------------------------------------------------------------

From 533e782dee9ed569eb35456b583a5740c3082afe Mon Sep 17 00:00:00 2001
From: Henri Verbeet <[EMAIL PROTECTED]>
Date: Sun, 5 Oct 2008 14:39:57 +0200
Subject: swrast: Fog coords should also be read when the fog option is active 
in a fragment program.

---
 src/mesa/swrast/s_context.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 62857dd..48fc363 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -578,12 +578,12 @@ _swrast_update_active_attribs(GLcontext *ctx)
          attribsMask |= FRAG_BIT_COL1;
       }
- if (swrast->_FogEnabled)
-         attribsMask |= FRAG_BIT_FOGC;
-
       attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0);
    }
+ if (swrast->_FogEnabled)
+      attribsMask |= FRAG_BIT_FOGC;
+
    swrast->_ActiveAttribMask = attribsMask;
/* Update _ActiveAttribs[] list */


I think the other way to fix this is to set FRAG_BIT_FOGC in the fragment program's InputsUsed if FogOption!=GL_NONE. I think other drivers would expect that too.

Can you try the attached patch?

-Brian



diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 8ce5348..39988b5 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -3863,6 +3863,9 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
    program->FogOption          = ap.FogOption;
    program->UsesKill          = ap.UsesKill;
 
+   if (program->FogOption)
+      program->Base.InputsRead |= FRAG_BIT_FOGC;
+      
    if (program->Base.Instructions)
       _mesa_free(program->Base.Instructions);
    program->Base.Instructions = ap.Base.Instructions;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to