Mesa (gallium-cylindrical-wrap): mesa: add back-door support for cylindrical texture wrap mode

Brian Paul brianp at kemper.freedesktop.org
Thu Feb 4 23:48:44 UTC 2010


Module: Mesa
Branch: gallium-cylindrical-wrap
Commit: 444660ae25534dab2e48ca071bc1e30b5e1cabed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=444660ae25534dab2e48ca071bc1e30b5e1cabed

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Feb  4 16:40:47 2010 -0700

mesa: add back-door support for cylindrical texture wrap mode

If the texture priority field is 0.125 set the PROG_PARAM_BIT_CYL_WRAP
flag.  The gallium state tracker will look for this flag.

This feature is only for testing purposes and may be remove at some
point.  But if it's useful we could write a GL/Mesa extension to
expose it properly.

---

 src/mesa/main/texenvprogram.c    |   12 ++++++++++++
 src/mesa/shader/prog_parameter.h |    1 +
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 499b733..de512c2 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -113,6 +113,8 @@ struct state_key {
       GLuint NumArgsA:3;  /**< up to MAX_COMBINER_TERMS */
       GLuint ModeA:5;     /**< MODE_x */
 
+      GLuint texture_cyl_wrap:1; /**< For gallium test/debug only */
+
       struct mode_opt OptRGB[MAX_COMBINER_TERMS];
       struct mode_opt OptA[MAX_COMBINER_TERMS];
    } unit[MAX_TEXTURE_UNITS];
@@ -464,6 +466,10 @@ static GLuint make_state_key( GLcontext *ctx,  struct state_key *key )
          key->unit[i].OptRGB[1].Operand = OPR_SRC_COLOR;
          key->unit[i].OptRGB[1].Source = texUnit->BumpTarget - GL_TEXTURE0 + SRC_TEXTURE0;
        }
+
+      /* this is a back-door for enabling cylindrical texture wrap mode */
+      if (texObj->Priority == 0.125)
+         key->unit[i].texture_cyl_wrap = 1;
    }
 
    /* _NEW_LIGHT | _NEW_FOG */
@@ -1302,6 +1308,12 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit )
       }
       else
 	 p->src_texture[unit] = get_zero(p);
+
+      if (p->state->unit[unit].texture_cyl_wrap) {
+         /* set flag which is checked by Mesa->Gallium program translation */
+         p->program->Base.InputFlags[0] |= PROG_PARAM_BIT_CYL_WRAP;
+      }
+
    }
 }
 
diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h
index 699cb0c..1111c85 100644
--- a/src/mesa/shader/prog_parameter.h
+++ b/src/mesa/shader/prog_parameter.h
@@ -43,6 +43,7 @@
 #define PROG_PARAM_BIT_INVARIANT  0x2  /**< for varying vars (GLSL 1.20) */
 #define PROG_PARAM_BIT_FLAT       0x4  /**< for varying vars (GLSL 1.30) */
 #define PROG_PARAM_BIT_LINEAR     0x8  /**< for varying vars (GLSL 1.30) */
+#define PROG_PARAM_BIT_CYL_WRAP  0x10  /**< XXX gallium debug */
 /*@}*/
 
 




More information about the mesa-commit mailing list