wflinfo: Use glGetStringi(GL_EXTENSION, i) for all contexts >= 3.0

Pre-patch, wflinfo used glGetStringi only for desktop OpenGL >= 3.0.
Unlike the OpenGL Core Profile, OpenGL ES 3.0 also supports
glGetString(GL_EXTENSIONS) for backwards compatibility with OpenGL ES
2.0. However, let's use the forward-looking API when it's available.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
wflinfo: Don't allow negative version numbers

Previously, -V 4.-8 would be treated the same as -V 3.2.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
wflinfo: Don't modify struct options after initialization

parse_args() initializes global options. After that, options should be
immutable. To ensure that, constify each occurence of struct options as
a function parameter.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
wflinfo: Cleanup signature of wflinfo_try_create_context()

The function creates and returns two objects: a context and a config.
The context is the function's return value, and the config is an out
parameter.

Functions with asymmetric returns, I find awkard. Fix the signature to
return both objects as out parameters.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
wflinfo: Cleanup signature of wflinfo_create_context()

The function creates and returns two objects: a context and a config.
The context is the function's return value, and the config is an out
parameter.

Functions with asymmetric returns, I find awkard. Fix the signature to
return both objects as out parameters.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
wflinfo: Replace s/-1/WAFFLE_DONT_CARE/ when relevant

This clarifies the code's intent.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
wflinfo: Distinguish between cmdline options and func options

'struct options` is intended for cmdline options. But wflinfo repurposed
it to manage waffle_config attributes too by passing it into
wflinfo_create_context() and wflinfo_try_create_context().

Add a new type `struct wflinfo_config_attrs`.  Stop passing `struct
option` to those functions and pass wflinfo_config_attrs instead.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
core: Add helper functions for attrs versions

These functions make it easier to compare against known OpenGL and
OpenGLES versions since all known and expected future versions have a
minor version <= 9.

For example, to check that the attrs struct has a version >= 3.2, use
wcore_config_attrs_version_ge(attrs, 32)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
core: Stop using attrs->context_full_version

If the user makes a request to waffle for a minor version > 9, then
this field will not properly represent the requested version.

Although, such a request from the user would likely be invalid, we
should handle it properly.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
core: Remove attrs->context_full_version

If the user makes a request to waffle for a minor version > 9, then
this field will not properly represent the requested version.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
cmake: Replace pkg_check_modules with waffle_pkg_config

Define a new macro waffle_pkg_config, which replaces each occurence of
pkg_check_modules.

Macro waffle_pkg_config is a smart wrapper around CMake's standard
pkg_check_modules macro.

waffle_pkg_config fixes a fatal flaw of pkg_check_modules.  Unlike
pkg_check_modules, waffle_pkg_config calls pkg-config and checks for the
requested package *each* time the macro is called.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
waffle: Update website url to http://waffle-gl.github.io

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
README: Update examples git location

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
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>
wflinfo: Make wflinfo understand OpenGL 3.1 profiles

Strictly speaking, an OpenGL 3.1 context has no profile. But if the user
calls wflinfo like below...
    wflinfo --api=gl --version=3.1
    wflinfo --api=gl --version=3.1 --profile=none
    wflinfo --api=gl --version=3.1 --profile=core
    wflinfo --api=gl --version=3.1 --profile=compat
then we know what they way. Make wflinfo do what the user wants.

Likewise, if the user provided a profile but no version, like this...
    wflinfo --api=gl --profile=core
    wflinfo --api=gl --profile=compat
then wflinfo iterated over OpenGL context versions from 4.4 to 3.2 in
search of the given profile. Because wflinfo now understands 3.1
profiles, it iterates down to 3.1.

Because OpenGL 3.1 contexts don't have true profiles, this patch adds
gobs of special case code to pretend they do.

Fixes: https://github.com/waffle-gl/waffle/issues/4
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
glx: Set waffle_error when glXMakeCurrent fails

Jordan found this because `wflinfo -p glx -a gl -V 3.1 --profile=core`
failed on NVidia with this unhelpful message:
"Waffle error: 0x0 WAFFLE_NO_ERROR".

Reported-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Merge branch 'wflinfo-3.1' of ssh://github.com/chadversary/waffle

Conflicts due to Jordan's recent split of attrs.version into separate
major/minor fields.

Conflicts:
	src/utils/wflinfo.c
android: Fix build

Hi,
I'm trying to build waffle for Android. I found that I have to modify the make
file (Amdroid.mk) to make it work. I am not sure if it caused by my environment
setting. I attached the patch just fyi.

Thanks a lot for your waffle :)
Arthur

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
doc/release-notes: Add waffle-next.txt

This will allow us to build up the release notes for the
next release.

A second reason for wanting to add this is to make sure that
GL is replaced with OpenGL in the release notes.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
pkg arch/mac: Update release tarball urls

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>