st_cb_strings.c

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
00004  * All Rights Reserved.
00005  * 
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  * 
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  * 
00026  **************************************************************************/
00027 
00028  /*
00029   * Authors:
00030   *   Keith Whitwell <keith@tungstengraphics.com>
00031   *   Brian Paul
00032   */
00033 
00034 #include "main/glheader.h"
00035 #include "main/macros.h"
00036 #include "main/version.h"
00037 #include "pipe/p_context.h"
00038 #include "pipe/p_screen.h"
00039 #include "pipe/p_winsys.h"
00040 #include "st_context.h"
00041 #include "st_cb_strings.h"
00042 
00043 #define ST_VERSION_STRING "0.1"
00044 
00045 static const GLubyte *
00046 st_get_string(GLcontext * ctx, GLenum name)
00047 {
00048    struct st_context *st = st_context(ctx);
00049    struct pipe_screen *screen = st->pipe->screen;
00050 
00051    switch (name) {
00052    case GL_VENDOR: {
00053       const char *vendor = screen->get_vendor( screen );
00054       const char *tungsten = "Tungsten Graphics, Inc.";
00055 
00056       /* Tungsten Graphics, Inc. developed the state_tracker module
00057        * (and much of Mesa), but the driver itself may come from elsewhere.
00058        * The additional string allows "and XyzCorp" to reflect this.
00059        */
00060       if (vendor && strcmp(vendor, tungsten) != 0)
00061          util_snprintf(st->vendor, sizeof(st->vendor),
00062                   "%s and %s", tungsten, vendor);
00063       else
00064          util_snprintf(st->vendor, sizeof(st->vendor), "%s", tungsten);
00065 
00066       return (GLubyte *) st->vendor;
00067    }
00068 
00069    case GL_RENDERER:
00070       util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s, %s on %s", 
00071                ST_VERSION_STRING,
00072                screen->get_name( screen ),
00073                screen->winsys->get_name( screen->winsys ));
00074 
00075       return (GLubyte *) st->renderer;
00076 
00077    default:
00078       return NULL;
00079    }
00080 }
00081 
00082 
00083 void st_init_string_functions(struct dd_function_table *functions)
00084 {
00085    functions->GetString = st_get_string;
00086 }

Generated on Tue Sep 29 06:25:18 2009 for Gallium3D by  doxygen 1.5.4