summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2014-03-19 11:55:50 -0700
committerAnuj Phogat <[email protected]>2014-05-01 10:58:40 -0700
commitd714b20eb4617f24b496a09028a90fdd8c19b5bd (patch)
tree17bf07a4e1840b20f04e043aa1f3e6217bd4477c
parent5388fc157e2b78d67a05dc923b98857e6449cf1e (diff)
i965: Fix crash in do_blit_readpixels()
Fixes a crash in Khronos CTS packed_pixels tests. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/intel_pixel_read.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c
index 600d288994b..8cd7579142a 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -34,6 +34,7 @@
#include "main/bufferobj.h"
#include "main/readpix.h"
#include "main/state.h"
+#include "main/glformats.h"
#include "brw_context.h"
#include "intel_screen.h"
@@ -89,6 +90,12 @@ do_blit_readpixels(struct gl_context * ctx,
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+ /* Currently this function only supports reading from color buffers. */
+ if (!_mesa_is_color_format(format))
+ return false;
+
+ assert(irb != NULL);
+
if (ctx->_ImageTransferState ||
!_mesa_format_matches_format_and_type(irb->mt->format, format, type,
false)) {