-/* $Id: svgamesa.c,v 1.3 2000/01/23 17:49:54 brianp Exp $ */
+/* $Id: svgamesa.c,v 1.4 2000/01/25 00:03:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.2
+ * Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
SVGAlog(cbuf);
sprintf(cbuf,"SVGAMesaInit: done. (Mode %d)",GraphMode);
SVGAlog(cbuf);
-#endif
+#endif
+
+ SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
+ SVGABuffer.ReadBuffer = SVGABuffer.BackBuffer;
+
return 0;
}
int SVGAMesaClose( void )
{
- vga_setmode(TEXT);
- free(SVGABuffer.FrontBuffer);
- free(SVGABuffer.BackBuffer);
- return 0;
+ vga_setmode(TEXT);
+ free(SVGABuffer.FrontBuffer);
+ free(SVGABuffer.BackBuffer);
+ return 0;
}
void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue)
{
- if (ndx<256) vga_setpalette(ndx, red>>2, green>>2, blue>>2);
+ if (ndx<256)
+ vga_setpalette(ndx, red>>2, green>>2, blue>>2);
}
/**********************************************************************/
/***** Miscellaneous functions *****/
/**********************************************************************/
-static void copy_buffer( GLubyte * buffer) {
+static void copy_buffer( const GLubyte * buffer) {
int size = SVGABuffer.BufferSize, page = 0;
#ifdef SVGA_DEBUG
*height = SVGAMesa->height = vga_getydim();
}
-static GLboolean set_buffer( GLcontext *ctx, GLenum buffer )
+static GLboolean set_draw_buffer( GLcontext *ctx, GLenum buffer )
{
- void * tmpptr;
-
- if (buffer == GL_FRONT_LEFT)
- {
-/* vga_waitretrace(); */
- copy_buffer(SVGABuffer.FrontBuffer);
- tmpptr=SVGABuffer.BackBuffer;
- SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
- SVGABuffer.FrontBuffer=tmpptr;
- return GL_TRUE;
- }
- else if (buffer == GL_BACK_LEFT)
- {
-/* vga_waitretrace(); */
- copy_buffer(SVGABuffer.BackBuffer);
- return GL_TRUE;
+ if (buffer == GL_FRONT_LEFT) {
+ SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
+#if 0
+ /* vga_waitretrace(); */
+ void * tmpptr;
+ copy_buffer(SVGABuffer.FrontBuffer);
+ tmpptr=SVGABuffer.BackBuffer;
+ SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
+ SVGABuffer.FrontBuffer=tmpptr;
+#endif
+ return GL_TRUE;
}
+ else if (buffer == GL_BACK_LEFT) {
+ SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
+#if 0
+ /* vga_waitretrace(); */
+ copy_buffer(SVGABuffer.BackBuffer);
+#endif
+ return GL_TRUE;
+ }
else
return GL_FALSE;
}
+
+static void set_read_buffer( GLcontext *ctx, GLframebuffer *colorBuffer,
+ GLenum buffer )
+{
+ /* We can ignore colorBuffer since we don't support a MakeCurrentRead()
+ * function.
+ */
+ (void) colorBuffer;
+
+ if (buffer == GL_FRONT_LEFT) {
+ SVGABuffer.ReadBuffer = SVGABuffer.FrontBuffer;
+#if 0
+ void * tmpptr;
+ /* vga_waitretrace(); */
+ copy_buffer(SVGABuffer.FrontBuffer);
+ tmpptr=SVGABuffer.BackBuffer;
+ SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
+ SVGABuffer.FrontBuffer=tmpptr;
+#endif
+ }
+ else if (buffer == GL_BACK_LEFT) {
+ SVGABuffer.ReadBuffer = SVGABuffer.BackBuffer;
+#if 0
+ /* vga_waitretrace(); */
+ copy_buffer(SVGABuffer.BackBuffer);
+#endif
+ }
+}
+
/**********************************************************************/
/***** *****/
/**********************************************************************/
ctx->Driver.UpdateState = svgamesa_update_state;
- ctx->Driver.SetBuffer = set_buffer;
ctx->Driver.GetBufferSize = get_buffer_size;
+ ctx->Driver.SetDrawBuffer = set_draw_buffer;
+ ctx->Driver.SetReadBuffer = set_read_buffer;
ctx->Driver.PointsFunc = NULL;
ctx->Driver.LineFunc = NULL;
NULL, /* share list context */
(void *) ctx, GL_TRUE );
- ctx->gl_buffer = gl_create_framebuffer( ctx->gl_vis );
+ ctx->gl_buffer = gl_create_framebuffer( ctx->gl_vis,
+ ctx->gl_vis->DepthBits > 0,
+ ctx->gl_vis->StencilBits > 0,
+ ctx->gl_vis->AccumBits > 0,
+ ctx->gl_vis->AlphaBits > 0 );
ctx->index = 1;
ctx->red = ctx->green = ctx->blue = 255;
*/
void SVGAMesaSwapBuffers( void )
{
- void * tmpptr;
-
-/* vga_waitretrace(); */
- copy_buffer(SVGABuffer.BackBuffer);
+#if 000
+ void * tmpptr;
+#endif
+
+ /* vga_waitretrace(); */
+ copy_buffer(SVGABuffer.BackBuffer);
#ifndef DEV
FLUSH_VB( SVGAMesa->gl_ctx, "swap buffers" );
#endif /* DEV */
{
#ifdef SVGA_DEBUG
- sprintf(cbuf,"SVGAMesaSwapBuffers : Swapping...");
- SVGAlog(cbuf);
+ sprintf(cbuf,"SVGAMesaSwapBuffers : Swapping...");
+ SVGAlog(cbuf);
#endif /* SVGA_DEBUG */
- tmpptr=SVGABuffer.BackBuffer;
- SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
- SVGABuffer.FrontBuffer=tmpptr;
+#if 000
+ tmpptr=SVGABuffer.BackBuffer;
+ SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
+ SVGABuffer.FrontBuffer=tmpptr;
+#endif
#ifdef SVGA_DEBUG
- sprintf(cbuf,"SVGAMesaSwapBuffers : WriteBuffer : %p\n"
- " Readbuffer : %p", \
- SVGABuffer.BackBuffer, SVGABuffer.FrontBuffer );
- SVGAlog(cbuf);
+ sprintf(cbuf,"SVGAMesaSwapBuffers : WriteBuffer : %p\n"
+ " Readbuffer : %p", \
+ SVGABuffer.BackBuffer, SVGABuffer.FrontBuffer );
+ SVGAlog(cbuf);
#endif /* SVGA_DEBUG */
- }
+ }
}
#else /*SVGA*/
-/* $Id: svgamesa15.c,v 1.3 2000/01/23 17:49:54 brianp Exp $ */
+/* $Id: svgamesa15.c,v 1.4 2000/01/25 00:03:01 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.2
+ * Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
#ifdef SVGA
#include "svgapix.h"
+#include "svgamesa15.h"
-GLshort * shortBuffer;
-
-int __svga_drawpixel15(int x, int y, unsigned long c)
+static void __svga_drawpixel15(int x, int y, unsigned long c)
{
unsigned long offset;
-
- shortBuffer=(void *)SVGABuffer.BackBuffer;
+ GLshort *shortBuffer=(void *)SVGABuffer.DrawBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
shortBuffer[offset]=c;
- return 0;
}
-unsigned long __svga_getpixel15(int x, int y)
+static unsigned long __svga_getpixel15(int x, int y)
{
unsigned long offset;
-
- shortBuffer=(void *)SVGABuffer.BackBuffer;
+ GLshort *shortBuffer=(void *)SVGABuffer.ReadBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
return shortBuffer[offset];
GLbitfield __clear15( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
- int i,j;
-
- if (mask & GL_COLOR_BUFFER_BIT) {
- shortBuffer=(void *)SVGABuffer.BackBuffer;
- if (all) {
- for (i=0;i<SVGABuffer.BufferSize / 2;i++) shortBuffer[i]=SVGAMesa->clear_hicolor;
- } else {
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel15(i,j,SVGAMesa->clear_hicolor);
- }
- }
- return mask & (~GL_COLOR_BUFFER_BIT);
+ int i, j;
+
+ if (mask & DD_FRONT_LEFT_BIT) {
+ GLshort *shortBuffer=(void *)SVGABuffer.FrontBuffer;
+ if (all) {
+ for (i=0;i<SVGABuffer.BufferSize / 2;i++)
+ shortBuffer[i]=SVGAMesa->clear_hicolor;
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel15(i,j,SVGAMesa->clear_hicolor);
+ SVGABuffer.DrawBuffer = tmp;
+ }
+ }
+ if (mask & DD_BACK_LEFT_BIT) {
+ GLshort *shortBuffer=(void *)SVGABuffer.BackBuffer;
+ if (all) {
+ for (i=0;i<SVGABuffer.BufferSize / 2;i++)
+ shortBuffer[i]=SVGAMesa->clear_hicolor;
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel15(i,j,SVGAMesa->clear_hicolor);
+ SVGABuffer.DrawBuffer = tmp;
+ }
+ }
+ return mask & (~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
}
void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y,
-/* $Id: svgamesa15.h,v 1.2 2000/01/22 20:08:36 brianp Exp $ */
+/* $Id: svgamesa15.h,v 1.3 2000/01/25 00:03:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.2
+ * Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
-/* $Id: svgamesa16.c,v 1.3 2000/01/23 17:49:54 brianp Exp $ */
+/* $Id: svgamesa16.c,v 1.4 2000/01/25 00:03:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.2
+ * Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
#ifdef SVGA
#include "svgapix.h"
+#include "svgamesa16.h"
-GLshort * shortBuffer;
-int __svga_drawpixel16(int x, int y, unsigned long c)
+static void __svga_drawpixel16(int x, int y, unsigned long c)
{
unsigned long offset;
-
- shortBuffer=(void *)SVGABuffer.BackBuffer;
+ GLshort *shortBuffer=(void *)SVGABuffer.DrawBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
shortBuffer[offset]=c;
- return 0;
}
-unsigned long __svga_getpixel16(int x, int y)
+static unsigned long __svga_getpixel16(int x, int y)
{
unsigned long offset;
- shortBuffer=(void *)SVGABuffer.BackBuffer;
+ GLshort *shortBuffer=(void *)SVGABuffer.ReadBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
return shortBuffer[offset];
GLint x, GLint y, GLint width, GLint height )
{
int i,j;
-
- if (mask & GL_COLOR_BUFFER_BIT) {
- if (all) {
- shortBuffer=(void *)SVGABuffer.BackBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 2;i++) shortBuffer[i]=SVGAMesa->clear_hicolor;
- } else {
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor);
- }
- }
- return mask & (~GL_COLOR_BUFFER_BIT);
+
+ if (mask & DD_FRONT_LEFT_BIT) {
+ if (all) {
+ GLshort *shortBuffer=(void *)SVGABuffer.FrontBuffer;
+ for (i=0;i<SVGABuffer.BufferSize / 2;i++)
+ shortBuffer[i]=SVGAMesa->clear_hicolor;
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor);
+ SVGABuffer.DrawBuffer = tmp;
+ }
+ }
+ if (mask & DD_BACK_LEFT_BIT) {
+ if (all) {
+ GLshort *shortBuffer=(void *)SVGABuffer.BackBuffer;
+ for (i=0;i<SVGABuffer.BufferSize / 2;i++)
+ shortBuffer[i]=SVGAMesa->clear_hicolor;
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor);
+ SVGABuffer.DrawBuffer = tmp;
+ }
+ }
+ return mask & (~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
}
void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y,
-/* $Id: svgamesa24.c,v 1.3 2000/01/23 17:49:54 brianp Exp $ */
+/* $Id: svgamesa24.c,v 1.4 2000/01/25 00:03:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.2
+ * Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
#ifdef SVGA
#include "svgapix.h"
+#include "svgamesa24.h"
-_RGB * rgbBuffer;
#if 0
-inline int RGB2BGR24(int c)
+static inline int RGB2BGR24(int c)
{
asm("rorw $8, %0\n"
"rorl $16, %0\n"
return c;
}
#else
-int RGB2BGR24(int c)
+static int RGB2BGR24(int c)
{
/* XXX this isn't right */
return c;
#endif
-int __svga_drawpixel24(int x, int y, GLubyte r, GLubyte g, GLubyte b)
+static void __svga_drawpixel24(int x, int y, GLubyte r, GLubyte g, GLubyte b)
{
unsigned long offset;
- rgbBuffer=(void *)SVGABuffer.BackBuffer;
+ _RGB *rgbBuffer=(void *)SVGABuffer.DrawBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
rgbBuffer[offset].r=r;
rgbBuffer[offset].g=g;
rgbBuffer[offset].b=b;
-
- return 0;
}
-unsigned long __svga_getpixel24(int x, int y)
+static unsigned long __svga_getpixel24(int x, int y)
{
unsigned long offset;
- rgbBuffer=(void *)SVGABuffer.BackBuffer;
+ _RGB *rgbBuffer=(void *)SVGABuffer.ReadBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
return rgbBuffer[offset].r<<16 | rgbBuffer[offset].g<<8 | rgbBuffer[offset].b;
{
int i,j;
- if (mask & GL_COLOR_BUFFER_BIT) {
- if (all) {
- rgbBuffer=(void *)SVGABuffer.BackBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 3;i++)
- {
- rgbBuffer[i].r=SVGAMesa->clear_red;
- rgbBuffer[i].g=SVGAMesa->clear_green;
- rgbBuffer[i].b=SVGAMesa->clear_blue;
- }
- } else {
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel24( i, j, SVGAMesa->clear_red,
- SVGAMesa->clear_green,
- SVGAMesa->clear_blue);
- }
+ if (mask & DD_FRONT_LEFT_BIT) {
+ if (all) {
+ _RGB *rgbBuffer=(void *)SVGABuffer.FrontBuffer;
+ for (i=0;i<SVGABuffer.BufferSize / 3;i++) {
+ rgbBuffer[i].r=SVGAMesa->clear_red;
+ rgbBuffer[i].g=SVGAMesa->clear_green;
+ rgbBuffer[i].b=SVGAMesa->clear_blue;
+ }
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel24( i, j, SVGAMesa->clear_red,
+ SVGAMesa->clear_green,
+ SVGAMesa->clear_blue);
+ SVGABuffer.DrawBuffer = tmp;
+ }
+ }
+ if (mask & DD_BACK_LEFT_BIT) {
+ if (all) {
+ _RGB *rgbBuffer=(void *)SVGABuffer.BackBuffer;
+ for (i=0;i<SVGABuffer.BufferSize / 3;i++) {
+ rgbBuffer[i].r=SVGAMesa->clear_red;
+ rgbBuffer[i].g=SVGAMesa->clear_green;
+ rgbBuffer[i].b=SVGAMesa->clear_blue;
+ }
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel24( i, j, SVGAMesa->clear_red,
+ SVGAMesa->clear_green,
+ SVGAMesa->clear_blue);
+ SVGABuffer.DrawBuffer = tmp;
+ }
}
- return mask & (~GL_COLOR_BUFFER_BIT);
+ return mask & (~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
}
void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y,
-/* $Id: svgamesa32.c,v 1.3 2000/01/23 17:49:54 brianp Exp $ */
+/* $Id: svgamesa32.c,v 1.4 2000/01/25 00:03:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.2
+ * Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
#ifdef SVGA
#include "svgapix.h"
-
-GLint * intBuffer;
+#include "svgamesa32.h"
#if 0
-inline int RGB2BGR32(int c)
+static inline int RGB2BGR32(int c)
{
asm("rorw $8, %0\n"
"rorl $16, %0\n"
return c;
}
#else
-int RGB2BGR32(int c)
+static int RGB2BGR32(int c)
{
/* XXX this isn't right */
return c;
}
#endif
-int __svga_drawpixel32(int x, int y, unsigned long c)
+static void __svga_drawpixel32(int x, int y, unsigned long c)
{
unsigned long offset;
- intBuffer=(void *)SVGABuffer.BackBuffer;
+ GLint *intBuffer=(void *)SVGABuffer.DrawBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
intBuffer[offset]=c;
- return 0;
}
-unsigned long __svga_getpixel32(int x, int y)
+static unsigned long __svga_getpixel32(int x, int y)
{
unsigned long offset;
- intBuffer=(void *)SVGABuffer.BackBuffer;
+ const GLint *intBuffer=(void *)SVGABuffer.ReadBuffer;
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->width + x;
return intBuffer[offset];
{
int i,j;
- if (mask & GL_COLOR_BUFFER_BIT) {
- if (all) {
- intBuffer=(void *)SVGABuffer.BackBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 4;i++) intBuffer[i]=SVGAMesa->clear_truecolor;
- } else {
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel32(i,j,SVGAMesa->clear_truecolor);
- }
+ if (mask & DD_FRONT_LEFT_BIT) {
+ if (all) {
+ GLint *intBuffer=(void *)SVGABuffer.FrontBuffer;
+ for (i=0;i<SVGABuffer.BufferSize / 4;i++)
+ intBuffer[i]=SVGAMesa->clear_truecolor;
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel32(i,j,SVGAMesa->clear_truecolor);
+ SVGABuffer.DrawBuffer = tmp;
+ }
+ }
+ if (mask & DD_BACK_LEFT_BIT) {
+ if (all) {
+ GLint *intBuffer=(void *)SVGABuffer.BackBuffer;
+ for (i=0;i<SVGABuffer.BufferSize / 4;i++)
+ intBuffer[i]=SVGAMesa->clear_truecolor;
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel32(i,j,SVGAMesa->clear_truecolor);
+ SVGABuffer.DrawBuffer = tmp;
+ }
}
- return mask & (~GL_COLOR_BUFFER_BIT);
+ return mask & (~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
}
void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y,
-/* $Id: svgamesa8.c,v 1.3 2000/01/23 17:49:54 brianp Exp $ */
+/* $Id: svgamesa8.c,v 1.4 2000/01/25 00:03:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.2
+ * Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
#include "svgapix.h"
+#include "svgamesa8.h"
-int __svga_drawpixel8(int x, int y, unsigned long c)
+static void __svga_drawpixel8(int x, int y, unsigned long c)
{
unsigned long offset;
-
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->linewidth + x;
- SVGABuffer.BackBuffer[offset]=c;
-
- return 0;
+ SVGABuffer.DrawBuffer[offset]=c;
}
-unsigned long __svga_getpixel8(int x, int y)
+static unsigned long __svga_getpixel8(int x, int y)
{
unsigned long offset;
-
y = SVGAInfo->height-y-1;
offset = y * SVGAInfo->linewidth + x;
- return SVGABuffer.BackBuffer[offset];
+ return SVGABuffer.ReadBuffer[offset];
}
void __set_index8( GLcontext *ctx, GLuint index )
{
int i,j;
- if (mask & GL_COLOR_BUFFER_BIT) {
-
- if (all)
- {
- memset(SVGABuffer.BackBuffer,SVGAMesa->clear_index,SVGABuffer.BufferSize);
- } else {
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel8(i,j,SVGAMesa->clear_index);
- }
- }
- return mask & (~GL_COLOR_BUFFER_BIT);
+ if (mask & DD_FRONT_LEFT_BIT) {
+ if (all) {
+ memset(SVGABuffer.FrontBuffer, SVGAMesa->clear_index, SVGABuffer.BufferSize);
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel8(i,j,SVGAMesa->clear_index);
+ SVGABuffer.DrawBuffer = tmp;
+ }
+ }
+ if (mask & DD_BACK_LEFT_BIT) {
+ if (all) {
+ memset(SVGABuffer.BackBuffer, SVGAMesa->clear_index, SVGABuffer.BufferSize);
+ }
+ else {
+ GLubyte *tmp = SVGABuffer.DrawBuffer;
+ SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
+ for (i=x;i<width;i++)
+ for (j=y;j<height;j++)
+ __svga_drawpixel8(i,j,SVGAMesa->clear_index);
+ SVGABuffer.DrawBuffer = tmp;
+ }
+ }
+ return mask & (~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
}
void __write_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y,
-/* $Id: svgapix.h,v 1.2 2000/01/22 20:08:36 brianp Exp $ */
+/* $Id: svgapix.h,v 1.3 2000/01/25 00:03:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.2
+ * Version: 3.3
* Copyright (C) 1995-2000 Brian Paul
*
* This library is free software; you can redistribute it and/or
GLubyte * FrontBuffer;
GLubyte * BackBuffer;
GLubyte * VideoRam;
+ GLubyte * DrawBuffer; /* == FrontBuffer or BackBuffer */
+ GLubyte * ReadBuffer; /* == FrontBuffer or BackBuffer */
};
extern struct svga_buffer SVGABuffer;