mesa/es: Validate glGetString pname in Mesa code rather than the ES wrapper
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 25 Jul 2012 22:39:50 +0000 (15:39 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 29 Aug 2012 22:09:34 +0000 (15:09 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/APIspec.xml
src/mesa/main/getstring.c

index 6df4b921d00a84dd54aa1bb651e18a2fae00b2a9..de7364091b9cf9b4eba2b369b9f6b5f83988b8a7 100644 (file)
                <return type="const GLubyte *"/>
                <param name="name" type="GLenum"/>
        </proto>
-
-       <desc name="name">
-               <value name="GL_VENDOR"/>
-               <value name="GL_RENDERER"/>
-               <value name="GL_VERSION"/>
-               <value name="GL_EXTENSIONS"/>
-               <value name="GL_SHADING_LANGUAGE_VERSION" category="GLES2.0"/>
-       </desc>
 </template>
 
 <template name="GetTexEnv" direction="get">
index 1734fb3f5e7c11472bcb216bc7d701c8f52a80b7..c99486a4bb3f425e61e95b6c74a5de9071a36941 100644 (file)
@@ -129,23 +129,28 @@ _mesa_GetString( GLenum name )
          return (const GLubyte *) ctx->Extensions.String;
 #if FEATURE_ARB_shading_language_100 || FEATURE_ES2
       case GL_SHADING_LANGUAGE_VERSION:
+         if (ctx->API == API_OPENGLES)
+            break;
         return shading_language_version(ctx);
 #endif
 #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \
     FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
       case GL_PROGRAM_ERROR_STRING_NV:
-         if (ctx->Extensions.NV_fragment_program ||
-             ctx->Extensions.ARB_fragment_program ||
-             ctx->Extensions.NV_vertex_program ||
-             ctx->Extensions.ARB_vertex_program) {
+         if (ctx->API == API_OPENGL &&
+             (ctx->Extensions.NV_fragment_program ||
+              ctx->Extensions.ARB_fragment_program ||
+              ctx->Extensions.NV_vertex_program ||
+              ctx->Extensions.ARB_vertex_program)) {
             return (const GLubyte *) ctx->Program.ErrorString;
          }
-         /* FALL-THROUGH */
+         break;
 #endif
       default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
-         return (const GLubyte *) 0;
+         break;
    }
+
+   _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
+   return (const GLubyte *) 0;
 }