mesa: ensure UsesFogFragCoord value is set for non-glsl shaders
authorKeith Whitwell <keithw@vmware.com>
Thu, 2 Jul 2009 10:28:56 +0000 (11:28 +0100)
committerKeith Whitwell <keithw@vmware.com>
Thu, 2 Jul 2009 10:28:56 +0000 (11:28 +0100)
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
src/mesa/shader/programopt.c

index bb4c5b38d410dec11aa21ff9f44db828150c0498..f5053d3289a7ca04c21d81a561ec62be4f952457 100644 (file)
@@ -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);
index f70c75cec8e3c4a6e74777a8ed436723bae1da36..ac5fe0f691fadb460c03a4c84e32a062abca3652 100644 (file)
@@ -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; */
 }