diff options
-rw-r--r-- | src/mesa/main/dd.h | 23 | ||||
-rw-r--r-- | src/mesa/main/get.c | 59 |
2 files changed, 27 insertions, 55 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 2c6ae5ef375..63dcd6fdb38 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.9 2000/01/06 09:28:07 brianp Exp $ */ +/* $Id: dd.h,v 1.10 2000/02/17 20:53:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -139,12 +139,10 @@ struct dd_function_table { *** every device driver. *** **********************************************************************/ - const char * (*RendererString)(void); - /* - * Return a string which uniquely identifies this device driver. - * The string should contain no whitespace. Examples: "X11", "OffScreen", - * "MSWindows", "SVGA". - * NOTE: This function will be obsolete in favor of GetString in the future! + const GLubyte * (*GetString)( GLcontext *ctx, GLenum name ); + /* Return a string as needed by glGetString(). + * Only the GL_RENDERER token must be implemented. Otherwise, + * NULL can be returned. */ void (*UpdateState)( GLcontext *ctx ); @@ -328,17 +326,6 @@ struct dd_function_table { *** fall-back function. *** **********************************************************************/ - const char * (*ExtensionString)( GLcontext *ctx ); - /* Return a space-separated list of extensions for this driver. - * NOTE: This function will be obsolete in favor of GetString in the future! - */ - - const GLubyte * (*GetString)( GLcontext *ctx, GLenum name ); - /* Return a string as needed by glGetString(). - * NOTE: This will replace the ExtensionString and RendererString - * functions in the future! - */ - void (*Finish)( GLcontext *ctx ); /* * This is called whenever glFinish() is called. 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; + } } } |