[Piglit] [PATCH 2/2] teximage-colors: Improve --benchmark option
Jason Ekstrand
jason at jlekstrand.net
Fri Jan 9 14:53:26 PST 2015
This commit does a couple of things. First, we increase the size of the
texture uploaded while benchmarking to 1024 square to reduce the affect of
set-up overhead. Second, we do a render and then call glFinish at the end
of the upload loop to ensure that things actually get flushed through the
GPU and GPU time is included in the test.
---
tests/texturing/teximage-colors.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/tests/texturing/teximage-colors.c b/tests/texturing/teximage-colors.c
index 5944137..ff2b174 100644
--- a/tests/texturing/teximage-colors.c
+++ b/tests/texturing/teximage-colors.c
@@ -29,6 +29,9 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_compat_version = 13;
+ config.window_width = 1024;
+ config.window_height = 1024;
+
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
PIGLIT_GL_TEST_CONFIG_END
@@ -475,7 +478,7 @@ piglit_init(int argc, char **argv)
srand(seed);
} else if (strcmp(argv[i], "--benchmark") == 0) {
benchmark = true;
- texture_size = 128;
+ texture_size = 1024;
} else if (strcmp(argv[i], "--pbo") == 0) {
use_pbo = true;
} else if (i == argc - 1) {
@@ -754,33 +757,41 @@ run_test(GLenum test_format, GLenum test_type, float *time_out)
to_expected(test_format, test_type, (GLubyte *)data + (i * Bpp),
expected + 4 * i);
+ if (is_format_signed(format->internal_format)) {
+ glUseProgram(signed_prog);
+
+ for (i = 0; i < texture_size * texture_size * 4; ++i)
+ expected[i] = 0.5 + 0.5 * expected[i];
+ } else {
+ glUseProgram(unsigned_prog);
+ }
+
if (benchmark) {
time = piglit_time_get_nano();
+
for (i = 0; i < BENCHMARK_ITERATIONS; ++i)
glTexImage2D(GL_TEXTURE_2D, 0, format->internal_format,
texture_size, texture_size, 0,
test_format, test_type, teximage_ptr);
+
+ piglit_draw_rect_tex(0, 0, texture_size, texture_size,
+ 0, 0, 1, 1);
+ glFinish();
+
time = piglit_time_get_nano() - time;
*time_out = (double)time / (double)(BENCHMARK_ITERATIONS*1000);
} else {
glTexImage2D(GL_TEXTURE_2D, 0, format->internal_format,
texture_size, texture_size, 0,
test_format, test_type, teximage_ptr);
- }
- pass &= piglit_check_gl_error(GL_NO_ERROR);
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
-
- if (is_format_signed(format->internal_format)) {
- glUseProgram(signed_prog);
+ pass &= piglit_check_gl_error(GL_NO_ERROR);
- for (i = 0; i < texture_size * texture_size * 4; ++i)
- expected[i] = 0.5 + 0.5 * expected[i];
- } else {
- glUseProgram(unsigned_prog);
+ piglit_draw_rect_tex(0, 0, texture_size, texture_size,
+ 0, 0, 1, 1);
}
- piglit_draw_rect_tex(0, 0, texture_size, texture_size, 0, 0, 1, 1);
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
observed = malloc(texture_size * texture_size * 4 * sizeof(float));
glReadPixels(0, 0, texture_size, texture_size,
--
2.2.0
More information about the Piglit
mailing list