[Piglit] [PATCH] gl-1.0-blend-func: skip some blend tests when using LLVM 3.8

Brian Paul brianp at vmware.com
Thu Jan 18 19:07:34 UTC 2018


To avoid an infinite loop.  See code comments for details.
---
 tests/spec/gl-1.0/blend.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c
index 35e940f..e69ed31 100644
--- a/tests/spec/gl-1.0/blend.c
+++ b/tests/spec/gl-1.0/blend.c
@@ -76,6 +76,9 @@ static int test_stride = 1;
 #define img_width drawing_size
 #define img_height drawing_size
 
+static bool using_llvm_3_8 = false;
+
+
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
 	config.supports_gl_compat_version = 10;
@@ -177,6 +180,10 @@ image_init(struct image *image)
 		     GL_RGBA, GL_FLOAT, image->data);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+	if (strstr("LLVM 3.8", (const char *) glGetString(GL_RENDERER)) == 0) {
+		using_llvm_3_8 = true;
+	}
 } /* image_init */
 
 
@@ -532,6 +539,32 @@ apply_blend(GLenum src_factor_rgb, GLenum src_factor_a,
 } /* apply_blend */
 
 
+/**
+ * With unpactched LLVM 3.8, llvmpipe can hit an bug in LLVM which results
+ * in an infinite loop.  See https://bugs.llvm.org/show_bug.cgi?id=27689
+ * This function tries to determine if the test case will hit that bug so
+ * we can skip the test.
+ */
+bool
+skip_on_llvmpipe(GLenum src_factor_rgb, GLenum src_factor_a,
+				 GLenum dst_factor_rgb, GLenum dst_factor_a)
+{
+	if (!using_llvm_3_8)
+		return false;
+
+	/* This could probably be a bit tighter, but this seems to catch
+	 * the troublesome cases.
+	 */
+	if (src_factor_rgb == GL_CONSTANT_COLOR ||
+		dst_factor_rgb == GL_CONSTANT_COLOR ||
+		dst_factor_a == GL_CONSTANT_COLOR ||
+		dst_factor_a == GL_CONSTANT_ALPHA)
+		return true;
+
+	return false;
+}
+
+
 /* Test for one set of factor levels */
 bool
 run_factor_set(GLenum src_factor_rgb, GLenum src_factor_a,
@@ -542,6 +575,12 @@ run_factor_set(GLenum src_factor_rgb, GLenum src_factor_a,
 	int i, j;
 	bool pass = true, p;
 
+	if (skip_on_llvmpipe(src_factor_rgb, src_factor_a,
+						 dst_factor_rgb, dst_factor_a)) {
+		/*printf("Skipping Blend test to avoid LLVM bug\n");*/
+		return true;
+	}
+
 	glDisable(GL_DITHER);
 	glClear(GL_COLOR_BUFFER_BIT);
 
-- 
2.7.4



More information about the Piglit mailing list