summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-08-31 11:14:16 -0600
committerBrian Paul <brianp@vmware.com>2009-08-31 11:14:16 -0600
commit2241665dc6d77a992edfc49a9d9d9ed8d1b52e60 (patch)
treeae64cae44527d1628ee420493e2a831e7896779a /src/mesa/main
parent6bf86681f5903a06f98cc32ddf5715706de97c4a (diff)
mesa: fix saturation logic in emit_texenv()
We need to clamp/saturate after each texenv stage, not just the last one. Fixes glean texEnv failure for softpipe (and probably other fragment program- based drivers).
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texenvprogram.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 3ff30058ecf..050a3a99fed 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -1097,7 +1097,7 @@ static struct ureg
emit_texenv(struct texenv_fragment_program *p, GLuint unit)
{
struct state_key *key = p->state;
- GLboolean saturate = (unit < p->last_tex_stage);
+ GLboolean saturate;
GLuint rgb_shift, alpha_shift;
struct ureg out, shift;
struct ureg dest;
@@ -1125,6 +1125,11 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
break;
}
+ /* If we'll do rgb/alpha shifting don't saturate in emit_combine().
+ * We don't want to clamp twice.
+ */
+ saturate = !(rgb_shift || alpha_shift);
+
/* If this is the very last calculation, emit direct to output reg:
*/
if (key->separate_specular ||
@@ -1173,6 +1178,7 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
/* Deal with the final shift:
*/
if (alpha_shift || rgb_shift) {
+ saturate = GL_TRUE; /* always saturate at this point */
if (rgb_shift == alpha_shift) {
shift = register_scalar_const(p, (GLfloat)(1<<rgb_shift));
}