diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/svga/svgamesa.c | 130 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa15.c | 64 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa15.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa16.c | 60 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa24.c | 77 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa32.c | 60 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa8.c | 56 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgapix.h | 6 |
8 files changed, 295 insertions, 162 deletions
diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 4e726fa48d3..f7175fe63e8 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -1,8 +1,8 @@ -/* $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 @@ -162,28 +162,33 @@ int SVGAMesaInit( int GraphMode ) 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 @@ -209,29 +214,61 @@ static void get_buffer_size( GLcontext *ctx, GLuint *width, GLuint *height ) *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 + } +} + /**********************************************************************/ /***** *****/ /**********************************************************************/ @@ -243,8 +280,9 @@ static void svgamesa_update_state( GLcontext *ctx ) 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; @@ -385,7 +423,11 @@ SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ) 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; @@ -445,10 +487,12 @@ SVGAMesaContext SVGAMesaGetCurrentContext( void ) */ 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" ); @@ -456,19 +500,21 @@ void SVGAMesaSwapBuffers( void ) #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*/ diff --git a/src/mesa/drivers/svga/svgamesa15.c b/src/mesa/drivers/svga/svgamesa15.c index 80966d7ca49..bc352878f99 100644 --- a/src/mesa/drivers/svga/svgamesa15.c +++ b/src/mesa/drivers/svga/svgamesa15.c @@ -1,8 +1,8 @@ -/* $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 @@ -30,25 +30,21 @@ #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]; @@ -73,19 +69,39 @@ void __clear_color15( GLcontext *ctx, 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, diff --git a/src/mesa/drivers/svga/svgamesa15.h b/src/mesa/drivers/svga/svgamesa15.h index 498575c5fc2..ad04489f8e1 100644 --- a/src/mesa/drivers/svga/svgamesa15.h +++ b/src/mesa/drivers/svga/svgamesa15.h @@ -1,8 +1,8 @@ -/* $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 diff --git a/src/mesa/drivers/svga/svgamesa16.c b/src/mesa/drivers/svga/svgamesa16.c index 061f40a9b70..26a36c7d03a 100644 --- a/src/mesa/drivers/svga/svgamesa16.c +++ b/src/mesa/drivers/svga/svgamesa16.c @@ -1,8 +1,8 @@ -/* $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 @@ -30,25 +30,23 @@ #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]; @@ -74,18 +72,38 @@ GLbitfield __clear16( GLcontext *ctx, GLbitfield mask, GLboolean all, 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, diff --git a/src/mesa/drivers/svga/svgamesa24.c b/src/mesa/drivers/svga/svgamesa24.c index c4b78079f48..152779bf127 100644 --- a/src/mesa/drivers/svga/svgamesa24.c +++ b/src/mesa/drivers/svga/svgamesa24.c @@ -1,8 +1,8 @@ -/* $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 @@ -30,11 +30,11 @@ #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" @@ -44,7 +44,7 @@ inline int RGB2BGR24(int c) return c; } #else -int RGB2BGR24(int c) +static int RGB2BGR24(int c) { /* XXX this isn't right */ return c; @@ -53,26 +53,24 @@ int RGB2BGR24(int 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; @@ -103,24 +101,47 @@ GLbitfield __clear24( GLcontext *ctx, GLbitfield mask, GLboolean all, { 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, diff --git a/src/mesa/drivers/svga/svgamesa32.c b/src/mesa/drivers/svga/svgamesa32.c index a67188f65c6..ad683ef08f6 100644 --- a/src/mesa/drivers/svga/svgamesa32.c +++ b/src/mesa/drivers/svga/svgamesa32.c @@ -1,8 +1,8 @@ -/* $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 @@ -30,11 +30,10 @@ #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" @@ -44,29 +43,28 @@ inline int RGB2BGR32(int c) 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]; @@ -94,17 +92,37 @@ GLbitfield __clear32( GLcontext *ctx, GLbitfield mask, GLboolean all, { 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, diff --git a/src/mesa/drivers/svga/svgamesa8.c b/src/mesa/drivers/svga/svgamesa8.c index dc9df3f4128..048ad988597 100644 --- a/src/mesa/drivers/svga/svgamesa8.c +++ b/src/mesa/drivers/svga/svgamesa8.c @@ -1,8 +1,8 @@ -/* $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 @@ -31,25 +31,22 @@ #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 ) @@ -67,18 +64,33 @@ GLbitfield __clear8( GLcontext *ctx, GLbitfield mask, GLboolean all, { 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, diff --git a/src/mesa/drivers/svga/svgapix.h b/src/mesa/drivers/svga/svgapix.h index 151975a909c..72d389e758d 100644 --- a/src/mesa/drivers/svga/svgapix.h +++ b/src/mesa/drivers/svga/svgapix.h @@ -1,8 +1,8 @@ -/* $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 @@ -62,6 +62,8 @@ struct svga_buffer { GLubyte * FrontBuffer; GLubyte * BackBuffer; GLubyte * VideoRam; + GLubyte * DrawBuffer; /* == FrontBuffer or BackBuffer */ + GLubyte * ReadBuffer; /* == FrontBuffer or BackBuffer */ }; extern struct svga_buffer SVGABuffer; |