summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/unichrome/via_context.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2004-06-04 22:43:52 +0000
committerIan Romanick <idr@us.ibm.com>2004-06-04 22:43:52 +0000
commite3a07ba609b844de1d8378056261c8dd9f073cdb (patch)
tree80e9854651ff49b2f017f8d9638bcd0d3fdba5c8 /src/mesa/drivers/dri/unichrome/via_context.c
parente3789ebe7ddd6fafdaaa38d7570173bd26d226f9 (diff)
Start to "modernize" the driver.
Diffstat (limited to 'src/mesa/drivers/dri/unichrome/via_context.c')
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c81
1 files changed, 55 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index 9986bede6f..b349a5b63f 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -22,6 +22,14 @@
* DEALINGS IN THE SOFTWARE.
*/
+/**
+ * \file via_context.c
+ *
+ * \author John Sheng (presumably of either VIA Technologies or S3 Graphics)
+ * \author Others at VIA Technologies?
+ * \author Others at S3 Graphics?
+ */
+
#include "glheader.h"
#include "context.h"
#include "matrix.h"
@@ -54,6 +62,10 @@
#include <stdio.h>
#include "macros.h"
+#define DRIVER_DATE "20020221"
+
+#include "utils.h"
+
viaContextPtr current_mesa;
GLuint VIA_DEBUG = 0;
GLuint DRAW_FRONT = 0;
@@ -97,16 +109,34 @@ AllocateBuffer(viaContextPtr vmesa)
return GL_TRUE;
}
+/**
+ * Return various strings for \c glGetString.
+ *
+ * \todo
+ * This function should look at the PCI ID of the chipset to determine what
+ * name to use. Users with a KM400, for example, might get confused when
+ * the driver says "CLE266". Having the correct information may also help
+ * folks on the DRI mailing lists debug problems for people.
+ *
+ * \sa glGetString
+ */
static const GLubyte *viaGetString(GLcontext *ctx, GLenum name)
{
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *)"VIA Technology";
- case GL_RENDERER:
- return (GLubyte *)"Mesa DRI VIA CLE266 20020221";
- default:
- return 0;
- }
+ static char buffer[128];
+ unsigned offset;
+
+
+ switch (name) {
+ case GL_VENDOR:
+ return (GLubyte *)"VIA Technology";
+
+ case GL_RENDERER:
+ offset = driGetRendererString( buffer, "CLE266", DRIVER_DATE, 0 );
+ return (GLubyte *)buffer;
+
+ default:
+ return NULL;
+ }
}
void viaReAllocateBuffers(GLframebuffer *drawbuffer)
@@ -227,24 +257,23 @@ static void viaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
*height = vmesa->driDrawable->h;
}
-static void viaInitExtensions(GLcontext *ctx)
+/* Extension strings exported by the Unichrome driver.
+ */
+static const char * const card_extensions[] =
{
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_extension(ctx, "GL_ARB_multitexture");
- _mesa_enable_extension(ctx, "GL_ARB_texture_env_add");
- _mesa_enable_extension(ctx, "GL_EXT_texture_env_add");
- _mesa_enable_extension(ctx, "GL_EXT_stencil_wrap");
- _mesa_enable_extension(ctx, "GL_EXT_texture_lod_bias");
- /*=* John Sheng [2003.7.18] texture combine *=*/
- _mesa_enable_extension(ctx, "GL_ARB_texture_env_combine");
- _mesa_enable_extension(ctx, "GL_EXT_texture_env_combine");
- /*=* John Sheng [2003.7.18] texture dot3 *=*/
- _mesa_enable_extension(ctx, "GL_ARB_texture_env_dot3");
- _mesa_enable_extension(ctx, "GL_EXT_texture_env_dot3");
- /*=* John Sheng [2003.7.18] point parameters */
- _mesa_enable_extension(ctx, "GL_ARB_point_parameters");
- _mesa_enable_extension(ctx, "GL_EXT_point_parameters");
-}
+ "GL_ARB_multitexture",
+ "GL_ARB_point_parameters", /* John Sheng [2003.7.18] point param. */
+ "GL_ARB_texture_env_add",
+ "GL_ARB_texture_env_combine", /* John Sheng [2003.7.18] tex combine */
+ "GL_ARB_texture_env_dot3", /* John Sheng [2003.7.18] tex dot3 */
+ "GL_EXT_point_parameters", /* John Sheng [2003.7.18] point param. */
+ "GL_EXT_stencil_wrap",
+ "GL_EXT_texture_env_add",
+ "GL_EXT_texture_env_combine", /* John Sheng [2003.7.18] tex combine */
+ "GL_EXT_texture_env_dot3", /* John Sheng [2003.7.18] tex dot3 */
+ "GL_EXT_texture_lod_bias",
+ NULL
+};
extern const struct tnl_pipeline_stage _via_fastrender_stage;
extern const struct tnl_pipeline_stage _via_render_stage;
@@ -485,7 +514,7 @@ viaCreateContext(const __GLcontextModes *mesaVis,
_math_matrix_ctr(&vmesa->ViewportMatrix);
- viaInitExtensions(ctx);
+ driInitExtensions( ctx, card_extensions, GL_TRUE );
viaInitStateFuncs(ctx);
viaInitTextures(ctx);
viaInitTriFuncs(ctx);