Mesa (master): gallium: add st_validate_framebuffer() driver function

Brian Paul brianp at kemper.freedesktop.org
Fri Feb 27 17:09:11 UTC 2009


Module: Mesa
Branch: master
Commit: 5fc74734d92f7e7ff3df693254986ba5d2b5e653
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5fc74734d92f7e7ff3df693254986ba5d2b5e653

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Feb 27 09:43:58 2009 -0700

gallium: add st_validate_framebuffer() driver function

Gallium only supports combined depth/stencil buffers, not separate ones.
If the user tries to create create a FBO with separate depth/stencil
renderbuffers mark the FBO as unsupported.

---

 src/mesa/state_tracker/st_cb_fbo.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 5cc6960..15bd6fe 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -439,6 +439,25 @@ st_finish_render_texture(GLcontext *ctx,
 }
 
 
+/**
+ * Check that the framebuffer configuration is valid in terms of what
+ * the driver can support.
+ *
+ * For Gallium we only supports combined Z+stencil, not separate buffers.
+ */
+static void
+st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+{
+   const struct gl_renderbuffer *depthRb =
+      fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+   const struct gl_renderbuffer *stencilRb =
+      fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+
+   if (stencilRb && depthRb && stencilRb != depthRb) {
+      fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+   }
+}
+
 
 void st_init_fbo_functions(struct dd_function_table *functions)
 {
@@ -448,6 +467,7 @@ void st_init_fbo_functions(struct dd_function_table *functions)
    functions->FramebufferRenderbuffer = st_framebuffer_renderbuffer;
    functions->RenderTexture = st_render_texture;
    functions->FinishRenderTexture = st_finish_render_texture;
+   functions->ValidateFramebuffer = st_validate_framebuffer;
    /* no longer needed by core Mesa, drivers handle resizes...
    functions->ResizeBuffers = st_resize_buffers;
    */




More information about the mesa-commit mailing list