mesa: Add UsesDFdy to struct gl_fragment_program.
authorPaul Berry <stereotype441@gmail.com>
Wed, 20 Jun 2012 19:31:46 +0000 (12:31 -0700)
committerPaul Berry <stereotype441@gmail.com>
Thu, 19 Jul 2012 17:02:01 +0000 (10:02 -0700)
The i965 back-end needs to compile dFdy() differently for FBOs and
window system framebuffers, because Y coordinates are flipped between
the two (see commit 82d2596: i965: Compute dFdy() correctly for FBOs).
This boolean will allow it to avoid unnecessarily recompiling shaders
that don't use dFdy().

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/mtypes.h
src/mesa/program/program.c

index 1f74e6a8308a1622e42967063a924f0ec21bd723..4769e106631a054fe1be38f885635d82e1ea4e6c 100644 (file)
@@ -2011,6 +2011,7 @@ struct gl_fragment_program
 {
    struct gl_program Base;   /**< base class */
    GLboolean UsesKill;          /**< shader uses KIL instruction */
+   GLboolean UsesDFdy;          /**< shader uses DDY instruction */
    GLboolean OriginUpperLeft;
    GLboolean PixelCenterInteger;
    enum gl_frag_depth_layout FragDepthLayout;
index 23138eae85b6f96e330a483aa8403420724bab51..15337f4d8aa071be8174682617d19b57c8eb0f6b 100644 (file)
@@ -546,6 +546,7 @@ _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
          const struct gl_fragment_program *fp = gl_fragment_program_const(prog);
          struct gl_fragment_program *fpc = gl_fragment_program(clone);
          fpc->UsesKill = fp->UsesKill;
+         fpc->UsesDFdy = fp->UsesDFdy;
          fpc->OriginUpperLeft = fp->OriginUpperLeft;
          fpc->PixelCenterInteger = fp->PixelCenterInteger;
       }
@@ -767,6 +768,7 @@ _mesa_combine_programs(struct gl_context *ctx,
       newFprog = gl_fragment_program(newProg);
 
       newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill;
+      newFprog->UsesDFdy = fprogA->UsesDFdy || fprogB->UsesDFdy;
 
       /* We'll do a search and replace for instances
        * of progB_colorFile/progB_colorIndex below...