[Piglit] [PATCH 1/2] msaa: Make few changes to shared code to accomodate no-draw-buffer-zero test
Anuj Phogat
anuj.phogat at gmail.com
Mon Jul 23 15:27:23 PDT 2012
These changes are required to enable no-draw-buffer-zero test case to use the
shared code.
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
.../draw-buffers-common.cpp | 24 +++++++++++++++----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
index 2829405..9158a0b 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
@@ -88,6 +88,7 @@ static int pattern_width;
static int pattern_height;
static bool is_buffer_zero_integer_format = false;
+static GLenum draw_buffer_zero_format;
static const int num_components = 4; /* for RGBA formats */
static const int num_color_bits = 8; /* for GL_RGBA & GL_RGBA8I formats */
@@ -440,10 +441,16 @@ compute_expected(bool sample_alpha_to_coverage,
coverage[i] = 1.0;
}
- if (buffer_to_test == GL_COLOR_BUFFER_BIT)
- compute_expected_color(sample_alpha_to_coverage,
- sample_alpha_to_one,
- draw_buffer_count);
+ if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+ /* Don't compute expected color for color buffer zero
+ * if no renderbuffer is attached to it.
+ */
+ if(draw_buffer_count ||
+ draw_buffer_zero_format != GL_NONE)
+ compute_expected_color(sample_alpha_to_coverage,
+ sample_alpha_to_one,
+ draw_buffer_count);
+ }
else if (buffer_to_test == GL_DEPTH_BUFFER_BIT)
compute_expected_depth();
@@ -461,6 +468,11 @@ probe_framebuffer_color(void)
int rect_height = pattern_height / num_rects;
for (int i = 0; i < num_draw_buffers; i++) {
+ /* Don't probe color buffer zero if no renderbuffer is
+ * attached to it.
+ */
+ if( i == 0 && draw_buffer_zero_format == GL_NONE)
+ continue;
bool is_integer_operation = is_buffer_zero_integer_format && !i;
if(is_integer_operation) {
@@ -730,6 +742,7 @@ ms_fbo_and_draw_buffers_setup(int samples,
pattern_width = width;
pattern_height = height;
+ draw_buffer_zero_format = color_buffer_zero_format;
/* Setup frame buffer objects with required configuration */
FboConfig ms_config(samples, pattern_width, pattern_height);
@@ -752,7 +765,8 @@ ms_fbo_and_draw_buffers_setup(int samples,
resolve_int_fbo.setup(resolve_config);
is_buffer_zero_integer_format = true;
}
- else if (color_buffer_zero_format != GL_RGBA){
+ else if (color_buffer_zero_format != GL_RGBA &&
+ color_buffer_zero_format != GL_NONE) {
printf("Draw buffer zero format is not"
" supported by test functions.\n");
piglit_report_result(PIGLIT_FAIL);
--
1.7.7.6
More information about the Piglit
mailing list