summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/colortab.c7
-rw-r--r--src/mesa/main/convolve.c16
-rw-r--r--src/mesa/main/histogram.c10
-rw-r--r--src/mesa/main/image.c6
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c7
5 files changed, 34 insertions, 12 deletions
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index 52d5badf39..e1f7e979fd 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -580,6 +580,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
struct gl_color_table *table = NULL;
GLfloat rgba[MAX_COLOR_TABLE_SIZE][4];
+ GLbitfield transferOps = 0;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState) {
@@ -698,8 +699,12 @@ _mesa_GetColorTable( GLenum target, GLenum format,
if (!data)
return;
+ /* TODO: is this correct? */
+ if(ctx->Color._ClampReadColor)
+ transferOps |= IMAGE_CLAMP_BIT;
+
_mesa_pack_rgba_span_float(ctx, table->Size, rgba,
- format, type, data, &ctx->Pack, 0x0);
+ format, type, data, &ctx->Pack, transferOps);
_mesa_unmap_pbo_dest(ctx, &ctx->Pack);
}
diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c
index f63bddc44d..8d1093953c 100644
--- a/src/mesa/main/convolve.c
+++ b/src/mesa/main/convolve.c
@@ -537,6 +537,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
{
struct gl_convolution_attrib *filter;
GLuint row;
+ GLbitfield transferOps = 0;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -577,13 +578,17 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
if (!image)
return;
+ /* TODO: is this correct? */
+ if(ctx->Color._ClampReadColor)
+ transferOps |= IMAGE_CLAMP_BIT;
+
for (row = 0; row < filter->Height; row++) {
GLvoid *dst = _mesa_image_address2d(&ctx->Pack, image, filter->Width,
filter->Height, format, type,
row, 0);
GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + row * filter->Width * 4);
_mesa_pack_rgba_span_float(ctx, filter->Width, src,
- format, type, dst, &ctx->Pack, 0x0);
+ format, type, dst, &ctx->Pack, transferOps);
}
_mesa_unmap_pbo_dest(ctx, &ctx->Pack);
@@ -727,6 +732,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
{
const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
struct gl_convolution_attrib *filter;
+ GLbitfield transferOps = 0;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -756,6 +762,10 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
filter = &ctx->Separable2D;
+ /* TODO: is this correct? */
+ if(ctx->Color._ClampReadColor)
+ transferOps |= IMAGE_CLAMP_BIT;
+
/* Get row filter */
row = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack,
filter->Width, 1, 1,
@@ -766,7 +776,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
format, type, 0);
_mesa_pack_rgba_span_float(ctx, filter->Width,
(GLfloat (*)[4]) filter->Filter,
- format, type, dst, &ctx->Pack, 0x0);
+ format, type, dst, &ctx->Pack, transferOps);
_mesa_unmap_pbo_dest(ctx, &ctx->Pack);
}
@@ -780,7 +790,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
format, type, 0);
GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + colStart);
_mesa_pack_rgba_span_float(ctx, filter->Height, src,
- format, type, dst, &ctx->Pack, 0x0);
+ format, type, dst, &ctx->Pack, transferOps);
_mesa_unmap_pbo_dest(ctx, &ctx->Pack);
}
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c
index 4e482bcd54..3b6acb4cb9 100644
--- a/src/mesa/main/histogram.c
+++ b/src/mesa/main/histogram.c
@@ -626,6 +626,7 @@ static void GLAPIENTRY _mesa_ResetMinmax(GLenum target);
static void GLAPIENTRY
_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
{
+ GLbitfield transferOps = 0;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -664,6 +665,13 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
if (!values)
return;
+ if(ctx->NewState & (_NEW_BUFFERS | _NEW_COLOR))
+ _mesa_update_state(ctx);
+
+ /* TODO: is this correct? */
+ if(ctx->Color._ClampReadColor)
+ transferOps |= IMAGE_CLAMP_BIT;
+
{
GLfloat minmax[2][4];
minmax[0][RCOMP] = CLAMP(ctx->MinMax.Min[RCOMP], 0.0F, 1.0F);
@@ -675,7 +683,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F);
minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F);
_mesa_pack_rgba_span_float(ctx, 2, minmax,
- format, type, values, &ctx->Pack, 0x0);
+ format, type, values, &ctx->Pack, transferOps);
}
_mesa_unmap_pbo_dest(ctx, &ctx->Pack);
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 86aa6d0d70..5ea6536d86 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -2121,11 +2121,7 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
const GLint comps = _mesa_components_in_format(dstFormat);
GLuint i;
- /* XXX
- * This test should probably go away. Have the caller set/clear the
- * IMAGE_CLAMP_BIT as needed.
- */
- if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
+ if (dstType != GL_FLOAT) {
/* need to clamp to [0, 1] */
transferOps |= IMAGE_CLAMP_BIT;
}
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 6ab03ec939..14c9b7a50d 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -328,7 +328,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
GLfloat temp[MAX_WIDTH][4];
- const GLbitfield transferOps = ctx->_ImageTransferState;
+ GLbitfield transferOps = ctx->_ImageTransferState;
GLsizei i, j;
GLint yStep, dfStride;
GLfloat *df;
@@ -383,7 +383,10 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
- if (format == GL_RGBA && type == GL_FLOAT) {
+ if(ctx->Color._ClampReadColor)
+ transferOps |= IMAGE_CLAMP_BIT;
+
+ if (format == GL_RGBA && type == GL_FLOAT && !transferOps) {
/* write tile(row) directly into user's buffer */
df = (GLfloat *) _mesa_image_address2d(&clippedPacking, dest, width,
height, format, type, 0, 0);