diff options
Diffstat (limited to 'src/mesa/main/getstring.c')
-rw-r--r-- | src/mesa/main/getstring.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 5e4fcd599c3..3910047fb5d 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -30,26 +30,42 @@ #include "enums.h" #include "extensions.h" + +/** + * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query. + */ static const GLubyte * shading_language_version(GLcontext *ctx) { switch (ctx->API) { -#if FEATURE_ARB_shading_language_100 case API_OPENGL: - if (ctx->Extensions.ARB_shading_language_120) - return (const GLubyte *) "1.20"; - else if (ctx->Extensions.ARB_shading_language_100) - return (const GLubyte *) "1.10"; - goto error; -#endif + if (!ctx->Extensions.ARB_shader_objects) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetString"); + return (const GLubyte *) 0; + } + + switch (ctx->Const.GLSLVersion) { + case 110: + return (const GLubyte *) "1.10"; + case 120: + return (const GLubyte *) "1.20"; + case 130: + return (const GLubyte *) "1.30"; + default: + _mesa_problem(ctx, + "Invalid GLSL version in shading_language_version()"); + return (const GLubyte *) 0; + } + break; case API_OPENGLES2: return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16"; case API_OPENGLES: + /* fall-through */ + default: - error: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); + _mesa_problem(ctx, "Unexpected API value in shading_language_version()"); return (const GLubyte *) 0; } } |