diff options
author | Jordan Justen <jordan.l.justen@intel.com> | 2014-05-04 09:29:03 -0700 |
---|---|---|
committer | Jordan Justen <jordan.l.justen@intel.com> | 2014-05-11 21:46:26 -0700 |
commit | 5b88e2d77c8f56b60dab15054c3e7717b8b488f6 (patch) | |
tree | 8b6dd61f0f7653cf1a9acd371bfd6a89b0d01416 /src | |
parent | e9ca1ed0450646cdded40a860808d04002537795 (diff) | |
download | waffle-5b88e2d77c8f56b60dab15054c3e7717b8b488f6.tar.gz |
wflinfo: Fix issue with minor version > 9
Previously if the user asked for version of 1.40, then wflinfo would
translate this into a request of version 5.0 to waffle.
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/wflinfo.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c index c4f5e80..bbb5bf4 100644 --- a/src/utils/wflinfo.c +++ b/src/utils/wflinfo.c @@ -216,7 +216,8 @@ struct options { /// @brief One of `WAFFLE_CONTEXT_PROFILE_*` or `WAFFLE_NONE`. int context_profile; - int context_version; + int context_major; + int context_minor; bool verbose; @@ -297,7 +298,8 @@ parse_args(int argc, char *argv[], struct options *opts) // Set options to default values. opts->context_profile = WAFFLE_NONE; - opts->context_version = WAFFLE_DONT_CARE; + opts->context_major = WAFFLE_DONT_CARE; + opts->context_minor = WAFFLE_DONT_CARE; // prevent getopt_long from printing an error message opterr = 0; @@ -336,7 +338,8 @@ parse_args(int argc, char *argv[], struct options *opts) usage_error_printf("'%s' is not a valid OpenGL version", optarg); } - opts->context_version = 10 * major + minor; + opts->context_major = major; + opts->context_minor = minor; break; } case OPT_PROFILE: @@ -608,10 +611,11 @@ struct wflinfo_config_attrs { /// @brief One of `WAFFLE_CONTEXT_PROFILE_*` or `WAFFLE_NONE`. enum waffle_enum profile; - /// @brief The context version times 10. - /// - /// For example, set this to 32 if you want a 3.2 context. - int32_t version; + /// @brief The version major number. + int32_t major; + + /// @brief The version minor number. + int32_t minor; /// @brief Create a forward-compatible context. bool forward_compat; @@ -641,11 +645,11 @@ wflinfo_try_create_context(struct waffle_display *dpy, config_attrib_list[i++] = attrs.profile; } - if (attrs.version != WAFFLE_DONT_CARE) { + if (attrs.major != WAFFLE_DONT_CARE && attrs.minor != WAFFLE_DONT_CARE) { config_attrib_list[i++] = WAFFLE_CONTEXT_MAJOR_VERSION; - config_attrib_list[i++] = attrs.version / 10; + config_attrib_list[i++] = attrs.major; config_attrib_list[i++] = WAFFLE_CONTEXT_MINOR_VERSION; - config_attrib_list[i++] = attrs.version % 10; + config_attrib_list[i++] = attrs.minor; } if (attrs.forward_compat) { @@ -715,7 +719,7 @@ wflinfo_create_context(struct waffle_display *dpy, { if (attrs.api == WAFFLE_CONTEXT_OPENGL && attrs.profile != WAFFLE_NONE && - attrs.version == WAFFLE_DONT_CARE) { + attrs.major == WAFFLE_DONT_CARE) { // If the user requested OpenGL and a CORE or COMPAT profile, // but they didn't specify a version, then we'll try a set @@ -727,7 +731,8 @@ wflinfo_create_context(struct waffle_display *dpy, bool ok; for (int i = ARRAY_SIZE(known_gl_profile_versions) - 1; i >= 0; i--) { - attrs.version = known_gl_profile_versions[i]; + attrs.major = known_gl_profile_versions[i] / 10; + attrs.minor = known_gl_profile_versions[i] % 10; ok = wflinfo_try_create_context(dpy, attrs, out_ctx, out_config, false); if (ok) { @@ -800,7 +805,8 @@ main(int argc, char **argv) const struct wflinfo_config_attrs config_attrs = { .api = opts.context_api, .profile = opts.context_profile, - .version = opts.context_version, + .major = opts.context_major, + .minor = opts.context_minor, .forward_compat = opts.context_forward_compatible, .debug = opts.context_debug, }; |