summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-02-04 16:40:47 -0700
committerBrian Paul <brianp@vmware.com>2010-02-04 16:40:47 -0700
commit444660ae25534dab2e48ca071bc1e30b5e1cabed (patch)
tree547e461f124599e58fbedc30d016c161d499e2ee
parent0870903dc5689ff86a2ed8182d927bfa23ff4fd7 (diff)
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.
-rw-r--r--src/mesa/main/texenvprogram.c12
-rw-r--r--src/mesa/shader/prog_parameter.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 499b7330d0..de512c2b7e 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 699cb0c735..1111c85976 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 */
/*@}*/