Setting the PIGLIT_DEFAULT_SIZE to WIDTHxHEIGHT will change the default from 160x160 to the requested value.
This can be useful if you want to make the number of fragments really small. For example, PIGLIT_DEFAULT_SIZE=4x4 would only have 16 pixels compared to the standard 160 * 160, or 25600. Not all piglit tests will operate properly at every size, so this environment variable should be used carefully. Signed-off-by: Jordan Justen <[email protected]> --- tests/util/piglit-framework-gl.c | 31 +++++++++++++++++++++++++++++++ tests/util/piglit-framework-gl.h | 7 ------- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c index 6a1c201..b9ab2f8 100644 --- a/tests/util/piglit-framework-gl.c +++ b/tests/util/piglit-framework-gl.c @@ -43,10 +43,41 @@ static void process_args(int *argc, char *argv[], unsigned *force_samples, struct piglit_gl_test_config *config); +static bool +override_size(struct piglit_gl_test_config *config) +{ + const char *default_size; + unsigned int width; + unsigned int height; + + default_size = getenv("PIGLIT_DEFAULT_SIZE"); + if (!default_size) + return false; + + if (sscanf(default_size, "%ux%u", &width, &height) != 2) + return false; + + if (width == 0 || height == 0) + return false; + + config->window_width = width; + config->window_height = height; + return true; +} + void piglit_gl_test_config_init(struct piglit_gl_test_config *config) { memset(config, 0, sizeof(*config)); + + if (!override_size(config)) { + /* Default window size. Note: Win8's min window width */ + /* seems to be 160 pixels. When the window size is */ + /* unexpectedly resized, tests are marked as "WARN". */ + /* Let's use a larger default to avoid that. */ + config->window_width = 160; + config->window_height = 160; + } } static void diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h index cff4533..81c1a5e 100644 --- a/tests/util/piglit-framework-gl.h +++ b/tests/util/piglit-framework-gl.h @@ -267,13 +267,6 @@ piglit_gl_test_run(int argc, char *argv[], config.init = piglit_init; \ config.display = piglit_display; \ \ - /* Default window size. Note: Win8's min window width */ \ - /* seems to be 160 pixels. When the window size is */ \ - /* unexpectedly resized, tests are marked as "WARN". */ \ - /* Let's use a larger default to avoid that. */ \ - config.window_width = 160; \ - config.window_height = 160; \ - \ /* Open a new scope so that tests can declare locals */ \ /* between here and PIGLIT_GL_TEST_CONFIG_END. */ \ { -- 2.1.4 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
