[Mesa-dev] [PATCH] util: fix regression with ubyte probing

Marek Olšák maraeo at gmail.com
Thu Apr 21 15:39:39 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

clearbuffer-mixed-format regressed, because GL_RED_BITS doesn't have
anything to do with the read buffer.
---
 tests/util/piglit-util-gl.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 09eb99d..2f5175b 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1063,12 +1063,25 @@ piglit_read_pixels_float(GLint x, GLint y, GLsizei width, GLsizei height,
 static bool
 piglit_can_probe_ubyte()
 {
-	int r,g,b,a;
+	int r,g,b,a,read;
 
-	glGetIntegerv(GL_RED_BITS, &r);
-	glGetIntegerv(GL_GREEN_BITS, &g);
-	glGetIntegerv(GL_BLUE_BITS, &b);
-	glGetIntegerv(GL_ALPHA_BITS, &a);
+	if (!piglit_is_extension_supported("GL_ARB_framebuffer_object"))
+		return false;
+
+	glGetIntegerv(GL_READ_BUFFER, &read);
+	if (read == GL_FRONT)
+		read = GL_FRONT_LEFT;
+	if (read == GL_BACK)
+		read = GL_BACK_LEFT;
+
+	glGetFramebufferAttachmentParameteriv(GL_READ_FRAMEBUFFER, read,
+					      GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &r);
+	glGetFramebufferAttachmentParameteriv(GL_READ_FRAMEBUFFER, read,
+					      GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, &g);
+	glGetFramebufferAttachmentParameteriv(GL_READ_FRAMEBUFFER, read,
+					      GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, &b);
+	glGetFramebufferAttachmentParameteriv(GL_READ_FRAMEBUFFER, read,
+					      GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &a);
 
 	/* it could be LUMINANCE32F, etc. */
 	if (!r && !g && !b && !a)
-- 
2.5.0



More information about the mesa-dev mailing list