On 1 June 2013 05:38, Marek Olšák <[email protected]> wrote: > --- > tests/util/piglit-framework-gl.c | 20 > +++++++++++++++----- > tests/util/piglit-framework-gl.h | 1 + > .../piglit-framework-gl/piglit_fbo_framework.c | 5 +++++ > .../piglit-framework-gl/piglit_glut_framework.c | 5 +++++ > .../piglit-framework-gl/piglit_winsys_framework.c | 7 +++++++ > 5 files changed, 33 insertions(+), 5 deletions(-) > > diff --git a/tests/util/piglit-framework-gl.c > b/tests/util/piglit-framework-gl.c > index 441e271..82197bb 100644 > --- a/tests/util/piglit-framework-gl.c > +++ b/tests/util/piglit-framework-gl.c > @@ -60,7 +60,7 @@ delete_arg(char *argv[], int argc, int arg) > * length is returned in @a argc. > */ > static void > -process_args(int *argc, char *argv[]) > +process_args(int *argc, char *argv[], unsigned *force_samples) > { > int j; > > @@ -104,6 +104,10 @@ process_args(int *argc, char *argv[]) > } > *argc -= 2; > j -= 2; > + } else if (!strncmp(argv[j], "-samples=", 9)) { > + *force_samples = atoi(argv[j]+9); > + delete_arg(argv, *argc, j--); > + *argc -= 1; > } > } > } > @@ -112,12 +116,18 @@ void > piglit_gl_test_run(int argc, char *argv[], > const struct piglit_gl_test_config *config) > { > - process_args(&argc, argv); > + struct piglit_gl_test_config conf = *config; > + unsigned force_samples = 0; > + > + process_args(&argc, argv, &force_samples); > + > + if (force_samples > 1) > + conf.window_samples = force_samples; > > - piglit_width = config->window_width; > - piglit_height = config->window_height; > + piglit_width = conf.window_width; > + piglit_height = conf.window_height; > > - gl_fw = piglit_gl_framework_factory(config); > + gl_fw = piglit_gl_framework_factory(&conf); > if (gl_fw == NULL) { > printf("piglit: error: failed to create " > "piglit_gl_framework\n"); > diff --git a/tests/util/piglit-framework-gl.h > b/tests/util/piglit-framework-gl.h > index 4406c1b..95be1c1 100644 > --- a/tests/util/piglit-framework-gl.h > +++ b/tests/util/piglit-framework-gl.h > @@ -140,6 +140,7 @@ struct piglit_gl_test_config { > > int window_width; > int window_height; > + int window_samples; > > /** > * A bitmask of `enum piglit_gl_visual`. > diff --git a/tests/util/piglit-framework-gl/piglit_fbo_framework.c > b/tests/util/piglit-framework-gl/piglit_fbo_framework.c > index 1b844bb..1aad5fe 100644 > --- a/tests/util/piglit-framework-gl/piglit_fbo_framework.c > +++ b/tests/util/piglit-framework-gl/piglit_fbo_framework.c > @@ -139,6 +139,11 @@ piglit_fbo_framework_create(const struct > piglit_gl_test_config *test_config) > int32_t platform = > piglit_wfl_framework_choose_platform(test_config); > bool ok = true; > > + if (test_config->window_samples > 1) { > + puts("The FBO mode doesn't support multisampling\n"); > + piglit_report_result(PIGLIT_SKIP); > + } > + >
I'd prefer PIGLIT_FAIL here. PIGLIT_SKIP is for cases where we can't run the test because a required feature is missing from the underlying GL implementation. But in this case it's a feature that the piglit framework doesn't support (just because we haven't gotten around to adding it yet). If, in the future, someone adds a test to all.tests that tries to combine "-samples=n" with "-fbo", I'd like them to get a big nasty PIGLIT_FAIL to alert them to the fact that they are trying to use an unimplemented piglit feature. Alternatively, we could just go ahead and implement support. It wouldn't be too much work to add it to piglit_fbo_framework.c. With that changed, this patch is: Reviewed-by: Paul Berry <[email protected]> > wfl_fw = calloc(1, sizeof(*wfl_fw)); > gl_fw = &wfl_fw->gl_fw; > > diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c > b/tests/util/piglit-framework-gl/piglit_glut_framework.c > index cfadf77..ff48abb 100644 > --- a/tests/util/piglit-framework-gl/piglit_glut_framework.c > +++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c > @@ -180,6 +180,11 @@ piglit_glut_framework_create(const struct > piglit_gl_test_config *test_config) > piglit_report_result(PIGLIT_SKIP); > } > > + if (test_config->window_samples > 1) { > + printf("GLUT doesn't support MSAA visuals.\n"); > + piglit_report_result(PIGLIT_SKIP); > + } > + > ok = piglit_gl_framework_init(&glut_fw.gl_fw, test_config); > if (!ok) > return NULL; > diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c > b/tests/util/piglit-framework-gl/piglit_winsys_framework.c > index 971f183..205ea21 100644 > --- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c > +++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c > @@ -128,6 +128,13 @@ choose_config_attribs(const struct > piglit_gl_test_config *test_config) > attrib_list[i++] = true; > } > > + if (test_config->window_samples > 1) { > + attrib_list[i++] = WAFFLE_SAMPLE_BUFFERS; > + attrib_list[i++] = 1; > + attrib_list[i++] = WAFFLE_SAMPLES; > + attrib_list[i++] = test_config->window_samples; > + } > + > attrib_list[i++] = WAFFLE_NONE; > > return attrib_list; > -- > 1.7.10.4 > > _______________________________________________ > Piglit mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/piglit >
_______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
