summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2014-03-19 11:55:50 -0700
committerCarl Worth <cworth@cworth.org>2014-05-05 11:23:20 -0700
commit87173023b285c45c27deac70aae7792e3c75b895 (patch)
tree419c3717ddc28f5e2b30a117d3cc34c892ddc361
parent51e80d1a8b02438b6f9fe85370ca1a434ac1bc13 (diff)
i965: Fix crash in do_blit_readpixels()
Fixes a crash in Khronos CTS packed_pixels tests. Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (cherry picked from commit d714b20eb4617f24b496a09028a90fdd8c19b5bd)
-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)) {