summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDylan Baker <dylanx.c.baker@intel.com>2014-11-19 10:49:42 -0800
committerDylan Baker <dylanx.c.baker@intel.com>2014-11-19 10:49:42 -0800
commitb87d221a0155df50f51b88b3163d0cf237eda028 (patch)
tree19cc3fcde3a2325509d8160f6c7f4ca07632aac9 /src
parentba3ecac0d11b496d26460fc4789099c4e9e4d614 (diff)
wflinfo: add GLSL version information to wflinfo
For versions that do not provide a shader version (GL ES 1.x, GL < 2.0) print "None", otherwise print the value of GL_SHADING_LANGUAGE_VERSION. None was picked because it is simple, obvious, and unlike N/A can't be expanded into multiple meanings v2: - Don't print for gles1, since gles1 doesn't have a shading language and will always return FLINFO_GL_ERROR v3: - Print 'None' for GL ES 1.x and GL < 2.0 - Only print shader_version in verbose mode Fixes: https://github.com/waffle-gl/waffle/issues/16 Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/utils/wflinfo.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
index c2af4dc..6e34c15 100644
--- a/src/utils/wflinfo.c
+++ b/src/utils/wflinfo.c
@@ -209,6 +209,7 @@ enum {
GL_VERSION = 0x1F02,
GL_EXTENSIONS = 0x1F03,
GL_NUM_EXTENSIONS = 0x821D,
+ GL_SHADING_LANGUAGE_VERSION = 0x8B8C,
};
#define WINDOW_WIDTH 320
@@ -574,8 +575,25 @@ print_wflinfo(const struct options *opts)
if (!glGetStringi && use_getstringi)
error_get_gl_symbol("glGetStringi");
- if (opts->verbose)
+ if (opts->verbose) {
+ // There are two exceptional cases where wflinfo may not get a
+ // version (or a valid version): one is in gles1 and the other
+ // is GL < 2.0. In these cases do not return WFLINFO_GL_ERROR,
+ // return None. This is preferable to returning WFLINFO_GL_ERROR
+ // because it creates a consistant interface for parsers
+ const char *language_str = "None";
+ if ((opts->context_api == WAFFLE_CONTEXT_OPENGL && version >= 20) ||
+ opts->context_api == WAFFLE_CONTEXT_OPENGL_ES2 ||
+ opts->context_api == WAFFLE_CONTEXT_OPENGL_ES3) {
+ language_str = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION);
+ if (glGetError() != GL_NO_ERROR || language_str == NULL) {
+ language_str = "WFLINFO_GL_ERROR";
+ }
+ }
+
+ printf("OpenGL shading language version string: %s\n", language_str);
print_extensions(use_getstringi);
+ }
return true;
}