summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r--src/mesa/main/get.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index ed0ba23da8a..924f75a74c9 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.12 2000/02/06 03:03:02 brianp Exp $ */
+/* $Id: get.c,v 1.13 2000/02/17 20:53:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -3933,47 +3933,32 @@ const GLubyte *
_mesa_GetString( GLenum name )
{
GET_CURRENT_CONTEXT(ctx);
- static char result[1000];
static char *vendor = "Brian Paul";
+ static char *renderer = "Mesa";
static char *version = "1.2 Mesa 3.3 beta";
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0);
- /* First see if device driver can satisfy this call */
- switch (name) {
- case GL_VENDOR:
- case GL_RENDERER:
- case GL_VERSION:
- if (ctx->Driver.GetString) {
- const GLubyte *str = (*ctx->Driver.GetString)(ctx, name);
- if (str && str[0])
- return str;
- }
- break;
- /* Extensions always handled by extensions.c */
- case GL_EXTENSIONS:
- return (GLubyte *) gl_extensions_get_string( ctx );
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetString" );
- return (GLubyte *) 0;
- }
-
- /* If we get here, device driver didn't return a string */
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *) vendor;
- case GL_RENDERER:
- strcpy(result, "Mesa");
- if (ctx->Driver.RendererString) {
- strcat(result, " ");
- strcat(result, (*ctx->Driver.RendererString)());
- }
- return (GLubyte *) result;
- case GL_VERSION:
- return (GLubyte *) version;
- default:
- /* caught above */
- return NULL;
+ /* this is a required driver function */
+ assert(ctx->Driver.GetString);
+ {
+ const GLubyte *str = (*ctx->Driver.GetString)(ctx, name);
+ if (str)
+ return str;
+
+ switch (name) {
+ case GL_VENDOR:
+ return (const GLubyte *) vendor;
+ case GL_RENDERER:
+ return (const GLubyte *) renderer;
+ case GL_VERSION:
+ return (const GLubyte *) version;
+ case GL_EXTENSIONS:
+ return (GLubyte *) gl_extensions_get_string( ctx );
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glGetString" );
+ return (GLubyte *) 0;
+ }
}
}