diff options
author | Chris Forbes <chrisf@ijw.co.nz> | 2014-03-25 18:33:51 +1300 |
---|---|---|
committer | Chris Forbes <chrisf@ijw.co.nz> | 2014-04-01 09:13:12 +1300 |
commit | 173b7b797c3babe4b155f43d1b36cc03697366c7 (patch) | |
tree | 1c4b38d80d93213d3f9b724f02ef749201a3a0ba /tests/glean | |
parent | 60ed009b48cc35ebdd74b11fe8ca2002067698f6 (diff) |
glean: Fix fbo errors case
If the framebuffer has no attachments at all, the first incomplete
status generated is FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT.
Adjust the tests for FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER and
FRAMEBUFFER_INCOMPLETE_READ_BUFFER to avoid tripping over this, by
adding a depth renderbuffer attachment.
This extra attachment is chosen to avoid imposing additional
requirements -- multiple color attachments are not required, nor
are depth textures.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76579
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'tests/glean')
-rw-r--r-- | tests/glean/tfbo.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/glean/tfbo.cpp b/tests/glean/tfbo.cpp index d39eb6f19..fcf457f4b 100644 --- a/tests/glean/tfbo.cpp +++ b/tests/glean/tfbo.cpp @@ -1218,6 +1218,7 @@ FBOTest::testErrorHandling(void) { GLuint fbs[1]; GLuint textures[2]; + GLuint renderbuffer; GLenum status; bool have_ARB_ES2 = GLUtils::haveExtension("GL_ARB_ES2_compatibility"); @@ -1309,13 +1310,25 @@ FBOTest::testErrorHandling(void) // The value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT must not // be NONE for any color attachment point(s) named by // DRAW_BUFFERi. + // [Note: to avoid being caught by the no-attachments + // case above, we attach a depth renderbuffer.] glGenFramebuffersEXT(1, fbs); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbs[0]); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + maxColorAttachment - 1); + glGenRenderbuffers(1, &renderbuffer); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, renderbuffer); + glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, + TEXSIZE, TEXSIZE); + glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, + GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, + renderbuffer); status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glDeleteFramebuffersEXT(1, fbs); + glDeleteTextures(1, textures); + glDeleteRenderbuffers(1, &renderbuffer); if (status != GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT && !have_ARB_ES2) { REPORT_FAILURE @@ -1326,14 +1339,25 @@ FBOTest::testErrorHandling(void) // If READ_BUFFER is not NONE, then the value of // FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT must not be NONE for // the color attachment point named by READ_BUFFER. + // [Note: to avoid being caught by the no-attachments + // case above, we attach a depth renderbuffer.] glGenFramebuffersEXT(1, fbs); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbs[0]); glDrawBuffer(GL_NONE); glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + maxColorAttachment - 1); + glGenRenderbuffers(1, &renderbuffer); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, renderbuffer); + glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, + TEXSIZE, TEXSIZE); + glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, + GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, + renderbuffer); status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glDeleteFramebuffersEXT(1, fbs); + glDeleteRenderbuffers(1, &renderbuffer); if (status != GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT && !have_ARB_ES2) { REPORT_FAILURE |