diff options
author | Chad Versace <chad.versace@intel.com> | 2015-06-04 10:47:47 -0700 |
---|---|---|
committer | Chad Versace <chad.versace@intel.com> | 2015-06-04 10:47:47 -0700 |
commit | 04dee2816351155923f666336d22e4094b4e9b7a (patch) | |
tree | dcd3faf0d09c3bad3c9d578ef7b2d95383800c87 | |
parent | 0458ee9795f1803add3482d8ff668ed96d92f8c3 (diff) | |
parent | e9c4e291982acc303a3a9a70e817e052f4fdc05a (diff) | |
download | waffle-next.tar.gz |
Merge branch 'master' into nextnext
* master:
linux: Use full libGLES*.so.[12] SONAMEs
examples/gl_basic: Add --fullscreen option
-rw-r--r-- | examples/gl_basic.c | 35 | ||||
-rw-r--r-- | man/waffle_config.3.xml | 2 | ||||
-rw-r--r-- | man/waffle_dl.3.xml | 6 | ||||
-rw-r--r-- | src/waffle/linux/linux_dl.c | 13 |
4 files changed, 43 insertions, 13 deletions
diff --git a/examples/gl_basic.c b/examples/gl_basic.c index eb57c4e..25a0c7e 100644 --- a/examples/gl_basic.c +++ b/examples/gl_basic.c @@ -68,7 +68,7 @@ static const char *usage_message = " [--forward-compatible]\n" " [--debug]\n" " [--resize-window]\n" - " [--window-size=WIDTHxHEIGHT]\n" + " [--window-size=WIDTHxHEIGHT | --fullscreen]\n" "\n" "examples:\n" " gl_basic --platform=glx --api=gl\n" @@ -87,6 +87,9 @@ static const char *usage_message = "\n" " --resize-window\n" " Resize the window between each draw call.\n" + "\n" + " --fullscreen\n" + " Create a fullscreen window.\n" ; enum { @@ -98,6 +101,7 @@ enum { OPT_FORWARD_COMPATIBLE, OPT_RESIZE_WINDOW, OPT_WINDOW_SIZE, + OPT_FULLSCREEN, }; static const struct option get_opts[] = { @@ -109,6 +113,7 @@ static const struct option get_opts[] = { { .name = "forward-compatible", .has_arg = no_argument, .val = OPT_FORWARD_COMPATIBLE }, { .name = "resize-window", .has_arg = no_argument, .val = OPT_RESIZE_WINDOW }, { .name = "window-size", .has_arg = required_argument, .val = OPT_WINDOW_SIZE }, + { .name = "fullscreen", .has_arg = no_argument, .val = OPT_FULLSCREEN }, { 0 }, }; @@ -229,6 +234,8 @@ struct options { bool resize_window; + bool fullscreen; + /// @brief One of `WAFFLE_DL_*`. int dl; }; @@ -284,6 +291,7 @@ parse_args(int argc, char *argv[], struct options *opts) { bool ok; bool loop_get_opt = true; + bool found_window_size = false; #ifdef __APPLE__ removeXcodeArgs(&argc, argv); @@ -358,8 +366,12 @@ parse_args(int argc, char *argv[], struct options *opts) usage_error_printf("'%s' is not a valid window geometry", optarg); } + found_window_size = true; break; } + case OPT_FULLSCREEN: + opts->fullscreen = true; + break; default: abort(); loop_get_opt = false; @@ -379,6 +391,11 @@ parse_args(int argc, char *argv[], struct options *opts) usage_error_printf("--api is required"); } + if (opts->fullscreen && found_window_size) { + usage_error_printf("--fullscreen and --window-size are mutually " + "exclusive options"); + } + // Set dl. switch (opts->context_api) { case WAFFLE_CONTEXT_OPENGL: opts->dl = WAFFLE_DL_OPENGL; break; @@ -654,11 +671,17 @@ main(int argc, char **argv) i = 0; - window_attrib_list[i++] = WAFFLE_WINDOW_WIDTH; - window_attrib_list[i++] = window_width; - window_attrib_list[i++] = WAFFLE_WINDOW_HEIGHT; - window_attrib_list[i++] = window_height; - window_attrib_list[i++] = 0; + if (opts.fullscreen) { + window_attrib_list[i++] = WAFFLE_WINDOW_FULLSCREEN; + window_attrib_list[i++] = true; + window_attrib_list[i++] = 0; + } else { + window_attrib_list[i++] = WAFFLE_WINDOW_WIDTH; + window_attrib_list[i++] = window_width; + window_attrib_list[i++] = WAFFLE_WINDOW_HEIGHT; + window_attrib_list[i++] = window_height; + window_attrib_list[i++] = 0; + } window = waffle_window_create2(config, window_attrib_list); if (!window) diff --git a/man/waffle_config.3.xml b/man/waffle_config.3.xml index 8dc2fae..a8cb98d 100644 --- a/man/waffle_config.3.xml +++ b/man/waffle_config.3.xml @@ -535,7 +535,7 @@ struct waffle_config; <itemizedlist> <listitem> <para> - GLX supports creation of an OpenGL ES2 context only if libGLESv2.so is installed and if + GLX supports creation of an OpenGL ES2 context only if libGLESv2.so.2 is installed and if GLX_EXT_create_context_es2_profile is exposed as both a server and client extension. </para> </listitem> diff --git a/man/waffle_dl.3.xml b/man/waffle_dl.3.xml index 463081f..ffcfad4 100644 --- a/man/waffle_dl.3.xml +++ b/man/waffle_dl.3.xml @@ -72,9 +72,9 @@ <para> For example, on Linux, the <constant>WAFFLE_DL_*</constant> enums map to <filename>libGL.so.1</filename>, - <filename>libGLESv1_CM.so</filename>, - <filename>libGLESv2.so</filename>, and - <filename>libGLESv2.so</filename>, respectively. + <filename>libGLESv1_CM.so.1</filename>, + <filename>libGLESv2.so.2</filename>, and + <filename>libGLESv2.so.2</filename>, respectively. </para> <variablelist> diff --git a/src/waffle/linux/linux_dl.c b/src/waffle/linux/linux_dl.c index 1e14684..33eb69d 100644 --- a/src/waffle/linux/linux_dl.c +++ b/src/waffle/linux/linux_dl.c @@ -34,7 +34,7 @@ #include "linux_dl.h" struct linux_dl { - /// @brief For example, "libGLESv2.so". + /// @brief For example, "libGLESv2.so.2". const char *name; /// @brief The library obtained with dlopen(). @@ -50,17 +50,24 @@ linux_dl_get_name(int32_t waffle_dl) case WAFFLE_DL_OPENGL: return "libGL.so.1"; case WAFFLE_DL_OPENGL_ES1: +#ifdef WAFFLE_HAS_ANDROID return "libGLESv1_CM.so"; +#else + return "libGLESv1_CM.so.1"; +#endif case WAFFLE_DL_OPENGL_ES2: case WAFFLE_DL_OPENGL_ES3: // As of 2014-04-20, Mesa statically provides the ES2 and ES3 - // symbols symbols in libGLESv2.so and provides no ES3-only library + // symbols symbols in libGLESv2.so.2 and provides no ES3-only library // - // Even though Waffle does not use the library's soname, note that // Mesa did not change the library's soname when it added the ES3 // symbols. The soname was and is libGLESv2.so.2 before and after // ES3. +#ifdef WAFFLE_HAS_ANDROID return "libGLESv2.so"; +#else + return "libGLESv2.so.2"; +#endif default: wcore_error_internal("waffle_dl has bad value %#x", waffle_dl); return NULL; |