[Piglit] [PATCH 2/2] arb_color_buffer_float: Don't try to use MRT if number of draw buffers is 1.

Eric Anholt eric at anholt.net
Sun Feb 1 14:22:02 PST 2015


The ARB_draw_buffers spec allows GL_MAX_DRAW_BUFFERS == 1, which means
that our GL_COLOR_ATTACHMENT1 usage will throw a GL error.

Fixes ARB_color_buffer_float/GL_RGBA8-queries on VC4.
---
 tests/spec/arb_color_buffer_float/common.h | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_color_buffer_float/common.h b/tests/spec/arb_color_buffer_float/common.h
index bc3bf45..da59df9 100644
--- a/tests/spec/arb_color_buffer_float/common.h
+++ b/tests/spec/arb_color_buffer_float/common.h
@@ -172,13 +172,21 @@ static GLboolean run_test()
 	}
 	else
 	{
-		enum test_mode_type mrt_modes = (piglit_is_extension_supported("GL_ARB_draw_buffers") ?
-						 (piglit_is_extension_supported("GL_ARB_texture_float") ?
-						  TEST_SRT_MRT :
-						  TEST_MRT) :
-						 TEST_SRT);
+		enum test_mode_type mrt_modes;
 		enum test_mode_type first_mrt_mode = (test_mode == TEST_MRT) ? TEST_SRT : TEST_NO_RT;
 
+		mrt_modes = TEST_SRT_MRT;
+		if (!piglit_is_extension_supported("GL_ARB_texture_float"))
+			mrt_modes = TEST_MRT;
+		if (!piglit_is_extension_supported("GL_ARB_draw_buffers"))
+			mrt_modes = TEST_SRT;
+		else {
+			GLint val;
+			glGetIntegerv(GL_MAX_DRAW_BUFFERS, &val);
+			if (val < 2)
+				mrt_modes = TEST_SRT;
+		}
+
 		for (mrt_mode = first_mrt_mode; mrt_mode < mrt_modes; ++mrt_mode)
 		{
 			fixed1 = fixed;
-- 
2.1.4



More information about the Piglit mailing list