broadcom/vc5: Skip over missing color buffers for a couple of checks.
authorEric Anholt <eric@anholt.net>
Sat, 20 Jan 2018 18:19:20 +0000 (10:19 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 1 Feb 2018 19:02:29 +0000 (11:02 -0800)
Fixes crashes in piglit alpha-to-coverage-no-draw-buffer-zero 2

src/gallium/drivers/vc5/vc5_program.c
src/gallium/drivers/vc5/vc5_state.c

index ddb51b7f02aedc9aa2b5592b4f554b50aa42a8d0..881bd4501d8bc5303e3cddcd3b2a6cefd6e770ec 100644 (file)
@@ -378,6 +378,9 @@ vc5_update_compiled_fs(struct vc5_context *vc5, uint8_t prim_mode)
 
         for (int i = 0; i < key->nr_cbufs; i++) {
                 struct pipe_surface *cbuf = vc5->framebuffer.cbufs[i];
+                if (!cbuf)
+                        continue;
+
                 const struct util_format_description *desc =
                         util_format_description(cbuf->format);
 
index 81ae33d7178308531f921c738c91b04ad98de541..ea867279a064407d813f84a3f36cc9fa6789c511 100644 (file)
@@ -443,6 +443,9 @@ vc5_set_framebuffer_state(struct pipe_context *pctx,
         vc5->blend_dst_alpha_one = 0;
         for (int i = 0; i < vc5->framebuffer.nr_cbufs; i++) {
                 struct pipe_surface *cbuf = vc5->framebuffer.cbufs[i];
+                if (!cbuf)
+                        continue;
+
                 const struct util_format_description *desc =
                         util_format_description(cbuf->format);