diff options
author | Vadym Shovkoplias <[email protected]> | 2018-02-13 11:38:22 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-02-13 13:24:31 -0700 |
commit | a553c54abf92533daf442073dd3408c35f57d8ba (patch) | |
tree | ad6a333c33af4ae7f045b2a47c5624a9810f1fbd /src/mesa/main/getstring.c | |
parent | b08d718703bc907d9cb99887f90ea80d7e91dc45 (diff) |
mesa: add glsl version query (v4)
Add support for GL_NUM_SHADING_LANGUAGE_VERSIONS
and glGetStringi for GL_SHADING_LANGUAGE_VERSION
v2:
- Combine similar functionality into
_mesa_get_shading_language_version() function.
- Change GLSL version return mechanism.
v3:
- Add return of empty string for GLSL ver 1.10.
- Move _mesa_get_shading_language_version() function
to src/mesa/main/version.c.
v4:
- Add OpenGL version check.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104915
Signed-off-by: Andriy Khulap <[email protected]>
Signed-off-by: Vadym Shovkoplias <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/getstring.c')
-rw-r--r-- | src/mesa/main/getstring.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 931f6a476cb..3d5ae0b694b 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -32,6 +32,7 @@ #include "extensions.h" #include "mtypes.h" #include "macros.h" +#include "version.h" /** * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query. @@ -186,6 +187,25 @@ _mesa_GetStringi(GLenum name, GLuint index) return (const GLubyte *) 0; } return _mesa_get_enabled_extension(ctx, index); + case GL_SHADING_LANGUAGE_VERSION: + { + char *version; + int num; + if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 43) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetStringi(GL_SHADING_LANGUAGE_VERSION): " + "supported only in GL4.3 and later"); + return (const GLubyte *) 0; + } + num = _mesa_get_shading_language_version(ctx, index, &version); + if (index >= num) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetStringi(GL_SHADING_LANGUAGE_VERSION, index=%d)", + index); + return (const GLubyte *) 0; + } + return (const GLubyte *) version; + } default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetStringi"); return (const GLubyte *) 0; |