diff options
| author | Bryce Harrington <b.harrington@samsung.com> | 2014-04-14 14:13:06 -0700 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2014-04-14 23:38:34 -0700 |
| commit | aa18efa9a914b929ca2c04f9bea2f1011e066ed4 (patch) | |
| tree | 61afec7f4f904fb7ec429cce59d62bc7375eaaf6 /src/caskbench.cpp | |
| parent | 3faa28e886a9076a3b25de51c311d8015b3cb165 (diff) | |
cmake: Make GLX/EGL compilation optional (with EGL as default)
GLX and GLES2/3 are incompatible as apparently the have overlapping
API's so when both are linked in an executable one lib's functions are
going to subvert the others.
This patch provides options to configure GLX and EGL on or off.
Longer term, this will probably need to be revisited. Perhaps there
should be a GL_FLAVOR, that can be set to "glx", "egl", etc. so only one
is defined at a time. Or, perhaps we generate multiple binaries, one
for each, ala caskbench_egl, caskbench_glx, etc.
Diffstat (limited to 'src/caskbench.cpp')
| -rw-r--r-- | src/caskbench.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/caskbench.cpp b/src/caskbench.cpp index 57a354c..f072299 100644 --- a/src/caskbench.cpp +++ b/src/caskbench.cpp @@ -21,6 +21,9 @@ #include "device_config.h" #include "tests.h" +/* TODO: skia-sra doesn't appear to provide this definition - ?!? */ +int32_t SkToS32(intmax_t x) { return (int32_t)x; } + typedef struct _caskbench_options { int dry_run; int iterations; @@ -51,7 +54,7 @@ SkBaseDevice * create_skia_device_image (const device_config_t& config); void destroy_skia_image(); void update_skia_image(); -#if defined(HAVE_GLX_H) +#if USE_GLX cairo_surface_t *create_cairo_surface_glx (const device_config_t& config); void destroy_cairo_glx(); void update_cairo_glx(); @@ -61,7 +64,7 @@ void destroy_skia_glx(); void update_skia_glx(); #endif -#if defined(HAVE_GLES2_H) || defined(HAVE_GLES3_H) +#if USE_EGL cairo_surface_t * create_cairo_surface_egl (const device_config_t& config); void destroy_cairo_egl(); void update_cairo_egl(); @@ -154,10 +157,10 @@ static void print_surfaces_available() { printf("image\n"); -#if defined(HAVE_CAIRO_GL_H) +#if USE_GLX printf("glx\n"); #endif -#if defined(HAVE_GLES3_H) || defined(HAVE_GLES2_H) +#if USE_EGL printf("egl\n"); #endif } @@ -282,7 +285,7 @@ context_setup_cairo(caskbench_context_t *context, const device_config_t& config) context->destroy_cairo = destroy_cairo_image; context->update_cairo = update_cairo_image; } else if (!strncmp(config.surface_type, "glx", 3)) { -#if defined(HAVE_GLX_H) +#if USE_GLX context->setup_cairo = create_cairo_surface_glx; context->destroy_cairo = destroy_cairo_glx; context->update_cairo = update_cairo_glx; @@ -291,7 +294,7 @@ context_setup_cairo(caskbench_context_t *context, const device_config_t& config) #endif } else if (!strncmp(config.surface_type, "egl", 3)) { -#if defined(HAVE_GLES2_H) || defined(HAVE_GLES3_H) +#if USE_EGL context->setup_cairo = create_cairo_surface_egl; context->destroy_cairo = destroy_cairo_egl; context->update_cairo = update_cairo_egl; @@ -329,7 +332,7 @@ context_setup_skia(caskbench_context_t *context, const device_config_t& config) context->destroy_skia = destroy_skia_image; context->update_skia = update_skia_image; } else if (!strncmp(config.surface_type, "glx", 3)) { -#if defined(HAVE_GLX_H) +#if USE_GLX context->setup_skia = create_skia_device_glx; context->destroy_skia = destroy_skia_glx; context->update_skia = update_skia_glx; @@ -338,7 +341,7 @@ context_setup_skia(caskbench_context_t *context, const device_config_t& config) #endif } else if (!strncmp(config.surface_type, "egl", 3)) { -#if defined(HAVE_GLES2_H) || defined(HAVE_GLES3_H) +#if USE_EGL context->setup_skia = create_skia_device_egl; context->destroy_skia = destroy_skia_egl; context->update_skia = update_skia_egl; |