/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
GLint i;
- ASSERT(rb);
+ if (!rb)
+ return;
/* width should never be > MAX_WIDTH since we did clipping earlier */
ASSERT(width <= MAX_WIDTH);
const GLboolean biasOrScale
= ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
+ if (!rb)
+ return;
+
/* clipping should have been done already */
ASSERT(x >= 0);
ASSERT(y >= 0);
/* width should never be > MAX_WIDTH since we did clipping earlier */
ASSERT(width <= MAX_WIDTH);
- ASSERT(rb);
-
if (type == GL_UNSIGNED_SHORT && fb->Visual.depthBits == 16
&& !biasOrScale && !packing->SwapBytes) {
/* Special case: directly read 16-bit unsigned depth values. */
struct gl_renderbuffer *rb = fb->_StencilBuffer;
GLint j;
- ASSERT(rb);
+ if (!rb)
+ return;
/* width should never be > MAX_WIDTH since we did clipping earlier */
ASSERT(width <= MAX_WIDTH);
/**
* Optimized glReadPixels for particular pixel formats when pixel
* scaling, biasing, mapping, etc. are disabled.
+ * \return GL_TRUE if success, GL_FALSE if unable to do the readpixels
*/
static GLboolean
fast_read_rgba_pixels( GLcontext *ctx,
{
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
+ if (!rb)
+ return GL_FALSE;
+
ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB);
/* clipping should have already been done */
struct gl_framebuffer *fb = ctx->ReadBuffer;
struct gl_renderbuffer *rb = fb->_ColorReadBuffer;
- ASSERT(rb);
+ if (!rb)
+ return;
if (type == GL_FLOAT && ((ctx->Color.ClampReadColor == GL_TRUE) ||
(ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
depthRb = ctx->ReadBuffer->_DepthBuffer;
stencilRb = ctx->ReadBuffer->_StencilBuffer;
- ASSERT(depthRb);
- ASSERT(stencilRb);
+ if (!depthRb || !stencilRb)
+ return;
depthRb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
stencilRb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;