2c8e230f3ef6339457ac338f8628e632f3700350
[mesa.git] / src / mesa / drivers / dri / s3v / s3v_dd.c
1 /*
2 * Author: Max Lingua <sunmax@libero.it>
3 */
4
5 #include "s3v_context.h"
6 #include "s3v_vb.h"
7 #include "s3v_lock.h"
8 #if defined(USE_X86_ASM)
9 #include "x86/common_x86_asm.h"
10 #endif
11
12 #include "context.h"
13 #include "framebuffer.h"
14 #include "swrast/swrast.h"
15
16 #define S3V_DATE "20020207"
17
18
19 /* Return the width and height of the current color buffer.
20 */
21 static void s3vDDGetBufferSize( GLframebuffer *buffer,
22 GLuint *width, GLuint *height )
23 {
24 GET_CURRENT_CONTEXT(ctx);
25 s3vContextPtr vmesa = S3V_CONTEXT(ctx);
26
27 /* S3VHW_LOCK( vmesa ); */
28 *width = vmesa->driDrawable->w;
29 *height = vmesa->driDrawable->h;
30 /* S3VHW_UNLOCK( vmesa ); */
31 }
32
33
34 /* Return various strings for glGetString().
35 */
36 static const GLubyte *s3vDDGetString( GLcontext *ctx, GLenum name )
37 {
38 static char buffer[128];
39
40 switch ( name ) {
41 case GL_VENDOR:
42 return (GLubyte *)"Max Lingua (ladybug)";
43
44 case GL_RENDERER:
45 sprintf( buffer, "Mesa DRI S3 Virge " S3V_DATE );
46
47 /* Append any CPU-specific information.
48 */
49 #ifdef USE_X86_ASM
50 if ( _mesa_x86_cpu_features ) {
51 strncat( buffer, " x86", 4 );
52
53 }
54 #ifdef USE_MMX_ASM
55 if ( cpu_has_mmx ) {
56 strncat( buffer, "/MMX", 4 );
57 }
58 #endif
59 #ifdef USE_3DNOW_ASM
60 if ( cpu_has_3dnow ) {
61 strncat( buffer, "/3DNow!", 7 );
62 }
63 #endif
64 #ifdef USE_SSE_ASM
65 if ( cpu_has_xmm ) {
66 strncat( buffer, "/SSE", 4 );
67 }
68 #endif
69 #endif
70 return (GLubyte *)buffer;
71
72 default:
73 return NULL;
74 }
75 }
76
77 /* Enable the extensions supported by this driver.
78 */
79 void s3vInitExtensions( GLcontext *ctx )
80 {
81 /* None... */
82 }
83
84 /* Initialize the driver's misc functions.
85 */
86 void s3vInitDriverFuncs( GLcontext *ctx )
87 {
88 ctx->Driver.GetBufferSize = s3vDDGetBufferSize;
89 ctx->Driver.GetString = s3vDDGetString;
90
91 ctx->Driver.Error = NULL;
92
93 /* Pixel path fallbacks
94 */
95 ctx->Driver.Accum = _swrast_Accum;
96 ctx->Driver.Bitmap = _swrast_Bitmap;
97 ctx->Driver.CopyPixels = _swrast_CopyPixels;
98 ctx->Driver.DrawPixels = _swrast_DrawPixels;
99 ctx->Driver.ReadPixels = _swrast_ReadPixels;
100 ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
101
102 /* Swrast hooks for imaging extensions:
103 */
104 ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
105 ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
106 ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
107 ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
108 }