intel: Fall back on any rendering to texture with no miptree.
authorEric Anholt <eric@anholt.net>
Wed, 20 May 2009 21:16:34 +0000 (14:16 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 21 May 2009 17:40:11 +0000 (10:40 -0700)
Fixes segfault on an fbo.c negative test for FBO with texture width/height
of 0.  Previously we just tested for border != 0 to work around this
segfault.

src/mesa/drivers/dri/intel/intel_fbo.c

index 0b0f0f980bf1315e02a83bc06cfb84c5eb1c149c..04723a2f917916721134e07d25e5cefdca72b3d7 100644 (file)
@@ -574,9 +574,10 @@ intel_render_texture(GLcontext * ctx,
 
    ASSERT(newImage);
 
-   if (newImage->Border != 0) {
-      /* Fallback on drawing to a texture with a border, which won't have a
-       * miptree.
+   intel_image = intel_texture_image(newImage);
+   if (!intel_image->mt) {
+      /* Fallback on drawing to a texture that doesn't have a miptree
+       * (has a border, width/height 0, etc.)
        */
       _mesa_reference_renderbuffer(&att->Renderbuffer, NULL);
       _mesa_render_texture(ctx, fb, att);
@@ -607,7 +608,6 @@ intel_render_texture(GLcontext * ctx,
        irb->Base.RefCount);
 
    /* point the renderbufer's region to the texture image region */
-   intel_image = intel_texture_image(newImage);
    if (irb->region != intel_image->mt->region) {
       if (irb->region)
         intel_region_release(&irb->region);