From 4c91930a257ac500029f56514c5504ad66b7cf8f Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 21 Aug 2013 13:20:05 -0400 Subject: freedreno: fix segfault when no color buffer bound Don't crash when no color buffer bound. Something caught when starting to run piglit, fixes a hanful of piglit tests. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/gallium/drivers/freedreno/freedreno_util.h') diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index 22857d2189d..9f106864e76 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -33,6 +33,7 @@ #include #include "pipe/p_format.h" +#include "pipe/p_state.h" #include "util/u_debug.h" #include "util/u_math.h" #include "util/u_half.h" @@ -79,6 +80,15 @@ static inline uint32_t DRAW(enum pc_di_primtype prim_type, (1 << 14); } + +static inline enum pipe_format +pipe_surface_format(struct pipe_surface *psurf) +{ + if (!psurf) + return PIPE_FORMAT_NONE; + return psurf->format; +} + #define LOG_DWORDS 0 -- cgit v1.2.3