i915tex: Check that intel_rb is valid before trying to add it to an fbo.
authorMichel Dänzer <michel@tungstengraphics.com>
Wed, 28 Feb 2007 16:42:54 +0000 (17:42 +0100)
committerMichel Dänzer <michel@tungstengraphics.com>
Wed, 28 Feb 2007 16:42:54 +0000 (17:42 +0100)
src/mesa/drivers/dri/i915tex/intel_fbo.c

index ad078451bf2acd93d390f94e72ac585ad9d835b0..8d43055382209486edafcc9b884d305a549f3666 100644 (file)
@@ -81,14 +81,16 @@ intel_flip_renderbuffers(struct intel_framebuffer *intel_fb)
    int current_page = intel_fb->pf_current_page;
    int next_page = (current_page + 1) % intel_fb->pf_num_pages;
 
-   if (intel_fb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer !=
+   if (intel_fb->color_rb[current_page] &&
+       intel_fb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer !=
        &intel_fb->color_rb[current_page]->Base) {
       _mesa_remove_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT);
       _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT,
                             &intel_fb->color_rb[current_page]->Base);
    }
 
-   if (intel_fb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer !=
+   if (intel_fb->color_rb[next_page] &&
+       intel_fb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer !=
        &intel_fb->color_rb[next_page]->Base) {
       _mesa_remove_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT);
       _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT,