summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2008-11-20 13:44:13 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2008-11-20 13:44:13 +0000
commitef2bf418b45c7966e9fe78359058b8d44f570be1 (patch)
treec0bc3be44bae336ca4c9133ffb2529c8d99bbc0f /src/mesa/main
parent4f3dcf3864c3cbd8a6ebc6af38e53d57e4d421d6 (diff)
parentb6bb5e09e0ad1f61f96c65bbc870bd493df12f1a (diff)
Merge commit 'origin/master' into gallium-0.2
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/image.c2
-rw-r--r--src/mesa/main/texenvprogram.c7
-rw-r--r--src/mesa/main/texstore.c10
3 files changed, 16 insertions, 3 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index bd38e0c3d8..d3282d42e9 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1689,7 +1689,7 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
/* compute luminance values */
- if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
+ if (transferOps & IMAGE_CLAMP_BIT) {
for (i = 0; i < n; i++) {
GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
luminance[i] = CLAMP(sum, 0.0F, 1.0F);
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 237ddaa683..3cb103f51f 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -297,10 +297,13 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
for (i=0;i<MAX_TEXTURE_UNITS;i++) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ GLenum format;
if (!texUnit->_ReallyEnabled || !texUnit->Enabled)
continue;
+ format = texUnit->_Current->Image[0][texUnit->_Current->BaseLevel]->_BaseFormat;
+
key->unit[i].enabled = 1;
key->enabled_units |= (1<<i);
key->nr_enabled_units = i+1;
@@ -308,7 +311,9 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
key->unit[i].source_index =
translate_tex_src_bit(texUnit->_ReallyEnabled);
- key->unit[i].shadow = texUnit->_Current->CompareMode == GL_COMPARE_R_TO_TEXTURE;
+ key->unit[i].shadow = ((texUnit->_Current->CompareMode == GL_COMPARE_R_TO_TEXTURE) &&
+ ((format == GL_DEPTH_COMPONENT) ||
+ (format == GL_DEPTH_STENCIL_EXT)));
key->unit[i].NumArgsRGB = texUnit->_CurrentCombine->_NumArgsRGB;
key->unit[i].NumArgsA = texUnit->_CurrentCombine->_NumArgsA;
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index c1fafbae30..7278180a5c 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3719,6 +3719,14 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
/* general case: convert row to RGBA format */
GLfloat rgba[MAX_WIDTH][4];
GLint col;
+ GLbitfield transferOps = 0x0;
+
+ if (type == GL_FLOAT &&
+ ((ctx->Color.ClampReadColor == GL_TRUE) ||
+ (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
+ texImage->TexFormat->DataType != GL_FLOAT)))
+ transferOps |= IMAGE_CLAMP_BIT;
+
for (col = 0; col < width; col++) {
(*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
if (texImage->TexFormat->BaseFormat == GL_ALPHA) {
@@ -3743,7 +3751,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
}
_mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
format, type, dest,
- &ctx->Pack, 0x0 /*image xfer ops*/);
+ &ctx->Pack, transferOps /*image xfer ops*/);
} /* format */
} /* row */
} /* img */