mesa: handle some cases of 0x0 render targets
[mesa.git] / src / mesa / state_tracker / st_cb_fbo.c
index 00076f61e0f0870a1cbde3d1c66cfb8dd1014115..45a05421f8ecd56437458364db221a3de80eefac 100644 (file)
@@ -388,8 +388,6 @@ st_render_texture(GLcontext *ctx,
    /*printf("***** render to texture level %d: %d x %d\n", att->TextureLevel, rb->Width, rb->Height);*/
 
    pt = st_get_texobj_texture(att->Texture);
-   assert(pt);
-   /*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/
 
    pipe_texture_reference( &strb->texture, pt );
 
@@ -397,7 +395,10 @@ st_render_texture(GLcontext *ctx,
 
    /* the new surface will be created during framebuffer validation */
 
-   init_renderbuffer_bits(strb, pt->format);
+   if (pt) {
+      /*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/
+      init_renderbuffer_bits(strb, pt->format);
+   }
 
    /*
    printf("RENDER TO TEXTURE obj=%p pt=%p surf=%p  %d x %d\n",
@@ -426,7 +427,7 @@ st_finish_render_texture(GLcontext *ctx,
    if (!strb)
       return;
 
-   ctx->st->pipe->flush(ctx->st->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+   st_flush( ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL );
 
    if (strb->surface)
       screen->tex_surface_release( screen, &strb->surface );