Re: [waffle] [PATCH 05/12] waffle: add waffle_display_info_json()
On Sun, Apr 24, 2016 at 4:54 PM, Emil Velikovwrote: > On 24 April 2016 at 20:50, Frank Henigman wrote: >> On Sun, Apr 24, 2016 at 6:42 AM, Emil Velikov >> wrote: >>> On 21 April 2016 at 21:25, Frank Henigman wrote: On Fri, Jan 8, 2016 at 7:40 AM, Emil Velikov wrote: > On 6 January 2016 at 21:56, Frank Henigman wrote: >> Duplicate wflinfo functionality in the API, with the difference that the >> information is returned in JSON form. >> The function has a parameter for including platform-specific information, >> but it is ignored for now. >> >> Signed-off-by: Frank Henigman >> --- >> include/waffle/waffle.h | 5 + >> man/waffle_display.3.xml| 19 +++ >> src/waffle/api/waffle_display.c | 284 >> +++- >> src/waffle/waffle.def.in| 1 + >> 4 files changed, 308 insertions(+), 1 deletion(-) >> >> diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h >> index df0218e..1800399 100644 >> --- a/include/waffle/waffle.h >> +++ b/include/waffle/waffle.h >> @@ -214,6 +214,11 @@ bool >> waffle_display_supports_context_api(struct waffle_display *self, >> int32_t context_api); >> >> +#if WAFFLE_API_VERSION >= 0x0106 >> +char* >> +waffle_display_info_json(struct waffle_display *self, bool >> platform_too); > The function does not work solely with the display, but it requires a > (bound) context. Thus it does not really fit waffle naming scheme. I'm > afraid that I'm short of suggestions though (barring my "returning > json formatted data sounds iffy, lets use tokens" rant from earlier) > > >> +#endif >> + >> union waffle_native_display* >> waffle_display_get_native(struct waffle_display *self); >> >> diff --git a/man/waffle_display.3.xml b/man/waffle_display.3.xml >> index 9896247..5358472 100644 >> --- a/man/waffle_display.3.xml >> +++ b/man/waffle_display.3.xml >> @@ -24,6 +24,7 @@ >> waffle_display >> waffle_display_connect >> waffle_display_disconnect >> +waffle_display_info_json >> waffle_display_supports_context_api >> waffle_display_get_native >> class waffle_display >> @@ -58,6 +59,12 @@ struct waffle_display; >> >> >> >> +char* >> waffle_display_info_json >> +struct waffle_display >> *self >> +bool platform_info >> + >> + >> + >> bool >> waffle_display_supports_context_api >> struct waffle_display >> *self >> int32_t context_api >> @@ -129,6 +136,18 @@ struct waffle_display; >> >> >> >> +waffle_display_info_json() >> + >> + >> +Return a JSON string containing information about the >> current context on the given display, including Waffle platform and API, >> GL version/vendor/renderer and extensions. >> +If platform_info is true, >> platform-specific information (such as GLX or EGL versions and >> extensions) will be included as available. >> +Returns NULL on error. >> +The string should be deallocated with >> free3. >> + >> + >> + >> + >> + >> >> waffle_display_supports_context_api() >> >> >> diff --git a/src/waffle/api/waffle_display.c >> b/src/waffle/api/waffle_display.c >> index fa19462..7abe2ef 100644 >> --- a/src/waffle/api/waffle_display.c >> +++ b/src/waffle/api/waffle_display.c >> @@ -23,13 +23,61 @@ >> // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT >> OF THE USE >> // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> >> +#include >> +#include >> + >> #include "api_priv.h" >> >> -#include "wcore_error.h" >> +#include "json.h" >> + >> +#include "wcore_context.h" >> #include "wcore_display.h" >> +#include "wcore_error.h" >> #include "wcore_platform.h" >> #include "wcore_util.h" >> >> +typedef unsigned int GLint; >> +typedef unsigned int GLenum; >> +typedef unsigned char GLubyte; >> + >> +enum { >> +// Copied from . >> +GL_NO_ERROR = 0, >> + >> +GL_CONTEXT_FLAGS = 0x821e, >> +GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001, >> +GL_CONTEXT_FLAG_DEBUG_BIT = 0x0002, >> +GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x0004, >> + >> +
Re: [waffle] [PATCH 05/12] waffle: add waffle_display_info_json()
On 24 April 2016 at 20:50, Frank Henigmanwrote: > On Sun, Apr 24, 2016 at 6:42 AM, Emil Velikov > wrote: >> On 21 April 2016 at 21:25, Frank Henigman wrote: >>> On Fri, Jan 8, 2016 at 7:40 AM, Emil Velikov >>> wrote: On 6 January 2016 at 21:56, Frank Henigman wrote: > Duplicate wflinfo functionality in the API, with the difference that the > information is returned in JSON form. > The function has a parameter for including platform-specific information, > but it is ignored for now. > > Signed-off-by: Frank Henigman > --- > include/waffle/waffle.h | 5 + > man/waffle_display.3.xml| 19 +++ > src/waffle/api/waffle_display.c | 284 > +++- > src/waffle/waffle.def.in| 1 + > 4 files changed, 308 insertions(+), 1 deletion(-) > > diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h > index df0218e..1800399 100644 > --- a/include/waffle/waffle.h > +++ b/include/waffle/waffle.h > @@ -214,6 +214,11 @@ bool > waffle_display_supports_context_api(struct waffle_display *self, > int32_t context_api); > > +#if WAFFLE_API_VERSION >= 0x0106 > +char* > +waffle_display_info_json(struct waffle_display *self, bool platform_too); The function does not work solely with the display, but it requires a (bound) context. Thus it does not really fit waffle naming scheme. I'm afraid that I'm short of suggestions though (barring my "returning json formatted data sounds iffy, lets use tokens" rant from earlier) > +#endif > + > union waffle_native_display* > waffle_display_get_native(struct waffle_display *self); > > diff --git a/man/waffle_display.3.xml b/man/waffle_display.3.xml > index 9896247..5358472 100644 > --- a/man/waffle_display.3.xml > +++ b/man/waffle_display.3.xml > @@ -24,6 +24,7 @@ > waffle_display > waffle_display_connect > waffle_display_disconnect > +waffle_display_info_json > waffle_display_supports_context_api > waffle_display_get_native > class waffle_display > @@ -58,6 +59,12 @@ struct waffle_display; > > > > +char* > waffle_display_info_json > +struct waffle_display > *self > +bool platform_info > + > + > + > bool > waffle_display_supports_context_api > struct waffle_display > *self > int32_t context_api > @@ -129,6 +136,18 @@ struct waffle_display; > > > > +waffle_display_info_json() > + > + > +Return a JSON string containing information about the > current context on the given display, including Waffle platform and API, > GL version/vendor/renderer and extensions. > +If platform_info is true, > platform-specific information (such as GLX or EGL versions and > extensions) will be included as available. > +Returns NULL on error. > +The string should be deallocated with > free3. > + > + > + > + > + > > waffle_display_supports_context_api() > > > diff --git a/src/waffle/api/waffle_display.c > b/src/waffle/api/waffle_display.c > index fa19462..7abe2ef 100644 > --- a/src/waffle/api/waffle_display.c > +++ b/src/waffle/api/waffle_display.c > @@ -23,13 +23,61 @@ > // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF > THE USE > // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > +#include > +#include > + > #include "api_priv.h" > > -#include "wcore_error.h" > +#include "json.h" > + > +#include "wcore_context.h" > #include "wcore_display.h" > +#include "wcore_error.h" > #include "wcore_platform.h" > #include "wcore_util.h" > > +typedef unsigned int GLint; > +typedef unsigned int GLenum; > +typedef unsigned char GLubyte; > + > +enum { > +// Copied from . > +GL_NO_ERROR = 0, > + > +GL_CONTEXT_FLAGS = 0x821e, > +GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001, > +GL_CONTEXT_FLAG_DEBUG_BIT = 0x0002, > +GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x0004, > + > +GL_VENDOR = 0x1F00, > +GL_RENDERER= 0x1F01, > +GL_VERSION = 0x1F02, > +GL_EXTENSIONS =
Re: [waffle] [PATCH 05/12] waffle: add waffle_display_info_json()
On Sun, Apr 24, 2016 at 6:42 AM, Emil Velikovwrote: > On 21 April 2016 at 21:25, Frank Henigman wrote: >> On Fri, Jan 8, 2016 at 7:40 AM, Emil Velikov >> wrote: >>> On 6 January 2016 at 21:56, Frank Henigman wrote: Duplicate wflinfo functionality in the API, with the difference that the information is returned in JSON form. The function has a parameter for including platform-specific information, but it is ignored for now. Signed-off-by: Frank Henigman --- include/waffle/waffle.h | 5 + man/waffle_display.3.xml| 19 +++ src/waffle/api/waffle_display.c | 284 +++- src/waffle/waffle.def.in| 1 + 4 files changed, 308 insertions(+), 1 deletion(-) diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h index df0218e..1800399 100644 --- a/include/waffle/waffle.h +++ b/include/waffle/waffle.h @@ -214,6 +214,11 @@ bool waffle_display_supports_context_api(struct waffle_display *self, int32_t context_api); +#if WAFFLE_API_VERSION >= 0x0106 +char* +waffle_display_info_json(struct waffle_display *self, bool platform_too); >>> The function does not work solely with the display, but it requires a >>> (bound) context. Thus it does not really fit waffle naming scheme. I'm >>> afraid that I'm short of suggestions though (barring my "returning >>> json formatted data sounds iffy, lets use tokens" rant from earlier) >>> >>> +#endif + union waffle_native_display* waffle_display_get_native(struct waffle_display *self); diff --git a/man/waffle_display.3.xml b/man/waffle_display.3.xml index 9896247..5358472 100644 --- a/man/waffle_display.3.xml +++ b/man/waffle_display.3.xml @@ -24,6 +24,7 @@ waffle_display waffle_display_connect waffle_display_disconnect +waffle_display_info_json waffle_display_supports_context_api waffle_display_get_native class waffle_display @@ -58,6 +59,12 @@ struct waffle_display; +char* waffle_display_info_json +struct waffle_display *self +bool platform_info + + + bool waffle_display_supports_context_api struct waffle_display *self int32_t context_api @@ -129,6 +136,18 @@ struct waffle_display; +waffle_display_info_json() + + +Return a JSON string containing information about the current context on the given display, including Waffle platform and API, GL version/vendor/renderer and extensions. +If platform_info is true, platform-specific information (such as GLX or EGL versions and extensions) will be included as available. +Returns NULL on error. +The string should be deallocated with free3. + + + + + waffle_display_supports_context_api() diff --git a/src/waffle/api/waffle_display.c b/src/waffle/api/waffle_display.c index fa19462..7abe2ef 100644 --- a/src/waffle/api/waffle_display.c +++ b/src/waffle/api/waffle_display.c @@ -23,13 +23,61 @@ // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include +#include + #include "api_priv.h" -#include "wcore_error.h" +#include "json.h" + +#include "wcore_context.h" #include "wcore_display.h" +#include "wcore_error.h" #include "wcore_platform.h" #include "wcore_util.h" +typedef unsigned int GLint; +typedef unsigned int GLenum; +typedef unsigned char GLubyte; + +enum { +// Copied from . +GL_NO_ERROR = 0, + +GL_CONTEXT_FLAGS = 0x821e, +GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001, +GL_CONTEXT_FLAG_DEBUG_BIT = 0x0002, +GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x0004, + +GL_VENDOR = 0x1F00, +GL_RENDERER= 0x1F01, +GL_VERSION = 0x1F02, +GL_EXTENSIONS = 0x1F03, +GL_NUM_EXTENSIONS = 0x821D, +GL_SHADING_LANGUAGE_VERSION= 0x8B8C, +}; + +#ifndef _WIN32 +#define APIENTRY +#else +#ifndef
[waffle] [PATCH 05/12] waffle: add waffle_display_info_json()
On 21 April 2016 at 21:25, Frank Henigmanwrote: > On Fri, Jan 8, 2016 at 7:40 AM, Emil Velikov wrote: >> On 6 January 2016 at 21:56, Frank Henigman wrote: >>> Duplicate wflinfo functionality in the API, with the difference that the >>> information is returned in JSON form. >>> The function has a parameter for including platform-specific information, >>> but it is ignored for now. >>> >>> Signed-off-by: Frank Henigman >>> --- >>> include/waffle/waffle.h | 5 + >>> man/waffle_display.3.xml| 19 +++ >>> src/waffle/api/waffle_display.c | 284 >>> +++- >>> src/waffle/waffle.def.in| 1 + >>> 4 files changed, 308 insertions(+), 1 deletion(-) >>> >>> diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h >>> index df0218e..1800399 100644 >>> --- a/include/waffle/waffle.h >>> +++ b/include/waffle/waffle.h >>> @@ -214,6 +214,11 @@ bool >>> waffle_display_supports_context_api(struct waffle_display *self, >>> int32_t context_api); >>> >>> +#if WAFFLE_API_VERSION >= 0x0106 >>> +char* >>> +waffle_display_info_json(struct waffle_display *self, bool platform_too); >> The function does not work solely with the display, but it requires a >> (bound) context. Thus it does not really fit waffle naming scheme. I'm >> afraid that I'm short of suggestions though (barring my "returning >> json formatted data sounds iffy, lets use tokens" rant from earlier) >> >> >>> +#endif >>> + >>> union waffle_native_display* >>> waffle_display_get_native(struct waffle_display *self); >>> >>> diff --git a/man/waffle_display.3.xml b/man/waffle_display.3.xml >>> index 9896247..5358472 100644 >>> --- a/man/waffle_display.3.xml >>> +++ b/man/waffle_display.3.xml >>> @@ -24,6 +24,7 @@ >>> waffle_display >>> waffle_display_connect >>> waffle_display_disconnect >>> +waffle_display_info_json >>> waffle_display_supports_context_api >>> waffle_display_get_native >>> class waffle_display >>> @@ -58,6 +59,12 @@ struct waffle_display; >>> >>> >>> >>> +char* >>> waffle_display_info_json >>> +struct waffle_display >>> *self >>> +bool platform_info >>> + >>> + >>> + >>> bool >>> waffle_display_supports_context_api >>> struct waffle_display >>> *self >>> int32_t context_api >>> @@ -129,6 +136,18 @@ struct waffle_display; >>> >>> >>> >>> +waffle_display_info_json() >>> + >>> + >>> +Return a JSON string containing information about the current >>> context on the given display, including Waffle platform and API, GL >>> version/vendor/renderer and extensions. >>> +If platform_info is true, >>> platform-specific information (such as GLX or EGL versions and extensions) >>> will be included as available. >>> +Returns NULL on error. >>> +The string should be deallocated with >>> free3. >>> + >>> + >>> + >>> + >>> + >>> >>> waffle_display_supports_context_api() >>> >>> >>> diff --git a/src/waffle/api/waffle_display.c >>> b/src/waffle/api/waffle_display.c >>> index fa19462..7abe2ef 100644 >>> --- a/src/waffle/api/waffle_display.c >>> +++ b/src/waffle/api/waffle_display.c >>> @@ -23,13 +23,61 @@ >>> // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF >>> THE USE >>> // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >>> >>> +#include >>> +#include >>> + >>> #include "api_priv.h" >>> >>> -#include "wcore_error.h" >>> +#include "json.h" >>> + >>> +#include "wcore_context.h" >>> #include "wcore_display.h" >>> +#include "wcore_error.h" >>> #include "wcore_platform.h" >>> #include "wcore_util.h" >>> >>> +typedef unsigned int GLint; >>> +typedef unsigned int GLenum; >>> +typedef unsigned char GLubyte; >>> + >>> +enum { >>> +// Copied from . >>> +GL_NO_ERROR = 0, >>> + >>> +GL_CONTEXT_FLAGS = 0x821e, >>> +GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001, >>> +GL_CONTEXT_FLAG_DEBUG_BIT = 0x0002, >>> +GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x0004, >>> + >>> +GL_VENDOR = 0x1F00, >>> +GL_RENDERER= 0x1F01, >>> +GL_VERSION = 0x1F02, >>> +GL_EXTENSIONS = 0x1F03, >>> +GL_NUM_EXTENSIONS = 0x821D, >>> +GL_SHADING_LANGUAGE_VERSION= 0x8B8C, >>> +}; >>> + >>> +#ifndef _WIN32 >>> +#define APIENTRY >>> +#else >>> +#ifndef APIENTRY >>> +#define APIENTRY __stdcall >>> +#endif >>> +#endif >>> + >>> +static GLenum (APIENTRY *glGetError)(void); >>> +static void (APIENTRY *glGetIntegerv)(GLenum pname, GLint *params); >>> +static const GLubyte * (APIENTRY
Re: [waffle] [PATCH 05/12] waffle: add waffle_display_info_json()
On Fri, Jan 8, 2016 at 7:40 AM, Emil Velikovwrote: > On 6 January 2016 at 21:56, Frank Henigman wrote: >> Duplicate wflinfo functionality in the API, with the difference that the >> information is returned in JSON form. >> The function has a parameter for including platform-specific information, >> but it is ignored for now. >> >> Signed-off-by: Frank Henigman >> --- >> include/waffle/waffle.h | 5 + >> man/waffle_display.3.xml| 19 +++ >> src/waffle/api/waffle_display.c | 284 >> +++- >> src/waffle/waffle.def.in| 1 + >> 4 files changed, 308 insertions(+), 1 deletion(-) >> >> diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h >> index df0218e..1800399 100644 >> --- a/include/waffle/waffle.h >> +++ b/include/waffle/waffle.h >> @@ -214,6 +214,11 @@ bool >> waffle_display_supports_context_api(struct waffle_display *self, >> int32_t context_api); >> >> +#if WAFFLE_API_VERSION >= 0x0106 >> +char* >> +waffle_display_info_json(struct waffle_display *self, bool platform_too); > The function does not work solely with the display, but it requires a > (bound) context. Thus it does not really fit waffle naming scheme. I'm > afraid that I'm short of suggestions though (barring my "returning > json formatted data sounds iffy, lets use tokens" rant from earlier) > > >> +#endif >> + >> union waffle_native_display* >> waffle_display_get_native(struct waffle_display *self); >> >> diff --git a/man/waffle_display.3.xml b/man/waffle_display.3.xml >> index 9896247..5358472 100644 >> --- a/man/waffle_display.3.xml >> +++ b/man/waffle_display.3.xml >> @@ -24,6 +24,7 @@ >> waffle_display >> waffle_display_connect >> waffle_display_disconnect >> +waffle_display_info_json >> waffle_display_supports_context_api >> waffle_display_get_native >> class waffle_display >> @@ -58,6 +59,12 @@ struct waffle_display; >> >> >> >> +char* >> waffle_display_info_json >> +struct waffle_display >> *self >> +bool platform_info >> + >> + >> + >> bool >> waffle_display_supports_context_api >> struct waffle_display >> *self >> int32_t context_api >> @@ -129,6 +136,18 @@ struct waffle_display; >> >> >> >> +waffle_display_info_json() >> + >> + >> +Return a JSON string containing information about the current >> context on the given display, including Waffle platform and API, GL >> version/vendor/renderer and extensions. >> +If platform_info is true, >> platform-specific information (such as GLX or EGL versions and extensions) >> will be included as available. >> +Returns NULL on error. >> +The string should be deallocated with >> free3. >> + >> + >> + >> + >> + >> >> waffle_display_supports_context_api() >> >> >> diff --git a/src/waffle/api/waffle_display.c >> b/src/waffle/api/waffle_display.c >> index fa19462..7abe2ef 100644 >> --- a/src/waffle/api/waffle_display.c >> +++ b/src/waffle/api/waffle_display.c >> @@ -23,13 +23,61 @@ >> // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF >> THE USE >> // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> >> +#include >> +#include >> + >> #include "api_priv.h" >> >> -#include "wcore_error.h" >> +#include "json.h" >> + >> +#include "wcore_context.h" >> #include "wcore_display.h" >> +#include "wcore_error.h" >> #include "wcore_platform.h" >> #include "wcore_util.h" >> >> +typedef unsigned int GLint; >> +typedef unsigned int GLenum; >> +typedef unsigned char GLubyte; >> + >> +enum { >> +// Copied from . >> +GL_NO_ERROR = 0, >> + >> +GL_CONTEXT_FLAGS = 0x821e, >> +GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001, >> +GL_CONTEXT_FLAG_DEBUG_BIT = 0x0002, >> +GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x0004, >> + >> +GL_VENDOR = 0x1F00, >> +GL_RENDERER= 0x1F01, >> +GL_VERSION = 0x1F02, >> +GL_EXTENSIONS = 0x1F03, >> +GL_NUM_EXTENSIONS = 0x821D, >> +GL_SHADING_LANGUAGE_VERSION= 0x8B8C, >> +}; >> + >> +#ifndef _WIN32 >> +#define APIENTRY >> +#else >> +#ifndef APIENTRY >> +#define APIENTRY __stdcall >> +#endif >> +#endif >> + >> +static GLenum (APIENTRY *glGetError)(void); >> +static void (APIENTRY *glGetIntegerv)(GLenum pname, GLint *params); >> +static const GLubyte * (APIENTRY *glGetString)(GLenum name); >> +static const GLubyte * (APIENTRY *glGetStringi)(GLenum name, GLint i); >> + >> +#if defined(__GNUC__) >> +#define NORETURN __attribute__((noreturn)) >> +#elif defined(_MSC_VER) >> +#define
Re: [waffle] [PATCH 05/12] waffle: add waffle_display_info_json()
On 6 January 2016 at 21:56, Frank Henigmanwrote: > Duplicate wflinfo functionality in the API, with the difference that the > information is returned in JSON form. > The function has a parameter for including platform-specific information, > but it is ignored for now. > > Signed-off-by: Frank Henigman > --- > include/waffle/waffle.h | 5 + > man/waffle_display.3.xml| 19 +++ > src/waffle/api/waffle_display.c | 284 > +++- > src/waffle/waffle.def.in| 1 + > 4 files changed, 308 insertions(+), 1 deletion(-) > > diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h > index df0218e..1800399 100644 > --- a/include/waffle/waffle.h > +++ b/include/waffle/waffle.h > @@ -214,6 +214,11 @@ bool > waffle_display_supports_context_api(struct waffle_display *self, > int32_t context_api); > > +#if WAFFLE_API_VERSION >= 0x0106 > +char* > +waffle_display_info_json(struct waffle_display *self, bool platform_too); The function does not work solely with the display, but it requires a (bound) context. Thus it does not really fit waffle naming scheme. I'm afraid that I'm short of suggestions though (barring my "returning json formatted data sounds iffy, lets use tokens" rant from earlier) > +#endif > + > union waffle_native_display* > waffle_display_get_native(struct waffle_display *self); > > diff --git a/man/waffle_display.3.xml b/man/waffle_display.3.xml > index 9896247..5358472 100644 > --- a/man/waffle_display.3.xml > +++ b/man/waffle_display.3.xml > @@ -24,6 +24,7 @@ > waffle_display > waffle_display_connect > waffle_display_disconnect > +waffle_display_info_json > waffle_display_supports_context_api > waffle_display_get_native > class waffle_display > @@ -58,6 +59,12 @@ struct waffle_display; > > > > +char* > waffle_display_info_json > +struct waffle_display > *self > +bool platform_info > + > + > + > bool > waffle_display_supports_context_api > struct waffle_display > *self > int32_t context_api > @@ -129,6 +136,18 @@ struct waffle_display; > > > > +waffle_display_info_json() > + > + > +Return a JSON string containing information about the current > context on the given display, including Waffle platform and API, GL > version/vendor/renderer and extensions. > +If platform_info is true, > platform-specific information (such as GLX or EGL versions and extensions) > will be included as available. > +Returns NULL on error. > +The string should be deallocated with > free3. > + > + > + > + > + > > waffle_display_supports_context_api() > > > diff --git a/src/waffle/api/waffle_display.c b/src/waffle/api/waffle_display.c > index fa19462..7abe2ef 100644 > --- a/src/waffle/api/waffle_display.c > +++ b/src/waffle/api/waffle_display.c > @@ -23,13 +23,61 @@ > // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE > USE > // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > +#include > +#include > + > #include "api_priv.h" > > -#include "wcore_error.h" > +#include "json.h" > + > +#include "wcore_context.h" > #include "wcore_display.h" > +#include "wcore_error.h" > #include "wcore_platform.h" > #include "wcore_util.h" > > +typedef unsigned int GLint; > +typedef unsigned int GLenum; > +typedef unsigned char GLubyte; > + > +enum { > +// Copied from . > +GL_NO_ERROR = 0, > + > +GL_CONTEXT_FLAGS = 0x821e, > +GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001, > +GL_CONTEXT_FLAG_DEBUG_BIT = 0x0002, > +GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x0004, > + > +GL_VENDOR = 0x1F00, > +GL_RENDERER= 0x1F01, > +GL_VERSION = 0x1F02, > +GL_EXTENSIONS = 0x1F03, > +GL_NUM_EXTENSIONS = 0x821D, > +GL_SHADING_LANGUAGE_VERSION= 0x8B8C, > +}; > + > +#ifndef _WIN32 > +#define APIENTRY > +#else > +#ifndef APIENTRY > +#define APIENTRY __stdcall > +#endif > +#endif > + > +static GLenum (APIENTRY *glGetError)(void); > +static void (APIENTRY *glGetIntegerv)(GLenum pname, GLint *params); > +static const GLubyte * (APIENTRY *glGetString)(GLenum name); > +static const GLubyte * (APIENTRY *glGetStringi)(GLenum name, GLint i); > + > +#if defined(__GNUC__) > +#define NORETURN __attribute__((noreturn)) > +#elif defined(_MSC_VER) > +#define NORETURN __declspec(noreturn) > +#else > +#define NORETURN > +#endif > + > WAFFLE_API struct waffle_display* > waffle_display_connect(const char *name) > { > @@ -90,6 +138,240 @@ waffle_display_supports_context_api( >
[waffle] [PATCH 05/12] waffle: add waffle_display_info_json()
Duplicate wflinfo functionality in the API, with the difference that the information is returned in JSON form. The function has a parameter for including platform-specific information, but it is ignored for now. Signed-off-by: Frank Henigman--- include/waffle/waffle.h | 5 + man/waffle_display.3.xml| 19 +++ src/waffle/api/waffle_display.c | 284 +++- src/waffle/waffle.def.in| 1 + 4 files changed, 308 insertions(+), 1 deletion(-) diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h index df0218e..1800399 100644 --- a/include/waffle/waffle.h +++ b/include/waffle/waffle.h @@ -214,6 +214,11 @@ bool waffle_display_supports_context_api(struct waffle_display *self, int32_t context_api); +#if WAFFLE_API_VERSION >= 0x0106 +char* +waffle_display_info_json(struct waffle_display *self, bool platform_too); +#endif + union waffle_native_display* waffle_display_get_native(struct waffle_display *self); diff --git a/man/waffle_display.3.xml b/man/waffle_display.3.xml index 9896247..5358472 100644 --- a/man/waffle_display.3.xml +++ b/man/waffle_display.3.xml @@ -24,6 +24,7 @@ waffle_display waffle_display_connect waffle_display_disconnect +waffle_display_info_json waffle_display_supports_context_api waffle_display_get_native class waffle_display @@ -58,6 +59,12 @@ struct waffle_display; +char* waffle_display_info_json +struct waffle_display *self +bool platform_info + + + bool waffle_display_supports_context_api struct waffle_display *self int32_t context_api @@ -129,6 +136,18 @@ struct waffle_display; +waffle_display_info_json() + + +Return a JSON string containing information about the current context on the given display, including Waffle platform and API, GL version/vendor/renderer and extensions. +If platform_info is true, platform-specific information (such as GLX or EGL versions and extensions) will be included as available. +Returns NULL on error. +The string should be deallocated with free3. + + + + + waffle_display_supports_context_api() diff --git a/src/waffle/api/waffle_display.c b/src/waffle/api/waffle_display.c index fa19462..7abe2ef 100644 --- a/src/waffle/api/waffle_display.c +++ b/src/waffle/api/waffle_display.c @@ -23,13 +23,61 @@ // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include +#include + #include "api_priv.h" -#include "wcore_error.h" +#include "json.h" + +#include "wcore_context.h" #include "wcore_display.h" +#include "wcore_error.h" #include "wcore_platform.h" #include "wcore_util.h" +typedef unsigned int GLint; +typedef unsigned int GLenum; +typedef unsigned char GLubyte; + +enum { +// Copied from . +GL_NO_ERROR = 0, + +GL_CONTEXT_FLAGS = 0x821e, +GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001, +GL_CONTEXT_FLAG_DEBUG_BIT = 0x0002, +GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x0004, + +GL_VENDOR = 0x1F00, +GL_RENDERER= 0x1F01, +GL_VERSION = 0x1F02, +GL_EXTENSIONS = 0x1F03, +GL_NUM_EXTENSIONS = 0x821D, +GL_SHADING_LANGUAGE_VERSION= 0x8B8C, +}; + +#ifndef _WIN32 +#define APIENTRY +#else +#ifndef APIENTRY +#define APIENTRY __stdcall +#endif +#endif + +static GLenum (APIENTRY *glGetError)(void); +static void (APIENTRY *glGetIntegerv)(GLenum pname, GLint *params); +static const GLubyte * (APIENTRY *glGetString)(GLenum name); +static const GLubyte * (APIENTRY *glGetStringi)(GLenum name, GLint i); + +#if defined(__GNUC__) +#define NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define NORETURN __declspec(noreturn) +#else +#define NORETURN +#endif + WAFFLE_API struct waffle_display* waffle_display_connect(const char *name) { @@ -90,6 +138,240 @@ waffle_display_supports_context_api( context_api); } +static int +parse_version(const char *version) +{ +int count, major, minor; + +if (version == NULL) +return 0; + +while (*version != '\0' && !isdigit(*version)) +version++; + +count = sscanf(version, "%d.%d", , ); +if (count != 2) +return 0; + +if (minor > 9) +return 0; + +return (major * 10) + minor; +} + +static void +add_context_flags(struct json *jj) +{ +static struct { +GLint flag; +char *str; +} flags[] = { +{ GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, "FORWARD_COMPATIBLE" }, +{