[Mesa-dev] [RFC 1/3] mesa: Driver.DiscardFramebuffer -> Driver.DiscardTexture
Rob Clark
robdclark at gmail.com
Sun Aug 16 11:56:22 PDT 2015
From: Rob Clark <robclark at freedesktop.org>
No one was implementing this driver hook, so let's first turn it into
something more useful and better matching the rest of the Driver API.
Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
src/mesa/drivers/common/driverfuncs.c | 2 +-
src/mesa/main/dd.h | 6 +++---
src/mesa/main/fbobject.c | 17 +++++++++++++++--
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 6fe42b1..92aabf0 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -176,7 +176,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->ValidateFramebuffer = _mesa_validate_framebuffer;
driver->BlitFramebuffer = _swrast_BlitFramebuffer;
- driver->DiscardFramebuffer = NULL;
+ driver->DiscardTexture = NULL;
_mesa_init_texture_barrier_functions(driver);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 1fc4ca4..ddc2e77 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -723,9 +723,9 @@ struct dd_function_table {
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
- void (*DiscardFramebuffer)(struct gl_context *ctx,
- GLenum target, GLsizei numAttachments,
- const GLenum *attachments);
+ void (*DiscardTexture)(struct gl_context *ctx,
+ struct gl_framebuffer *fb,
+ struct gl_renderbuffer_attachment *att);
/**
* \name Query objects
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8418340..42eec89 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -4182,8 +4182,21 @@ _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
}
}
- if (ctx->Driver.DiscardFramebuffer)
- ctx->Driver.DiscardFramebuffer(ctx, target, numAttachments, attachments);
+ 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;
--
2.4.3
More information about the mesa-dev
mailing list