X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Freadpix.c;h=b09cf54994a638c27e29da96b07640e62cd427f1;hb=079bff5a99fa19029fc0caba92fe57046ee29b23;hp=d3d09dea3456dda2729822a845e4bb09d613b8f2;hpb=d702c67ba51f55c04be670c0ac618b687f7d2127;p=mesa.git diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index d3d09dea345..b09cf54994a 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 7.1 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -17,13 +16,15 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" +#include "blend.h" #include "bufferobj.h" #include "context.h" #include "enums.h" @@ -44,7 +45,7 @@ * Return true if the conversion L=R+G+B is needed. */ static GLboolean -need_rgb_to_luminance_conversion(gl_format texFormat, GLenum format) +need_rgb_to_luminance_conversion(mesa_format texFormat, GLenum format) { GLenum baseTexFormat = _mesa_get_format_base_format(texFormat); @@ -59,7 +60,7 @@ need_rgb_to_luminance_conversion(gl_format texFormat, GLenum format) * Return transfer op flags for this ReadPixels operation. */ static GLbitfield -get_readpixels_transfer_ops(const struct gl_context *ctx, gl_format texFormat, +get_readpixels_transfer_ops(const struct gl_context *ctx, mesa_format texFormat, GLenum format, GLenum type, GLboolean uses_blit) { GLbitfield transferOps = ctx->_ImageTransferState; @@ -80,7 +81,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, gl_format texFormat, if (uses_blit) { /* For blit-based ReadPixels packing, the clamping is done automatically * unless the type is float. */ - if (ctx->Color._ClampReadColor == GL_TRUE && + if (_mesa_get_clamp_read_color(ctx) && (type == GL_FLOAT || type == GL_HALF_FLOAT)) { transferOps |= IMAGE_CLAMP_BIT; } @@ -88,7 +89,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, gl_format texFormat, else { /* For CPU-based ReadPixels packing, the clamping must always be done * for non-float types, */ - if (ctx->Color._ClampReadColor == GL_TRUE || + if (_mesa_get_clamp_read_color(ctx) || (type != GL_FLOAT && type != GL_HALF_FLOAT)) { transferOps |= IMAGE_CLAMP_BIT; } @@ -423,13 +424,13 @@ read_rgba_pixels_swizzle(struct gl_context *ctx, GLboolean swizzle_rb = GL_FALSE, copy_xrgb = GL_FALSE; /* XXX we could check for other swizzle/special cases here as needed */ - if (rb->Format == MESA_FORMAT_RGBA8888_REV && + if (rb->Format == MESA_FORMAT_R8G8B8A8_UNORM && format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV && !ctx->Pack.SwapBytes) { swizzle_rb = GL_TRUE; } - else if (rb->Format == MESA_FORMAT_XRGB8888 && + else if (rb->Format == MESA_FORMAT_B8G8R8X8_UNORM && format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV && !ctx->Pack.SwapBytes) { @@ -492,7 +493,7 @@ slow_read_rgba_pixels( struct gl_context *ctx, GLbitfield transferOps ) { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; - const gl_format rbFormat = _mesa_get_srgb_format_linear(rb->Format); + const mesa_format rbFormat = _mesa_get_srgb_format_linear(rb->Format); void *rgba; GLubyte *dst, *map; int dstStride, stride, j; @@ -593,8 +594,8 @@ fast_read_depth_stencil_pixels(struct gl_context *ctx, if (rb != stencilRb) return GL_FALSE; - if (rb->Format != MESA_FORMAT_Z24_S8 && - rb->Format != MESA_FORMAT_S8_Z24) + if (rb->Format != MESA_FORMAT_S8_UINT_Z24_UNORM && + rb->Format != MESA_FORMAT_Z24_UNORM_S8_UINT) return GL_FALSE; ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT, @@ -1032,7 +1033,7 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, } if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && - _mesa_bufferobj_mapped(ctx->Pack.BufferObj)) { + _mesa_check_disallowed_mapping(ctx->Pack.BufferObj)) { /* buffer is mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); return;