-/* $Id: svgamesa32.c,v 1.2 2000/01/22 20:08:36 brianp Exp $ */
+/* $Id: svgamesa32.c,v 1.7 2000/06/14 21:59:07 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
* Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
*/
+#ifdef HAVE_CONFIG_H
+#include "conf.h"
+#endif
-#include "svgapix.h"
+#ifdef SVGA
-GLint * intBuffer;
+#include "svgapix.h"
+#include "svgamesa32.h"
-inline int RGB2BGR32(int c)
+#if 0
+/* this doesn't compile with GCC on RedHat 6.1 */
+static inline int RGB2BGR32(int c)
{
asm("rorw $8, %0\n"
"rorl $16, %0\n"
: "=q"(c):"0"(c));
return c;
}
+#else
+static unsigned long RGB2BGR32(unsigned long color)
+{
+ return (color & 0xff00)|(color>>16)|((color & 0xff)<<16);
+}
+#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,
*((GLint*)rgba[i]) = RGB2BGR32(__svga_getpixel32( x[i], y[i] ));
}
}
+
+
+#else
+
+
+/* silence compiler warning */
+extern void _mesa_svga32_dummy_function(void);
+void _mesa_svga32_dummy_function(void)
+{
+}
+
+
+#endif
+