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.
This commit is contained in:
Brian Paul
2009-01-22 15:13:18 -07:00
parent 1bc59bf4f8
commit 3528f69ce4
2 changed files with 20 additions and 8 deletions

View File

@@ -808,6 +808,8 @@ struct dd_function_table {
struct gl_renderbuffer_attachment *att); struct gl_renderbuffer_attachment *att);
void (*FinishRenderTexture)(GLcontext *ctx, void (*FinishRenderTexture)(GLcontext *ctx,
struct gl_renderbuffer_attachment *att); struct gl_renderbuffer_attachment *att);
void (*ValidateFramebuffer)(GLcontext *ctx,
struct gl_framebuffer *fb);
/*@}*/ /*@}*/
#endif #endif
#if FEATURE_EXT_framebuffer_blit #if FEATURE_EXT_framebuffer_blit

View File

@@ -414,6 +414,8 @@ fbo_incomplete(const char *msg, int index)
/** /**
* Test if the given framebuffer object is complete and update its * Test if the given framebuffer object is complete and update its
* Status field with the results. * 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 * Also update the framebuffer's Width and Height fields if the
* framebuffer is complete. * framebuffer is complete.
*/ */
@@ -566,15 +568,23 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
return; return;
} }
/* /* Provisionally set status = COMPLETE ... */
* 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.
*/
fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT; fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT;
/* ... 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->Width = minWidth;
fb->Height = minHeight; fb->Height = minHeight;
}
} }