summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2011-01-24 19:38:52 -0700
committerBrian Paul <brianp@vmware.com>2011-01-24 19:38:52 -0700
commit62c66b34303303e6786652efa611a100ae64439a (patch)
treeb224af6ecc4176fff061f2c7efb40f44b41a136c /src/mesa/main
parent976ea9d76b44b6e654bd38e3d00f20517be518e0 (diff)
mesa: plug in fallback function for ctx->Driver.ValidateFramebuffer()
The software renderer doesn't support GL_ALPHA, GL_LUMINANCE, etc so we should report GL_FRAMEBUFFER_UNSUPPORTED during FBO validation.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/fbobject.c29
-rw-r--r--src/mesa/main/fbobject.h3
-rw-r--r--src/mesa/main/renderbuffer.c2
3 files changed, 33 insertions, 1 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ff9dcc9ca6..17b768dc84 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -373,6 +373,35 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
/**
+ * Fallback for ctx->Driver.ValidateFramebuffer()
+ * Check if the renderbuffer's formats are supported by the software
+ * renderer.
+ * Drivers should probably override this.
+ */
+void
+_mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
+{
+ gl_buffer_index buf;
+ for (buf = 0; buf < BUFFER_COUNT; buf++) {
+ const struct gl_renderbuffer *rb = fb->Attachment[buf].Renderbuffer;
+ if (rb) {
+ switch (rb->_BaseFormat) {
+ case GL_ALPHA:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE:
+ case GL_INTENSITY:
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
+ return;
+ default:
+ /* render buffer format is supported by software rendering */
+ ;
+ }
+ }
+ }
+}
+
+
+/**
* For debug only.
*/
static void
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 8763f99c4a..ba74a95b74 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -69,6 +69,9 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb
GLenum attachment, struct gl_renderbuffer *rb);
extern void
+_mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb);
+
+extern void
_mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_framebuffer *fb);
extern GLboolean
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 23c662bab7..67ee589d77 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -1086,7 +1086,7 @@ _mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *
pixelSize = sizeof(GLuint);
break;
default:
- _mesa_problem(ctx, "Bad internalFormat in _mesa_soft_renderbuffer_storage");
+ /* unsupported format */
return GL_FALSE;
}