[Mesa-dev] [PATCH 05/20] mesa/es: Validate glGetString pname in Mesa code rather than the ES wrapper
Ian Romanick
idr at freedesktop.org
Fri Aug 24 08:46:49 PDT 2012
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/main/APIspec.xml | 8 --------
src/mesa/main/getstring.c | 19 ++++++++++++-------
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 6df4b92..de73640 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -855,14 +855,6 @@
<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">
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 1734fb3..c99486a 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -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;
}
--
1.7.6.5
More information about the mesa-dev
mailing list