diff options
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/readpix.c | 22 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 4 |
2 files changed, 16 insertions, 10 deletions
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 0f429ab22..3384d8a38 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -225,6 +225,16 @@ fast_read_rgba_pixels_memcpy( struct gl_context *ctx, ctx->Pack.SwapBytes)) return GL_FALSE; + /* If the format is unsigned normalized then we can ignore clamping + * because the values are already in the range [0,1] so it won't + * have any effect anyway. + */ + if (_mesa_get_format_datatype(rb->Format) == GL_UNSIGNED_NORMALIZED) + transferOps &= ~IMAGE_CLAMP_BIT; + + if (transferOps) + return GL_FALSE; + dstStride = _mesa_image_row_stride(packing, width, format, type); dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, format, type, 0, 0); @@ -320,13 +330,11 @@ read_rgba_pixels( struct gl_context *ctx, transferOps |= IMAGE_CLAMP_BIT; } - if (!transferOps) { - /* Try the optimized paths first. */ - if (fast_read_rgba_pixels_memcpy(ctx, x, y, width, height, - format, type, pixels, packing, - transferOps)) { - return; - } + /* Try the optimized paths first. */ + if (fast_read_rgba_pixels_memcpy(ctx, x, y, width, height, + format, type, pixels, packing, + transferOps)) { + return; } slow_read_rgba_pixels(ctx, x, y, width, height, diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 9b6c6c896..5328ae296 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -69,8 +69,6 @@ * * This is the format which is used during texture application (i.e. the * texture format and env mode determine the arithmetic used. - * - * XXX this could be static */ GLint _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) @@ -830,7 +828,7 @@ _mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level) struct gl_texture_image *texImage; GLuint texIndex; - if (level < 0 ) + if (level < 0) return NULL; switch (target) { |