mesa: implement unpack_SIGNED_GR1616 in format_unpack.c
[mesa.git] / src / mesa / main / getstring.c
index 5e4fcd599c39c7fbe230303de2d1da5f353e0c31..c381fb2dfdf6047c4d96bbbc7fa3957a01f0c3fe 100644 (file)
 #include "get.h"
 #include "enums.h"
 #include "extensions.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 
+
+/**
+ * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query.
+ */
 static const GLubyte *
-shading_language_version(GLcontext *ctx)
+shading_language_version(struct gl_context *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;
    }
 }
@@ -217,7 +235,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
  * Returns the current GL error code, or GL_NO_ERROR.
  * \return current error code
  *
- * Returns __GLcontextRec::ErrorValue.
+ * Returns __struct gl_contextRec::ErrorValue.
  */
 GLenum GLAPIENTRY
 _mesa_GetError( void )
@@ -233,3 +251,20 @@ _mesa_GetError( void )
    ctx->ErrorDebugCount = 0;
    return e;
 }
+
+/**
+ * Returns an error code specified by GL_ARB_robustness, or GL_NO_ERROR.
+ * \return current context status
+ */
+GLenum GLAPIENTRY
+_mesa_GetGraphicsResetStatusARB( void )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLenum status = ctx->ResetStatus;
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glGetGraphicsResetStatusARB"
+                       "(always returns GL_NO_ERROR)\n");
+
+   return status;
+}