mesa: Attempt to pair up Driver.RenderTexture and FinishRenderTexture()
[mesa.git] / src / mesa / main / fbobject.c
index 319d0f2ce9773379c0b907f2a34890a70d38a5dc..c4454550dbca3fcd3238cfd759db2a58050b2c1c 100644 (file)
@@ -233,9 +233,13 @@ _mesa_set_texture_attachment(GLcontext *ctx,
    if (att->Texture == texObj) {
       /* re-attaching same texture */
       ASSERT(att->Type == GL_TEXTURE);
+      if (ctx->Driver.FinishRenderTexture)
+        ctx->Driver.FinishRenderTexture(ctx, att);
    }
    else {
       /* new attachment */
+      if (ctx->Driver.FinishRenderTexture && att->Texture)
+        ctx->Driver.FinishRenderTexture(ctx, att);
       _mesa_remove_attachment(ctx, att);
       att->Type = GL_TEXTURE;
       assert(!att->Texture);