#include "gamma_context.h"
#include "gamma_vb.h"
#include "gamma_lock.h"
#if defined(USE_X86_ASM)
#include "X86/common_x86_asm.h"
#endif
#include "context.h"
#include "swrast/swrast.h"
#define GAMMA_DATE "20021125"
static void gammaDDGetBufferSize( GLframebuffer *buffer,
GLuint *width, GLuint *height )
{
GET_CURRENT_CONTEXT(ctx);
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
GAMMAHW_LOCK( gmesa );
*width = gmesa->driDrawable->w;
*height = gmesa->driDrawable->h;
GAMMAHW_UNLOCK( gmesa );
}
static const GLubyte *gammaDDGetString( GLcontext *ctx, GLenum name )
{
static char buffer[128];
switch ( name ) {
case GL_VENDOR:
return (GLubyte *)"VA Linux Systems, Inc.";
case GL_RENDERER:
sprintf( buffer, "Mesa DRI Gamma " GAMMA_DATE );
#ifdef USE_X86_ASM
if ( _mesa_x86_cpu_features ) {
strncat( buffer, " x86", 4 );
}
#ifdef USE_MMX_ASM
if ( cpu_has_mmx ) {
strncat( buffer, "/MMX", 4 );
}
#endif
#ifdef USE_3DNOW_ASM
if ( cpu_has_3dnow ) {
strncat( buffer, "/3DNow!", 7 );
}
#endif
#ifdef USE_SSE_ASM
if ( cpu_has_xmm ) {
strncat( buffer, "/SSE", 4 );
}
#endif
#endif
return (GLubyte *)buffer;
default:
return NULL;
}
}
void gammaDDInitExtensions( GLcontext *ctx )
{
}
void gammaDDInitDriverFuncs( GLcontext *ctx )
{
ctx->Driver.GetBufferSize = gammaDDGetBufferSize;
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.GetString = gammaDDGetString;
ctx->Driver.Error = NULL;
ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.Bitmap = _swrast_Bitmap;
ctx->Driver.CopyPixels = _swrast_CopyPixels;
ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = _swrast_ReadPixels;
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
}