diff options
author | Marek Olšák <maraeo@gmail.com> | 2012-06-15 17:21:05 +0200 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2012-06-16 14:20:26 +0200 |
commit | a82227ce4a60155cb16c47d7315f2efe2e87b0c2 (patch) | |
tree | c54d7221ddc4836cc9a14ae38e06fe35a89c7c63 /src | |
parent | 841eee5d44b222a5819804726187683033eb71db (diff) |
mesa: if AllocStorage doesn't choose a format, report FRAMEBUFFER_UNSUPPORTED
This allows drivers not to do any allocation in AllocStorage if the storage
cannot be allocated because of an unsupported internalformat + samples combo.
The little ugliness is that AllocStorage is expected to return TRUE in this
case.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/fbobject.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 777783eb7e..cfaea62bba 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -805,6 +805,15 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, return; } } + + /* Check that the format is valid. (MESA_FORMAT_NONE means unsupported) + */ + if (att->Type == GL_RENDERBUFFER && + att->Renderbuffer->Format == MESA_FORMAT_NONE) { + fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED; + fbo_incomplete("unsupported renderbuffer format", i); + return; + } } #if FEATURE_GL @@ -1394,7 +1403,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, ASSERT(rb->AllocStorage); if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) { /* No error - check/set fields now */ - assert(rb->Format != MESA_FORMAT_NONE); + /* If rb->Format == MESA_FORMAT_NONE, the format is unsupported. */ assert(rb->Width == (GLuint) width); assert(rb->Height == (GLuint) height); rb->InternalFormat = internalFormat; |