-/* $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
*** 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 );
*** 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.
-/* $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
_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;
+ }
}
}