softpipe: cope with nr_cbufs == 0
authorKeith Whitwell <keithw@vmware.com>
Mon, 27 Jul 2009 10:23:51 +0000 (11:23 +0100)
committerKeith Whitwell <keithw@vmware.com>
Mon, 27 Jul 2009 10:23:51 +0000 (11:23 +0100)
Disable blend code when no color buffer

src/gallium/drivers/softpipe/sp_quad_blend.c

index e1f0e772554cc70ed6df57864951924e1f08df80..e243c63fa23efd256cc19c3e780c81ed4097d086 100644 (file)
@@ -924,6 +924,13 @@ single_output_color(struct quad_stage *qs,
    }
 }
 
+static void
+blend_noop(struct quad_stage *qs, 
+           struct quad_header *quads[],
+           unsigned nr)
+{
+}
+
 
 static void
 choose_blend_quad(struct quad_stage *qs, 
@@ -934,9 +941,12 @@ choose_blend_quad(struct quad_stage *qs,
    const struct pipe_blend_state *blend = softpipe->blend;
 
    qs->run = blend_fallback;
-
-   if (!softpipe->blend->logicop_enable &&
-       softpipe->blend->colormask == 0xf) 
+   
+   if (softpipe->framebuffer.nr_cbufs == 0) {
+      qs->run = blend_noop;
+   }
+   else if (!softpipe->blend->logicop_enable &&
+            softpipe->blend->colormask == 0xf) 
    {
       if (!blend->blend_enable) {
          qs->run = single_output_color;