mesa: Generate a renderbuffer wrapper even if the texture has no image
authorIan Romanick <ian.d.romanick@intel.com>
Sun, 28 Jul 2013 20:08:27 +0000 (13:08 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 6 Aug 2013 19:18:50 +0000 (12:18 -0700)
This prevents a segfault in check_begin_texture_render when an FBO is
rebound while in this state.  This fixes the piglit test
fbo-incomplete-invalid-texture.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
src/mesa/main/fbobject.c

index 76aa0bf3b4d6cd922952cc4d513f84d6b68da78e..74f294c1d3642b10e104fcc75fd38f277c8020ba 100644 (file)
@@ -385,8 +385,6 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx,
    struct gl_renderbuffer *rb;
 
    texImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
-   if (!texImage)
-      return;
 
    rb = att->Renderbuffer;
    if (!rb) {
@@ -405,6 +403,9 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx,
       rb->NeedsFinishRenderTexture = ctx->Driver.FinishRenderTexture != NULL;
    }
 
+   if (!texImage)
+      return;
+
    rb->_BaseFormat = texImage->_BaseFormat;
    rb->Format = texImage->TexFormat;
    rb->InternalFormat = texImage->InternalFormat;