summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorFelix Kuehling <fxkuehl@gmx.de>2005-01-15 14:37:33 +0000
committerFelix Kuehling <fxkuehl@gmx.de>2005-01-15 14:37:33 +0000
commitb5f49e6f91664a82f2356d667eaa8504ba56b7c0 (patch)
tree159acffa070cfbbfa276e03294d76f04a5d1076b /src/mesa/drivers
parentc478a09a5b44fe0aff4851094a00775bf3f33757 (diff)
Converted to use spantmp2.h.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/savage/savagespan.c106
1 files changed, 32 insertions, 74 deletions
diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c
index 6cda13cc29..417fd3864c 100644
--- a/src/mesa/drivers/dri/savage/savagespan.c
+++ b/src/mesa/drivers/dri/savage/savagespan.c
@@ -39,14 +39,11 @@
GLuint cpp = savageScreen->cpp; \
GLuint pitch = imesa->aperturePitch; \
GLuint height = dPriv->h; \
- char *buf = (char *)(imesa->drawMap + \
+ char *buf = (char *)(map + \
dPriv->x * cpp + \
dPriv->y * pitch); \
- char *read_buf = (char *)(imesa->readMap + \
- dPriv->x * cpp + \
- dPriv->y * pitch); \
- GLuint p = SAVAGE_CONTEXT( ctx )->MonoColor; \
- (void) read_buf; (void) buf; (void) p
+ GLuint p; \
+ (void) p
#define LOCAL_DEPTH_VARS \
savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
@@ -61,8 +58,6 @@
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-#define INIT_MONO_PIXEL(p)
-
#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
_y >= miny && _y < maxy)
@@ -81,6 +76,16 @@
#define HW_LOCK()
+#define HW_UNLOCK()
+
+#define HW_WRITE_LOCK() \
+ savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
+ char *map = imesa->drawMap;
+
+#define HW_READ_LOCK() \
+ savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
+ char *map = imesa->readMap;
+
#define HW_CLIPLOOP() \
do { \
__DRIdrawablePrivate *dPriv = imesa->driDrawable; \
@@ -96,66 +101,36 @@
} \
} while (0)
-#define HW_UNLOCK()
-
/* 16 bit, 565 rgb color spanline and pixel functions
*/
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = SAVAGEPACKCOLOR565( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
-do{ \
- *(GLushort *)(buf + (_x<<1) + _y*pitch) = ( (((int)r & 0xf8) << 8) |\
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3)); \
-}while(0)
-#define WRITE_PIXEL( _x, _y, p ) \
-do{ \
- *(GLushort *)(buf + (_x<<1) + _y*pitch) = p; \
-}while(0)
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLushort p = *(GLushort *)(read_buf + (_x<<1) + _y*pitch); \
- rgba[0] = (((p >> 11) & 0x1f) * 255) >>5; \
- rgba[1] = (((p >> 5) & 0x3f) * 255) >>6; \
- rgba[2] = (((p >> 0) & 0x1f) * 255) >>5; \
- rgba[3] = 255; \
-} while(0)
+#define GET_SRC_PTR(_x, _y) (buf + (_x<<1) + _y*pitch)
+#define GET_DST_PTR(_x, _y) GET_SRC_PTR(_x, _y)
+#define SPANTMP_PIXEL_FMT GL_RGB
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
#define TAG(x) savage##x##_565
-#include "spantmp.h"
+#define TAG2(x,y) savage##x##_565##y
+#include "spantmp2.h"
/* 32 bit, 8888 ARGB color spanline and pixel functions
*/
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = SAVAGEPACKCOLOR8888( color[0], color[1], color[2], color[3] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + (_x<<2) + _y*pitch) = ( ((GLuint)a << 24) | \
- ((GLuint)r << 16) | \
- ((GLuint)g << 8) | \
- ((GLuint)b ))
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + (_x<<2) + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(read_buf + (_x<<2) + _y*pitch); \
- rgba[0] = (p >> 16) & 0xFF; \
- rgba[1] = (p >> 8) & 0xFF; \
- rgba[2] = (p >> 0) & 0xFF; \
- rgba[3] = 0xFF; \
-} while(0)
+#define GET_SRC_PTR(_x, _y) (buf + (_x<<2) + _y*pitch)
+#define GET_DST_PTR(_x, _y) GET_SRC_PTR(_x, _y)
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
#define TAG(x) savage##x##_8888
-#include "spantmp.h"
+#define TAG2(x,y) savage##x##_8888##y
+#include "spantmp2.h"
+#undef HW_WRITE_LOCK
+#define HW_WRITE_LOCK()
+#undef HW_READ_LOCK
+#define HW_READ_LOCK()
+
/* 16 bit integer depthbuffer functions
@@ -333,25 +308,8 @@ void savageDDInitSpanFuncs( GLcontext *ctx )
switch (imesa->savageScreen->cpp)
{
- case 2:
- swdd->WriteRGBASpan = savageWriteRGBASpan_565;
- swdd->WriteRGBSpan = savageWriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = savageWriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = savageWriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = savageWriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = savageReadRGBASpan_565;
- swdd->ReadRGBAPixels = savageReadRGBAPixels_565;
-
- break;
-
- case 4:
- swdd->WriteRGBASpan = savageWriteRGBASpan_8888;
- swdd->WriteRGBSpan = savageWriteRGBSpan_8888;
- swdd->WriteMonoRGBASpan = savageWriteMonoRGBASpan_8888;
- swdd->WriteRGBAPixels = savageWriteRGBAPixels_8888;
- swdd->WriteMonoRGBAPixels = savageWriteMonoRGBAPixels_8888;
- swdd->ReadRGBASpan = savageReadRGBASpan_8888;
- swdd->ReadRGBAPixels = savageReadRGBAPixels_8888;
+ case 2: savageInitPointers_565( swdd ); break;
+ case 4: savageInitPointers_8888( swdd );
}
switch (imesa->savageScreen->zpp)