additional assertions and debug code for testing FBO completeness
This commit is contained in:
@@ -317,18 +317,25 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (att->Type == GL_RENDERBUFFER_EXT) {
|
else if (att->Type == GL_RENDERBUFFER_EXT) {
|
||||||
if (att->Renderbuffer->Width < 1 || att->Renderbuffer->Height < 1) {
|
ASSERT(att->Renderbuffer);
|
||||||
|
if (!att->Renderbuffer->InternalFormat ||
|
||||||
|
att->Renderbuffer->Width < 1 ||
|
||||||
|
att->Renderbuffer->Height < 1) {
|
||||||
att->Complete = GL_FALSE;
|
att->Complete = GL_FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (format == GL_COLOR) {
|
if (format == GL_COLOR) {
|
||||||
if (att->Renderbuffer->_BaseFormat != GL_RGB &&
|
if (att->Renderbuffer->_BaseFormat != GL_RGB &&
|
||||||
att->Renderbuffer->_BaseFormat != GL_RGBA) {
|
att->Renderbuffer->_BaseFormat != GL_RGBA) {
|
||||||
|
ASSERT(att->Renderbuffer->RedBits);
|
||||||
|
ASSERT(att->Renderbuffer->GreenBits);
|
||||||
|
ASSERT(att->Renderbuffer->BlueBits);
|
||||||
att->Complete = GL_FALSE;
|
att->Complete = GL_FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (format == GL_DEPTH) {
|
else if (format == GL_DEPTH) {
|
||||||
|
ASSERT(att->Renderbuffer->DepthBits);
|
||||||
if (att->Renderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) {
|
if (att->Renderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) {
|
||||||
/* OK */
|
/* OK */
|
||||||
}
|
}
|
||||||
@@ -343,6 +350,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(format == GL_STENCIL);
|
assert(format == GL_STENCIL);
|
||||||
|
ASSERT(att->Renderbuffer->StencilBits);
|
||||||
if (att->Renderbuffer->_BaseFormat == GL_STENCIL_INDEX) {
|
if (att->Renderbuffer->_BaseFormat == GL_STENCIL_INDEX) {
|
||||||
/* OK */
|
/* OK */
|
||||||
}
|
}
|
||||||
@@ -364,6 +372,18 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helpful for debugging
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
fbo_incomplete(const char *msg, int index)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
_mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, 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.
|
||||||
@@ -394,6 +414,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
test_attachment_completeness(ctx, GL_DEPTH, att);
|
test_attachment_completeness(ctx, GL_DEPTH, att);
|
||||||
if (!att->Complete) {
|
if (!att->Complete) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
|
||||||
|
fbo_incomplete("depth attachment incomplete", -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,6 +423,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
test_attachment_completeness(ctx, GL_STENCIL, att);
|
test_attachment_completeness(ctx, GL_STENCIL, att);
|
||||||
if (!att->Complete) {
|
if (!att->Complete) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
|
||||||
|
fbo_incomplete("stencil attachment incomplete", -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,6 +432,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
test_attachment_completeness(ctx, GL_COLOR, att);
|
test_attachment_completeness(ctx, GL_COLOR, att);
|
||||||
if (!att->Complete) {
|
if (!att->Complete) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
|
||||||
|
fbo_incomplete("color attachment incomplete", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,6 +447,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT) {
|
if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT) {
|
||||||
/* XXX need GL_DEPTH_STENCIL_EXT test? */
|
/* XXX need GL_DEPTH_STENCIL_EXT test? */
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
|
||||||
|
fbo_incomplete("texture attachment incomplete", -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -449,10 +473,12 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
/* check that width, height, format are same */
|
/* check that width, height, format are same */
|
||||||
if (w != width || h != height) {
|
if (w != width || h != height) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT;
|
||||||
|
fbo_incomplete("width or height mismatch", -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (intFormat != GL_NONE && f != intFormat) {
|
if (intFormat != GL_NONE && f != intFormat) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
|
||||||
|
fbo_incomplete("format mismatch", -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -466,6 +492,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
assert(att);
|
assert(att);
|
||||||
if (att->Type == GL_NONE) {
|
if (att->Type == GL_NONE) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
|
||||||
|
fbo_incomplete("missing drawbuffer", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,6 +505,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
assert(att);
|
assert(att);
|
||||||
if (att->Type == GL_NONE) {
|
if (att->Type == GL_NONE) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT;
|
||||||
|
fbo_incomplete("missing readbuffer", -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,6 +522,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
struct gl_renderbuffer *rb_j = fb->Attachment[j].Renderbuffer;
|
struct gl_renderbuffer *rb_j = fb->Attachment[j].Renderbuffer;
|
||||||
if (rb_i == rb_j && rb_i->_BaseFormat != GL_DEPTH_STENCIL_EXT) {
|
if (rb_i == rb_j && rb_i->_BaseFormat != GL_DEPTH_STENCIL_EXT) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT;
|
||||||
|
fbo_incomplete("multiply bound renderbuffer", -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -503,6 +532,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||||||
|
|
||||||
if (numImages == 0) {
|
if (numImages == 0) {
|
||||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
|
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
|
||||||
|
fbo_incomplete("no attachments", -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user