diff options
author | Brian Paul <brianp@vmware.com> | 2009-01-19 17:09:14 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-01-19 17:09:14 -0700 |
commit | 79e0d905aba2c56377a3a517cbd4a82526d1f98b (patch) | |
tree | 852418fed3af33ab1c769e562d440bb96fbda3a6 /src | |
parent | f4aef5b162135deb509ad0682cd978673b047c2f (diff) |
mesa: added ctx->Driver.ValidateFramebuffer() callback
Called from the _mesa_test_framebuffer_completeness() function to give the
driver the chance to make a framebuffer as incomplete if it doesn't meet
some specific hardware restriction.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/dd.h | 2 | ||||
-rw-r--r-- | src/mesa/main/fbobject.c | 26 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index ddb38030bf..989791f39f 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -808,6 +808,8 @@ struct dd_function_table { struct gl_renderbuffer_attachment *att); void (*FinishRenderTexture)(GLcontext *ctx, struct gl_renderbuffer_attachment *att); + void (*ValidateFramebuffer)(GLcontext *ctx, + struct gl_framebuffer *fb); /*@}*/ #endif #if FEATURE_EXT_framebuffer_blit diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 5bb9015efe..ad4965550a 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -414,6 +414,8 @@ fbo_incomplete(const char *msg, int index) /** * Test if the given framebuffer object is complete and update its * Status field with the results. + * Calls the ctx->Driver.ValidateFramebuffer() function to allow the + * driver to make hardware-specific validation/completeness checks. * Also update the framebuffer's Width and Height fields if the * framebuffer is complete. */ @@ -566,15 +568,23 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) return; } - /* - * If we get here, the framebuffer is complete! - * Note that if ARB_framebuffer_object is supported and the attached - * renderbuffers/textures are different sizes, the framebuffer width/height - * will be set to the smallest width/height. - */ + /* Provisionally set status = COMPLETE ... */ fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT; - fb->Width = minWidth; - fb->Height = minHeight; + + /* ... but the driver may say the FB is incomplete: */ + if (ctx->Driver.ValidateFramebuffer) { + ctx->Driver.ValidateFramebuffer(ctx, fb); + } + + if (fb->_Status == GL_FRAMEBUFFER_COMPLETE_EXT) { + /* + * Note that if ARB_framebuffer_object is supported and the attached + * renderbuffers/textures are different sizes, the framebuffer + * width/height will be set to the smallest width/height. + */ + fb->Width = minWidth; + fb->Height = minHeight; + } } |