summaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2014-06-06 04:08:35 +0900
committerBryce Harrington <b.harrington@samsung.com>2014-06-06 04:08:35 +0900
commit01a2efe93123ef98f69737eb6d7d92e426314aeb (patch)
tree86f7e40f3c2943c46c60a375dd64b8e1b9cf848a /src
parent5a3b5116b86d4089f2dae320387350a7e0c01083 (diff)
parent79930ddc7c5f111eb5489449b09d97afb28a0e7b (diff)
Merge pull request #81 from Samsung/Issue_78
Command line options for listing gles-versions available and to set the gles-version. ref: https://github.com/Samsung/caskbench/issues/78
Diffstat (limited to 'src')
-rw-r--r--src/caskbench.cpp49
-rw-r--r--src/device_config.h1
-rw-r--r--src/egl.cpp4
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));