[Piglit] [PATCH] util: Fix visual selection when using waffle

Chad Versace chad.versace at linux.intel.com
Mon Oct 15 11:41:20 PDT 2012


Only request a visual with alpha if the test requests
PIGLIT_GL_VISUAL_ALPHA.

When I wrote the waffle backend, I misunderstood the meaning of GLUT_RGBA.
I interpreted GLUT_RGBA to indicate a request for a visual with all of
RGBA channels present. Actually, it just indicates a request for a visual
with RGBA color model, as opposed to GLUT_LUMINANCE and GLUT_INDEX.

Fixes regression in fs-texelFetchOffest-2D.

Reported-by: Marek Olšák <maraeo at gmail.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/util/piglit-framework-gl.h                         |  8 ++++++++
 tests/util/piglit-framework-gl/piglit_winsys_framework.c | 11 +++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h
index 3ac0849..326bdbf 100644
--- a/tests/util/piglit-framework-gl.h
+++ b/tests/util/piglit-framework-gl.h
@@ -34,6 +34,14 @@
  * Each enum has the same value of its corresponding GLUT enum. That is, for
  * each X, `PIGLIT_GL_VISUAL_X == GLUT_X`.
  *
+ * Note that PIGLIT_GL_VISUAL_RGBA is an alias for PIGLIT_GL_VISUAL_RGB and is
+ * always selected.  From the documentation of glutInitDisplayMode in
+ * Kilgard's GLUT:
+ *
+ *     Note that GLUT_RGBA selects the RGBA color model, but it does not
+ *     request any bits of alpha (sometimes called an alpha buffer or
+ *     destination alpha) be allocated. To request alpha, specify GLUT_ALPHA.
+ *
  * \see piglit_gl_test_config::window_visual
  */
 enum piglit_gl_visual {
diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
index fc08bbc..020321b 100644
--- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
@@ -82,18 +82,17 @@ choose_config_attribs(const struct piglit_gl_test_config *test_config)
 	static int32_t attrib_list[64];
 	int i = 0;
 
-	/* It is impossible to not request RGBA because PIGLIT_GL_VISUAL_RGB and
-	 * PIGLIT_GL_VISUAL_RGBA are both 0. That is, (display_mode & (PIGLIT_GL_VISUAL_RGB
-	 * | PIGLIT_GL_VISUAL_RGBA)) is unconditonally true.
-	 */
 	attrib_list[i++] = WAFFLE_RED_SIZE;
 	attrib_list[i++] = 1;
 	attrib_list[i++] = WAFFLE_GREEN_SIZE;
 	attrib_list[i++] = 1;
 	attrib_list[i++] = WAFFLE_BLUE_SIZE;
 	attrib_list[i++] = 1;
-	attrib_list[i++] = WAFFLE_ALPHA_SIZE;
-	attrib_list[i++] = 1;
+
+	if (test_config->window_visual & PIGLIT_GL_VISUAL_ALPHA) {
+		attrib_list[i++] = WAFFLE_ALPHA_SIZE;
+		attrib_list[i++] = 1;
+	}
 
 	if (test_config->window_visual & PIGLIT_GL_VISUAL_DEPTH) {
 		attrib_list[i++] = WAFFLE_DEPTH_SIZE;
-- 
1.7.11.7



More information about the Piglit mailing list