[Piglit] [PATCH 1/3] Test downsampling blits in GL_LINEAR filter mode.
Paul Berry
stereotype441 at gmail.com
Sun Oct 27 15:50:45 CET 2013
Since downsampling blits require the source and destination rectangles
to be exactly the same size, GL_LINEAR and GL_NEAREST filtering should
be equivalent. So just add an option to the "accuracy" test that
causes it to do a GL_LINEAR downsampling blit.
---
tests/all.tests | 5 ++++-
tests/spec/ext_framebuffer_multisample/accuracy.cpp | 9 +++++++--
tests/spec/ext_framebuffer_multisample/common.cpp | 10 ++++++----
tests/spec/ext_framebuffer_multisample/common.h | 9 +++++++--
tests/spec/ext_framebuffer_multisample/turn-on-off.cpp | 3 ++-
5 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/tests/all.tests b/tests/all.tests
index 9502ead..6b04c64 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1701,7 +1701,10 @@ ext_framebuffer_multisample['alpha-blending'] = PlainExecTest('ext_framebuffer_m
for num_samples in MSAA_SAMPLE_COUNTS:
for test_type in ('color', 'srgb', 'stencil_draw', 'stencil_resolve',
'depth_draw', 'depth_resolve'):
- for options in power_set(('small', 'depthstencil')):
+ sensible_options = ['small', 'depthstencil']
+ if test_type in ('color', 'srgb'):
+ sensible_options.append('linear')
+ for options in power_set(sensible_options):
test_name = ' '.join(['accuracy', str(num_samples), test_type]
+ options)
executable = 'ext_framebuffer_multisample-{0} -auto'.format(
diff --git a/tests/spec/ext_framebuffer_multisample/accuracy.cpp b/tests/spec/ext_framebuffer_multisample/accuracy.cpp
index 9ff36d9..2c0d445 100644
--- a/tests/spec/ext_framebuffer_multisample/accuracy.cpp
+++ b/tests/spec/ext_framebuffer_multisample/accuracy.cpp
@@ -71,7 +71,8 @@ print_usage_and_exit(char *prog_name)
" depth_resolve: test resolve of MSAA depth buffer\n"
"Available options:\n"
" small: use a very small (16x16) MSAA buffer\n"
- " depthstencil: use a combined depth/stencil buffer\n",
+ " depthstencil: use a combined depth/stencil buffer\n"
+ " linear: use GL_LINEAR filter mode\n",
prog_name);
piglit_report_result(PIGLIT_FAIL);
}
@@ -83,6 +84,7 @@ piglit_init(int argc, char **argv)
int i, num_samples;
bool small = false;
bool combine_depth_stencil = false;
+ GLenum filter_mode = GL_NEAREST;
if (argc < 3)
print_usage_and_exit(argv[0]);
@@ -98,6 +100,8 @@ piglit_init(int argc, char **argv)
small = true;
} else if (strcmp(argv[i], "depthstencil") == 0) {
combine_depth_stencil = true;
+ } else if (strcmp(argv[i], "linear") == 0) {
+ filter_mode = GL_LINEAR;
} else {
print_usage_and_exit(argv[0]);
}
@@ -130,7 +134,8 @@ piglit_init(int argc, char **argv)
}
test = create_test(test_type, num_samples, small,
combine_depth_stencil,
- pattern_width, pattern_height, supersample_factor);
+ pattern_width, pattern_height, supersample_factor,
+ filter_mode);
}
enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp
index 80e95c1..5d4a0be 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -266,12 +266,14 @@ Test::Test(TestPattern *pattern, ManifestProgram *manifest_program,
void
Test::init(int num_samples, bool small, bool combine_depth_stencil,
- int pattern_width, int pattern_height, int supersample_factor)
+ int pattern_width, int pattern_height, int supersample_factor,
+ GLenum filter_mode)
{
this->num_samples = num_samples;
this->pattern_width = pattern_width;
this->pattern_height = pattern_height;
this->supersample_factor = supersample_factor;
+ this->filter_mode = filter_mode;
FboConfig test_fbo_config(0,
small ? 16 : pattern_width,
@@ -322,7 +324,7 @@ Test::resolve(Fbo *fbo, GLbitfield which_buffers)
glBlitFramebuffer(0, 0, fbo->config.width, fbo->config.height,
0, 0, resolve_fbo.config.width,
resolve_fbo.config.height,
- which_buffers, GL_NEAREST);
+ which_buffers, filter_mode);
}
/**
@@ -569,7 +571,7 @@ Test::run()
Test *
create_test(test_type_enum test_type, int n_samples, bool small,
bool combine_depth_stencil, int pattern_width, int pattern_height,
- int supersample_factor)
+ int supersample_factor, GLenum filter_mode)
{
Test *test = NULL;
switch (test_type) {
@@ -608,6 +610,6 @@ create_test(test_type_enum test_type, int n_samples, bool small,
}
test->init(n_samples, small, combine_depth_stencil, pattern_width,
- pattern_height, supersample_factor);
+ pattern_height, supersample_factor, filter_mode);
return test;
}
diff --git a/tests/spec/ext_framebuffer_multisample/common.h b/tests/spec/ext_framebuffer_multisample/common.h
index 7e26a45..f793835 100644
--- a/tests/spec/ext_framebuffer_multisample/common.h
+++ b/tests/spec/ext_framebuffer_multisample/common.h
@@ -101,7 +101,7 @@ public:
bool test_resolve, GLbitfield blit_type, bool srgb);
void init(int num_samples, bool small, bool combine_depth_stencil,
int pattern_width, int pattern_height,
- int supersample_factor);
+ int supersample_factor, GLenum filter_mode);
bool run();
void draw_test_image(piglit_util_fbo::Fbo *fbo);
void draw_to_default_framebuffer();
@@ -173,9 +173,14 @@ private:
int supersample_factor;
bool srgb;
DownsampleProg downsample_prog;
+
+ /**
+ * Filter mode to use when downsampling the image
+ */
+ GLenum filter_mode;
};
Test *
create_test(test_type_enum test_type, int n_samples, bool small,
bool combine_depth_stencil, int pattern_width,
- int pattern_height, int supersample_factor);
+ int pattern_height, int supersample_factor, GLenum filter_mode);
diff --git a/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp b/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
index 6843cac..44211be 100644
--- a/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
+++ b/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
@@ -151,5 +151,6 @@ piglit_init(int argc, char **argv)
false /*small*/,
true /* combine_depth_stencil */,
pattern_width, pattern_height,
- 16 /* supersample_factor */);
+ 16 /* supersample_factor */,
+ GL_NEAREST);
}
--
1.8.4.1
More information about the Piglit
mailing list