Mesa (mesa_7_5_branch): mesa: ensure UsesFogFragCoord value is set for non-glsl shaders

Keith Whitwell keithw at kemper.freedesktop.org
Thu Jul 2 10:30:27 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: b3e8e1cd4c1584f735e35914861ae2e8ae5b6b2b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3e8e1cd4c1584f735e35914861ae2e8ae5b6b2b

Author: Keith Whitwell <keithw at vmware.com>
Date:   Thu Jul  2 11:28:56 2009 +0100

mesa: ensure UsesFogFragCoord value is set for non-glsl shaders

With recent changes to support frontfacing in glsl, it is necessary
to ensure that the UsesFogFragCoord value is accurate in all shaders.
We were previously not setting it for fixed-function and ARB_fs shaders.

---

 src/mesa/shader/arbprogparse.c |    7 +++++++
 src/mesa/shader/programopt.c   |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index bb4c5b3..f5053d3 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -3922,6 +3922,13 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
 
    if (program->FogOption)
       program->Base.InputsRead |= FRAG_BIT_FOGC;
+
+   /* XXX: assume that ARB fragment programs don't have access to the
+    * FrontFacing and PointCoord values stuffed into the fog
+    * coordinate in GLSL shaders.
+    */
+   if (program->Base.InputsRead & FRAG_BIT_FOGC)
+      program->UsesFogFragCoord = TRUE;
       
    if (program->Base.Instructions)
       _mesa_free(program->Base.Instructions);
diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c
index f70c75c..ac5fe0f 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -396,6 +396,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
    fprog->Base.Instructions = newInst;
    fprog->Base.NumInstructions = inst - newInst;
    fprog->Base.InputsRead |= FRAG_BIT_FOGC;
+   fprog->UsesFogFragCoord = GL_TRUE;
    /* XXX do this?  fprog->FogOption = GL_NONE; */
 }
 




More information about the mesa-commit mailing list