diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/caskbench.cpp | 49 | ||||
| -rw-r--r-- | src/device_config.h | 1 | ||||
| -rw-r--r-- | src/egl.cpp | 4 |
3 files changed, 53 insertions, 1 deletions
diff --git a/src/caskbench.cpp b/src/caskbench.cpp index 379d611..2243fe9 100644 --- a/src/caskbench.cpp +++ b/src/caskbench.cpp @@ -56,6 +56,8 @@ typedef struct _caskbench_options { int canvas_width; int canvas_height; int list_tests; + int list_gles_versions; + int gles_version; const char **tests; } caskbench_options_t; @@ -121,6 +123,17 @@ print_tests_available() } } +static void +print_gles_versions_available () +{ +#if HAVE_GLES2_H + printf("2\n"); +#endif +#if HAVE_GLES3_H + printf("3\n"); +#endif +} + void process_options(caskbench_options_t *opt, int argc, char *argv[]) { @@ -217,6 +230,14 @@ process_options(caskbench_options_t *opt, int argc, char *argv[]) {"list-tests", '\0', POPT_ARG_NONE, &opt->list_tests, 0, "List the tests available for execution", NULL}, +#if USE_EGL + {"list-gles-versions", '\0', POPT_ARG_NONE, &opt->list_gles_versions, 0, + "Lists available GLES versions", + NULL}, + {"gles-version", '\0', POPT_ARG_INT, &opt->gles_version, 0, + "Specify the GLES version to use", + NULL}, +#endif POPT_AUTOHELP {NULL} }; @@ -401,7 +422,33 @@ main (int argc, char *argv[]) print_tests_available(); exit(0); } - + if(opt.list_gles_versions) { + print_gles_versions_available(); + exit(0); + } + +#if HAVE_GLES3_H + config.egl_gles_version = 3; +#elif HAVE_GLES2_H + config.egl_gles_version = 2; +#endif + + if(opt.gles_version) { + if (opt.surface_type == NULL || (strncmp(opt.surface_type,"image",5)==0)) + errx(0, "gles-version is not usable with image backend"); + if (opt.gles_version < 2 || opt.gles_version > 3) + errx(0, "gles-version provided is invalid"); +#ifndef HAVE_GLES2_H + if (opt.gles_version == 2) + errx(0, "gles-version 2 is not supported in the hardware"); +#endif +#ifndef HAVE_GLES3_H + if (opt.gles_version == 3) + errx(0, "gles-version 3 is not supported in the hardware"); +#endif + config.egl_gles_version = opt.gles_version; + } + if (opt.output_file) { // start writing json to output file fp = fopen(opt.output_file, "w"); diff --git a/src/device_config.h b/src/device_config.h index 79d2445..5bcbeac 100644 --- a/src/device_config.h +++ b/src/device_config.h @@ -18,6 +18,7 @@ typedef struct _device_config { int egl_samples; int egl_sample_buffers; int egl_msaa_sample_count; + int egl_gles_version; } device_config_t; diff --git a/src/egl.cpp b/src/egl.cpp index 7dc3366..1f577eb 100644 --- a/src/egl.cpp +++ b/src/egl.cpp @@ -57,6 +57,10 @@ createEGLContextAndWindow(egl_state_t *state, const device_config_t& device_conf } } + if(device_config.egl_gles_version) { + ctx_attr[1] = device_config.egl_gles_version; + } + state->dpy = XOpenDisplay (NULL); if (state->dpy == NULL) { warnx ("Failed to open display: %s\n", XDisplayName (0)); |