Make sure piglit_set_tolerance_for_bits() doesn't ask for a alpha tolerance impossible to achieve for the given alpha bit depth of the context, e.g., in case of 2 bit alpha channels with ARGB2101010 visuals or fbconfigs.
Signed-off-by: Mario Kleiner <mario.kleiner...@gmail.com> --- tests/util/piglit-framework-gl/piglit_winsys_framework.c | 6 +++++- tests/util/piglit-util-gl.c | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c b/tests/util/piglit-framework-gl/piglit_winsys_framework.c index 5713f5c..9dc4944 100644 --- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c +++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c @@ -56,7 +56,6 @@ run_test(struct piglit_gl_framework *gl_fw, bool no_window = false; const char *env_no_window = getenv("PIGLIT_NO_WINDOW"); - if (env_no_window != NULL) { if (strcmp(env_no_window, "0") == 0) { no_window = false; @@ -69,6 +68,11 @@ run_test(struct piglit_gl_framework *gl_fw, } } + /* Init tolerance. This will make sure we don't request too strict + * tolerance for contexts alpha bit depth. + */ + piglit_set_tolerance_for_bits(8, 8, 8, 8); + if (gl_fw->test_config->init) gl_fw->test_config->init(argc, argv); diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index d8b8f85..8b16482 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -278,6 +278,13 @@ piglit_set_tolerance_for_bits(int rbits, int gbits, int bbits, int abits) int bits[4] = {rbits, gbits, bbits, abits}; int i; + /* Make sure we don't set a alpha tolerance impossible to achieve with + * given alpha channel bit depths. + */ + glGetIntegerv(GL_ALPHA_BITS, &abits); + if (abits < bits[3]) + bits[3] = abits; + for (i = 0; i < 4; i++) { if (bits[i] == 0) { /* With 0 bits of storage, we still want to -- 2.7.4 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit