[Piglit] [PATCH] ext_framebuffer_multisample: Fix dual source blending tests

Anuj Phogat anuj.phogat at gmail.com
Mon Jun 29 15:51:23 PDT 2015


alpha-to-coverage-dual-src-blend tests were broken after
commit 44456ba. This patch fixes the tests by allowing
frag_out_1 for dual-src-blend tests even with
NUM_ATTACHMENTS == 1. In case of dual source blending both
frag_out_0 and frag_out_1 go to color buffer 0 with color
index 0 and 1 respectively.
See glBindFragDataLocationIndexed() for details.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91151
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Cc: Eric Anholt <eric at anholt.net>
Cc: Mark Janes <mark.a.janes at intel.com>
---
 tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
index 0d5adef..893b486 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
@@ -130,8 +130,12 @@ static const char *frag_template =
 	"#define OUT_TYPE %s\n"
 	"#if __VERSION__ == 130\n"
 	"out OUT_TYPE frag_out_0;\n"
+	"#if DUAL_SRC_BLEND\n"
+	"out vec4 frag_out_1;\n"
+	"#elif NUM_ATTACHMENTS > 1\n"
 	"out vec4 frag_out_1;\n"
 	"out vec4 frag_out_2;\n"
+	"#endif\n"
 	"#else\n"
 	"#define frag_out_0 gl_FragData[0]\n"
 	"#if NUM_ATTACHMENTS > 1\n"
@@ -144,16 +148,14 @@ static const char *frag_template =
 	"void main()\n"
 	"{\n"
 	"  frag_out_0 = frag_0_color;\n"
-	"#if NUM_ATTACHMENTS > 1\n"
 	"  #if DUAL_SRC_BLEND\n"
 	"    frag_out_1 = vec4(color.rgb, 1.0 - color.a / 2.0);\n"
-	"  #elif ALPHA_TO_COVERAGE\n"
+	"  #elif ALPHA_TO_COVERAGE && NUM_ATTACHMENTS > 1\n"
 	"    frag_out_1 = vec4(color.rgb, color.a / 2);\n"
 	"    frag_out_2 = vec4(color.rgb, color.a / 4);\n"
-	"  #else\n"
+	"  #elif NUM_ATTACHMENTS > 1\n"
 	"    frag_out_1 = frag_out_2 = color;\n"
 	"  #endif\n"
-	" #endif\n"
 	"}\n";
 
 const char *
-- 
1.9.3



More information about the Piglit mailing list