[Piglit] [PATCH] glean: Fix fbo errors case

Brian Paul brianp at vmware.com
Tue Mar 25 07:06:17 PDT 2014


On 03/24/2014 11:33 PM, Chris Forbes wrote:
> 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://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D76579&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=dVqBvcr8u%2B3rKyetbSNK3NL5z3SozJ%2F1seIawLk35zE%3D%0A&s=79040d92c297b5a7022b2e5b7e3e84cc7b046ae21a6a6c8f22504ee117b6a3b8
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>   tests/glean/tfbo.cpp | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
>
> diff --git a/tests/glean/tfbo.cpp b/tests/glean/tfbo.cpp
> index d39eb6f..fcf457f 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
>

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the Piglit mailing list