[Piglit] [PATCH 1/2] ext_framebuffer_multisample: Add an option to disable draw buffer zero write

Anuj Phogat anuj.phogat at gmail.com
Wed Nov 2 21:36:19 UTC 2016


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 .../alpha-to-coverage-dual-src-blend.cpp                    |  3 ++-
 .../alpha-to-coverage-no-draw-buffer-zero.cpp               |  3 ++-
 .../alpha-to-one-dual-src-blend.cpp                         |  3 ++-
 .../alpha-to-one-msaa-disabled.cpp                          |  3 ++-
 .../alpha-to-one-single-sample-buffer.cpp                   |  3 ++-
 .../draw-buffers-alpha-to-coverage.cpp                      |  3 ++-
 .../draw-buffers-alpha-to-one.cpp                           |  3 ++-
 .../ext_framebuffer_multisample/draw-buffers-common.cpp     | 13 ++++++++++---
 .../spec/ext_framebuffer_multisample/draw-buffers-common.h  |  4 +++-
 .../int-draw-buffers-alpha-to-coverage.cpp                  |  3 ++-
 .../int-draw-buffers-alpha-to-one.cpp                       |  3 ++-
 .../sample-alpha-to-coverage.cpp                            |  3 ++-
 .../ext_framebuffer_multisample/sample-alpha-to-one.cpp     |  3 ++-
 13 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend.cpp b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend.cpp
index 7770a6b..777af0c 100644
--- a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend.cpp
+++ b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend.cpp
@@ -93,7 +93,8 @@ piglit_init(int argc, char **argv)
 				      GL_RGBA);
 
 	shader_compile(true /* sample_alpha_to_coverage */,
-		       true /* dual_src_blend */);
+		       true /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero.cpp b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero.cpp
index ed9b6f0..832fba4 100644
--- a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero.cpp
+++ b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero.cpp
@@ -106,7 +106,8 @@ piglit_init(int argc, char **argv)
 				      GL_COLOR_BUFFER_BIT,
 				      GL_NONE /* color_buffer_zero_format */);
 	shader_compile(true /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/alpha-to-one-dual-src-blend.cpp b/tests/spec/ext_framebuffer_multisample/alpha-to-one-dual-src-blend.cpp
index 9734333..c2adeb5 100644
--- a/tests/spec/ext_framebuffer_multisample/alpha-to-one-dual-src-blend.cpp
+++ b/tests/spec/ext_framebuffer_multisample/alpha-to-one-dual-src-blend.cpp
@@ -93,7 +93,8 @@ piglit_init(int argc, char **argv)
 				      GL_RGBA);
 
 	shader_compile(false /* sample_alpha_to_coverage */,
-		       true /* dual_src_blend */);
+		       true /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/alpha-to-one-msaa-disabled.cpp b/tests/spec/ext_framebuffer_multisample/alpha-to-one-msaa-disabled.cpp
index b7b4e9e..f7da4b8 100644
--- a/tests/spec/ext_framebuffer_multisample/alpha-to-one-msaa-disabled.cpp
+++ b/tests/spec/ext_framebuffer_multisample/alpha-to-one-msaa-disabled.cpp
@@ -96,7 +96,8 @@ piglit_init(int argc, char **argv)
 				      GL_COLOR_BUFFER_BIT,
 				      GL_RGBA);
 	shader_compile(false /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/alpha-to-one-single-sample-buffer.cpp b/tests/spec/ext_framebuffer_multisample/alpha-to-one-single-sample-buffer.cpp
index 262f41a..149f737 100644
--- a/tests/spec/ext_framebuffer_multisample/alpha-to-one-single-sample-buffer.cpp
+++ b/tests/spec/ext_framebuffer_multisample/alpha-to-one-single-sample-buffer.cpp
@@ -81,7 +81,8 @@ piglit_init(int argc, char **argv)
 				      GL_COLOR_BUFFER_BIT,
 				      GL_RGBA);
 	shader_compile(false /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-coverage.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-coverage.cpp
index 907d421..fe6a4fa 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-coverage.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-coverage.cpp
@@ -104,7 +104,8 @@ piglit_init(int argc, char **argv)
 				      GL_COLOR_BUFFER_BIT,
 				      GL_RGBA);
 	shader_compile(true /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-one.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-one.cpp
index d48e311..a9813ec 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-one.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-one.cpp
@@ -125,7 +125,8 @@ piglit_init(int argc, char **argv)
 				      GL_COLOR_BUFFER_BIT,
 				      GL_RGBA);
 	shader_compile(false /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
index 893b486..bf0d429 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
@@ -128,6 +128,7 @@ static const char *frag_template =
 	"#define DUAL_SRC_BLEND %d\n"
 	"#define ALPHA_TO_COVERAGE %d\n"
 	"#define OUT_TYPE %s\n"
+	"#define FRAG_OUT_ZERO_WRITE %d\n"
 	"#if __VERSION__ == 130\n"
 	"out OUT_TYPE frag_out_0;\n"
 	"#if DUAL_SRC_BLEND\n"
@@ -147,7 +148,9 @@ static const char *frag_template =
 	"uniform vec4 color;\n"
 	"void main()\n"
 	"{\n"
-	"  frag_out_0 = frag_0_color;\n"
+	"  #if FRAG_OUT_ZERO_WRITE\n"
+	"    frag_out_0 = frag_0_color;\n"
+	"  #endif\n"
 	"  #if DUAL_SRC_BLEND\n"
 	"    frag_out_1 = vec4(color.rgb, 1.0 - color.a / 2.0);\n"
 	"  #elif ALPHA_TO_COVERAGE && NUM_ATTACHMENTS > 1\n"
@@ -167,7 +170,9 @@ get_out_type_glsl(void)
 		return "vec4";
 }
 void
-shader_compile(bool sample_alpha_to_coverage, bool dual_src_blend)
+shader_compile(bool sample_alpha_to_coverage,
+	       bool dual_src_blend,
+	       bool frag_out_zero_write)
 {
 	bool need_glsl130 = is_buffer_zero_integer_format || dual_src_blend;
 
@@ -192,7 +197,9 @@ shader_compile(bool sample_alpha_to_coverage, bool dual_src_blend)
 	sprintf(frag, frag_template, need_glsl130 ? "130" : "120",
 		num_draw_buffers,
 		is_dual_src_blending,
-		sample_alpha_to_coverage, out_type_glsl);
+		sample_alpha_to_coverage,
+		out_type_glsl,
+		frag_out_zero_write);
 
 	GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
 	prog = piglit_link_simple_program(vs, fs);
diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.h b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.h
index 43a8e42..5620fbe 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.h
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.h
@@ -63,4 +63,6 @@ bool probe_framebuffer_color(void);
  */
 bool probe_framebuffer_depth(void);
 
-void shader_compile(bool sample_alpha_to_coverage, bool dual_src_blend);
+void shader_compile(bool sample_alpha_to_coverage,
+		    bool dual_src_blend,
+		    bool frag_out_zero_write);
diff --git a/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-coverage.cpp b/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-coverage.cpp
index 25585c2..509d7a6 100644
--- a/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-coverage.cpp
+++ b/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-coverage.cpp
@@ -103,7 +103,8 @@ piglit_init(int argc, char **argv)
 				      GL_COLOR_BUFFER_BIT,
 				      GL_RGBA8I);
 	shader_compile(true /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-one.cpp b/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-one.cpp
index 26c6ffa..608455d 100644
--- a/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-one.cpp
+++ b/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-one.cpp
@@ -100,7 +100,8 @@ piglit_init(int argc, char **argv)
 				      GL_COLOR_BUFFER_BIT,
 				      GL_RGBA8I);
 	shader_compile(false /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
index 46bf6f0..7b756ba 100644
--- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
+++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
@@ -114,7 +114,8 @@ piglit_init(int argc, char **argv)
 				      buffer_to_test,
 				      GL_RGBA);
 	shader_compile(true /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-one.cpp b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-one.cpp
index 3f2dc3a..451686c 100644
--- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-one.cpp
+++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-one.cpp
@@ -96,7 +96,8 @@ piglit_init(int argc, char **argv)
 				      GL_COLOR_BUFFER_BIT,
 				      GL_RGBA);
 	shader_compile(false /* sample_alpha_to_coverage */,
-		       false /* dual_src_blend */);
+		       false /* dual_src_blend */,
+		       true /* frag_out_zero_write */);
 }
 
 enum piglit_result
-- 
2.5.5



More information about the Piglit mailing list