[Mesa-dev] [RFC 2/3] mesa: hook up DiscardTexture for InvalidateFramebuffer and friends

Rob Clark robdclark at gmail.com
Sun Aug 16 11:56:23 PDT 2015


From: Rob Clark <robclark at freedesktop.org>

We can use same Driver hook for these, in addition to
DiscardFramebufferEXT()

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
 src/mesa/main/fbobject.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 42eec89..bac10e6 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -4003,9 +4003,28 @@ invalidate_framebuffer_storage(struct gl_context *ctx,
       }
    }
 
-   /* We don't actually do anything for this yet.  Just return after
-    * validating the parameters and generating the required errors.
-    */
+   if ((x != 0) || (y != 0))
+      return;
+
+   if ((width != fb->Width) || (height != fb->Height))
+      return;
+
+   if (ctx->Driver.DiscardTexture) {
+      for (i = 0; i < numAttachments; i++) {
+         struct gl_renderbuffer_attachment *att;
+
+         if (_mesa_is_user_fbo(fb))
+            att = get_attachment(ctx, fb, attachments[i]);
+         else /* winsys_fbo */
+            att = _mesa_get_fb0_attachment(ctx, fb, attachments[i]);
+
+         if (!att)
+            continue;
+
+         ctx->Driver.DiscardTexture(ctx, fb, att);
+      }
+   }
+
    return;
 
 invalid_enum:
-- 
2.4.3



More information about the mesa-dev mailing list