Use InitPointers helper
authorBrian Paul <brian.paul@tungstengraphics.com>
Sun, 4 Sep 2005 15:01:33 +0000 (15:01 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sun, 4 Sep 2005 15:01:33 +0000 (15:01 +0000)
src/mesa/drivers/dri/ffb/ffb_span.c
src/mesa/drivers/dri/i810/i810span.c
src/mesa/drivers/dri/i830/i830_span.c
src/mesa/drivers/dri/i915/intel_span.c
src/mesa/drivers/dri/r300/radeon_span.c
src/mesa/drivers/dri/s3v/s3v_span.c
src/mesa/drivers/dri/tdfx/tdfx_span.c

index a23f4c66f0a2120c52955a73b5229a6729d67518..fff7fa1d3f7f58b537467adf34bfd682d2bcc128 100644 (file)
@@ -93,7 +93,7 @@ do {  unsigned int fbc, ppc, cmp;                                     \
        fmesa->ffbScreen->rp_active = 1; \
 } while(0)
 
-#define Y_FLIP(__y)            (height - __y)
+#define Y_FLIP(__y)            (height - __y - 1)
 
 #define READ_RGBA(rgba,__x,__y)                                        \
 do {   GLuint p = *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)); \
@@ -125,11 +125,5 @@ ffbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
        assert(vis->redBits == 8);
         assert(vis->greenBits == 8);
         assert(vis->blueBits == 8);
-        drb->Base.GetRow        = ffbReadRGBASpan_888;
-        drb->Base.GetValues     = ffbReadRGBAPixels_888;
-        drb->Base.PutRow        = ffbWriteRGBASpan_888;
-        drb->Base.PutRowRGB     = ffbWriteRGBSpan_888;
-        drb->Base.PutMonoRow    = ffbWriteMonoRGBASpan_888;
-        drb->Base.PutValues     = ffbWriteRGBAPixels_888;
-        drb->Base.PutMonoValues = ffbWriteMonoRGBAPixels_888;
+        ffbInitPointers_888(&drb->Base);
 }
index ac9010666481a9582c7b7151cfed7e23f03da9b8..2112800eebccd0ec81dcbc002869e4cdb5c50c72 100644 (file)
@@ -23,8 +23,7 @@
    char *buf = (char *)(drb->flippedData +             \
                        dPriv->x * 2 +                  \
                        dPriv->y * pitch);              \
-   char *read_buf = buf;                               \
-   (void) read_buf; (void) buf; (void) p
+   (void) buf; (void) p
 
 #define LOCAL_DEPTH_VARS                               \
    i810ContextPtr imesa = I810_CONTEXT(ctx);           \
@@ -56,7 +55,7 @@
 
 #define READ_RGBA( rgba, _x, _y )                                      \
 do {                                                                   \
-   GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch);             \
+   GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch);                  \
    rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8;                           \
    rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc;                           \
    rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;                           \
@@ -112,13 +111,7 @@ i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
 {
    if (drb->Base.InternalFormat == GL_RGBA) {
       /* always 565 RGB */
-      drb->Base.GetRow        = i810ReadRGBASpan_565;
-      drb->Base.GetValues     = i810ReadRGBAPixels_565;
-      drb->Base.PutRow        = i810WriteRGBASpan_565;
-      drb->Base.PutRowRGB     = i810WriteRGBSpan_565;
-      drb->Base.PutMonoRow    = i810WriteMonoRGBASpan_565;
-      drb->Base.PutValues     = i810WriteRGBAPixels_565;
-      drb->Base.PutMonoValues = i810WriteMonoRGBAPixels_565;
+      i810InitPointers_565(&drb->Base);
    }
    else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
       i810InitDepthPointers_z16(&drb->Base);
index 8e9fe38b541b4ef62ed64e61654c8b5a9d674419..ad34cc8f2da0e6b71c05aaf8ad40fc5e5348a41b 100644 (file)
@@ -290,34 +290,16 @@ i830SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
 {
    if (drb->Base.InternalFormat == GL_RGBA) {
       if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
-         drb->Base.GetRow        = i830ReadRGBASpan_555;
-         drb->Base.GetValues     = i830ReadRGBAPixels_555;
-         drb->Base.PutRow        = i830WriteRGBASpan_555;
-         drb->Base.PutRowRGB     = i830WriteRGBSpan_555;
-         drb->Base.PutMonoRow    = i830WriteMonoRGBASpan_555;
-         drb->Base.PutValues     = i830WriteRGBAPixels_555;
-         drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_555;
+         i830InitPointers_555(&drb->Base);
       }
       else if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
-         drb->Base.GetRow        = i830ReadRGBASpan_565;
-         drb->Base.GetValues     = i830ReadRGBAPixels_565;
-         drb->Base.PutRow        = i830WriteRGBASpan_565;
-         drb->Base.PutRowRGB     = i830WriteRGBSpan_565;
-         drb->Base.PutMonoRow    = i830WriteMonoRGBASpan_565;
-         drb->Base.PutValues     = i830WriteRGBAPixels_565;
-         drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_565;
+         i830InitPointers_565(&drb->Base);
       }
       else {
          assert(vis->redBits == 8);
          assert(vis->greenBits == 8);
          assert(vis->blueBits == 8);
-         drb->Base.GetRow        = i830ReadRGBASpan_8888;
-         drb->Base.GetValues     = i830ReadRGBAPixels_8888;
-         drb->Base.PutRow        = i830WriteRGBASpan_8888;
-         drb->Base.PutRowRGB     = i830WriteRGBSpan_8888;
-         drb->Base.PutMonoRow    = i830WriteMonoRGBASpan_8888;
-         drb->Base.PutValues     = i830WriteRGBAPixels_8888;
-         drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_8888;
+         i830InitPointers_8888(&drb->Base);
       }
    }
    else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
index 9a9decff0141ca691551919ef6762241213cea65..a0f848f7b0ebc1c9140e76af337f18f59e7431e0 100644 (file)
@@ -48,9 +48,8 @@
    char *buf = (char *) drb->Base.Data +                       \
                        dPriv->x * drb->cpp +                   \
                        dPriv->y * pitch;                       \
-   char *read_buf = buf;                                       \
    GLushort p;                                                 \
-   (void) read_buf; (void) buf; (void) p
+   (void) buf; (void) p
 
 #define LOCAL_DEPTH_VARS                                       \
    intelContextPtr intel = INTEL_CONTEXT(ctx);                 \
@@ -84,7 +83,7 @@
 
 #define READ_RGBA( rgba, _x, _y )                              \
 do {                                                           \
-   GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch);     \
+   GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch);          \
    rgba[0] = (((p >> 11) & 0x1f) * 255) / 31;                  \
    rgba[1] = (((p >>  5) & 0x3f) * 255) / 63;                  \
    rgba[2] = (((p >>  0) & 0x1f) * 255) / 31;                  \
@@ -106,7 +105,7 @@ do {                                                                \
 
 #define READ_RGBA( rgba, _x, _y )                              \
 do {                                                           \
-   GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch);     \
+   GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch);          \
    rgba[0] = (p >> 7) & 0xf8;                                  \
    rgba[1] = (p >> 3) & 0xf8;                                  \
    rgba[2] = (p << 3) & 0xf8;                                  \
@@ -139,9 +138,8 @@ do {                                                                \
    char *buf = (char *)drb->Base.Data +                                \
                        dPriv->x * drb->cpp +                   \
                        dPriv->y * pitch;                       \
-   char *read_buf = buf;                                       \
    GLuint p;                                                   \
-   (void) read_buf; (void) buf; (void) p
+   (void) buf; (void) p
 
 #undef INIT_MONO_PIXEL
 #define INIT_MONO_PIXEL(p,color)\
@@ -161,7 +159,7 @@ do {                                                                \
 
 #define READ_RGBA(rgba, _x, _y)                                        \
     do {                                                       \
-       GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch);     \
+       GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch);          \
        rgba[0] = (p >> 16) & 0xff;                             \
        rgba[1] = (p >> 8)  & 0xff;                             \
        rgba[2] = (p >> 0)  & 0xff;                             \
@@ -236,34 +234,16 @@ intelSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
 {
    if (drb->Base.InternalFormat == GL_RGBA) {
       if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
-         drb->Base.GetRow        = intelReadRGBASpan_555;
-         drb->Base.GetValues     = intelReadRGBAPixels_555;
-         drb->Base.PutRow        = intelWriteRGBASpan_555;
-         drb->Base.PutRowRGB     = intelWriteRGBSpan_555;
-         drb->Base.PutMonoRow    = intelWriteMonoRGBASpan_555;
-         drb->Base.PutValues     = intelWriteRGBAPixels_555;
-         drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_555;
+         intelInitPointers_555(&drb->Base);
       }
       else if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
-         drb->Base.GetRow        = intelReadRGBASpan_565;
-         drb->Base.GetValues     = intelReadRGBAPixels_565;
-         drb->Base.PutRow        = intelWriteRGBASpan_565;
-         drb->Base.PutRowRGB     = intelWriteRGBSpan_565;
-         drb->Base.PutMonoRow    = intelWriteMonoRGBASpan_565;
-         drb->Base.PutValues     = intelWriteRGBAPixels_565;
-         drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_565;
+         intelInitPointers_565(&drb->Base);
       }
       else {
          assert(vis->redBits == 8);
          assert(vis->greenBits == 8);
          assert(vis->blueBits == 8);
-         drb->Base.GetRow        = intelReadRGBASpan_8888;
-         drb->Base.GetValues     = intelReadRGBAPixels_8888;
-         drb->Base.PutRow        = intelWriteRGBASpan_8888;
-         drb->Base.PutRowRGB     = intelWriteRGBSpan_8888;
-         drb->Base.PutMonoRow    = intelWriteMonoRGBASpan_8888;
-         drb->Base.PutValues     = intelWriteRGBAPixels_8888;
-         drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_8888;
+         intelInitPointers_8888(&drb->Base);
       }
    }
    else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
index 7703e4ac325bffa8b39209248c5ae399e5c6af31..547ac3daaf9760a8d03c6e68adf7ca147a54ac63 100644 (file)
@@ -259,17 +259,16 @@ static void radeonSpanRenderStart(GLcontext * ctx)
                int p;
                driRenderbuffer *drb =
                        (driRenderbuffer *) ctx->WinSysDrawBuffer->_ColorDrawBuffers[0][0];
-               volatile int *read_buf =
+               volatile int *buf =
                        (volatile int *)(radeon->dri.screen->pFB + drb->offset);
-               p = *read_buf;
-               *read_buf = p;
+               p = *buf;
+               *buf = p;
        }
 }
 
 static void radeonSpanRenderFinish(GLcontext * ctx)
 {
        radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
        _swrast_flush(ctx);
        UNLOCK_HARDWARE(radeon);
 }
@@ -289,22 +288,10 @@ void radeonSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
 {
        if (drb->Base.InternalFormat == GL_RGBA) {
                if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
-                       drb->Base.GetRow        = radeonReadRGBASpan_RGB565;
-                       drb->Base.GetValues     = radeonReadRGBAPixels_RGB565;
-                       drb->Base.PutRow        = radeonWriteRGBASpan_RGB565;
-                       drb->Base.PutRowRGB     = radeonWriteRGBSpan_RGB565;
-                       drb->Base.PutMonoRow    = radeonWriteMonoRGBASpan_RGB565;
-                       drb->Base.PutValues     = radeonWriteRGBAPixels_RGB565;
-                       drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_RGB565;
+                       radeonInitPointers_RGB565(&drb->Base);
                }
                else {
-                       drb->Base.GetRow        = radeonReadRGBASpan_ARGB8888;
-                       drb->Base.GetValues     = radeonReadRGBAPixels_ARGB8888;
-                       drb->Base.PutRow        = radeonWriteRGBASpan_ARGB8888;
-                       drb->Base.PutRowRGB     = radeonWriteRGBSpan_ARGB8888;
-                       drb->Base.PutMonoRow    = radeonWriteMonoRGBASpan_ARGB8888;
-                       drb->Base.PutValues     = radeonWriteRGBAPixels_ARGB8888;
-                       drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_ARGB8888;
+                       radeonInitPointers_ARGB8888(&drb->Base);
                }
        }
        else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
index b8ebd5f30ec3226e51bbe4e47e40a66eaf93a75a..de78f9f6b1bd8e801c52f2c971bd99302ad9c162 100644 (file)
@@ -22,9 +22,8 @@
        GLuint height = dPriv->h;                                       \
        char *buf = (char *)(sPriv->pFB + drb->offset                   \
           + (drb->backBuffer ? 0 : dPriv->x * cpp + dPriv->y * pitch));\
-       char *read_buf = buf;                                           \
        GLuint p; \
-       (void) read_buf; (void) buf; (void) p; (void) pitch
+       (void) p
 
 /* FIXME! Depth/Stencil read/writes don't work ! */
 #define LOCAL_DEPTH_VARS                                       \
@@ -84,7 +83,7 @@ do { \
 
 #define READ_RGBA( rgba, _x, _y ) \
    do { \
-      GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
+      GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
       rgba[0] = (p >> 7) & 0xf8; \
       rgba[1] = (p >> 2) & 0xf8; \
       rgba[2] = (p << 3) & 0xf8; \
@@ -116,7 +115,7 @@ do { \
 
 #define READ_RGBA( rgba, _x, _y ) \
 do { \
-   GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
+   GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \
    rgba[0] = (p >> 16) & 0xff; \
    rgba[1] = (p >>  8) & 0xff; \
    rgba[2] = (p >>  0) & 0xff; \
@@ -196,22 +195,10 @@ s3vSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
 {
    if (drb->Base.InternalFormat == GL_RGBA) {
       if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
-         drb->Base.GetRow        = s3vReadRGBASpan_RGB555;
-         drb->Base.GetValues     = s3vReadRGBAPixels_RGB555;
-         drb->Base.PutRow        = s3vWriteRGBASpan_RGB555;
-         drb->Base.PutRowRGB     = s3vWriteRGBSpan_RGB555;
-         drb->Base.PutMonoRow    = s3vWriteMonoRGBASpan_RGB555;
-         drb->Base.PutValues     = s3vWriteRGBAPixels_RGB555;
-         drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_RGB555;
+         s3vInitPointers_RGB555(&drb->Base);
       }
       else {
-         drb->Base.GetRow        = s3vReadRGBASpan_ARGB8888;
-         drb->Base.GetValues     = s3vReadRGBAPixels_ARGB8888;
-         drb->Base.PutRow        = s3vWriteRGBASpan_ARGB8888;
-         drb->Base.PutRowRGB     = s3vWriteRGBSpan_ARGB8888;
-         drb->Base.PutMonoRow    = s3vWriteMonoRGBASpan_ARGB8888;
-         drb->Base.PutValues     = s3vWriteRGBAPixels_ARGB8888;
-         drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_ARGB8888;
+         s3vInitPointers_ARGB8888(&drb->Base);
       }
    }
    else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
index 142beb404fce630cdff6822df94d9b24f66ea587..ce895f8254281161ef87604510e23deb228977d1 100644 (file)
@@ -1356,33 +1356,15 @@ tdfxSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
 {
    if (drb->Base.InternalFormat == GL_RGBA) {
       if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
-         drb->Base.GetRow        = tdfxReadRGBASpan_RGB565;
-         drb->Base.GetValues     = tdfxReadRGBAPixels_RGB565;
-         drb->Base.PutRow        = tdfxWriteRGBASpan_RGB565;
-         drb->Base.PutRowRGB     = tdfxWriteRGBSpan_RGB565;
-         drb->Base.PutMonoRow    = tdfxWriteMonoRGBASpan_RGB565;
-         drb->Base.PutValues     = tdfxWriteRGBAPixels_RGB565;
-         drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_RGB565;
+         tdfxInitPointers_RGB565(&drb->Base);
       }
       else if (vis->redBits == 8 && vis->greenBits == 8
                && vis->blueBits == 8 && vis->alphaBits == 0) {
-         drb->Base.GetRow        = tdfxReadRGBASpan_RGB888;
-         drb->Base.GetValues     = tdfxReadRGBAPixels_RGB888;
-         drb->Base.PutRow        = tdfxWriteRGBASpan_RGB888;
-         drb->Base.PutRowRGB     = tdfxWriteRGBSpan_RGB888;
-         drb->Base.PutMonoRow    = tdfxWriteMonoRGBASpan_RGB888;
-         drb->Base.PutValues     = tdfxWriteRGBAPixels_RGB888;
-         drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_RGB888;
+         tdfxInitPointers_RGB888(&drb->Base);
       }
       else if (vis->redBits == 8 && vis->greenBits == 8
                && vis->blueBits == 8 && vis->alphaBits == 8) {
-         drb->Base.GetRow        = tdfxReadRGBASpan_ARGB8888;
-         drb->Base.GetValues     = tdfxReadRGBAPixels_ARGB8888;
-         drb->Base.PutRow        = tdfxWriteRGBASpan_ARGB8888;
-         drb->Base.PutRowRGB     = tdfxWriteRGBSpan_ARGB8888;
-         drb->Base.PutMonoRow    = tdfxWriteMonoRGBASpan_ARGB8888;
-         drb->Base.PutValues     = tdfxWriteRGBAPixels_ARGB8888;
-         drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_ARGB8888;
+         tdfxInitPointers_ARGB8888(&drb->Base);
       }
       else {
          _mesa_problem(NULL, "problem in tdfxSetSpanFunctions");