remove common macros used in the span functions of most drivers from the individual...
authorRoland Scheidegger <rscheidegger@gmx.ch>
Fri, 1 Jul 2005 00:08:46 +0000 (00:08 +0000)
committerRoland Scheidegger <rscheidegger@gmx.ch>
Fri, 1 Jul 2005 00:08:46 +0000 (00:08 +0000)
19 files changed:
src/mesa/drivers/dri/common/depthtmp.h
src/mesa/drivers/dri/common/spantmp.h
src/mesa/drivers/dri/common/spantmp2.h
src/mesa/drivers/dri/common/spantmp_common.h [new file with mode: 0644]
src/mesa/drivers/dri/common/stenciltmp.h
src/mesa/drivers/dri/gamma/gamma_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/mach64/mach64_span.c
src/mesa/drivers/dri/mga/mgaspan.c
src/mesa/drivers/dri/r128/r128_span.c
src/mesa/drivers/dri/r200/r200_span.c
src/mesa/drivers/dri/radeon/radeon_span.c
src/mesa/drivers/dri/s3v/s3v_span.c
src/mesa/drivers/dri/savage/savagespan.c
src/mesa/drivers/dri/sis/sis_span.c
src/mesa/drivers/dri/tdfx/tdfx_span.c
src/mesa/drivers/dri/unichrome/via_span.c

index bea4ea38d54169980f0b7acd7e7eaaa98b3439cd..1875d157b4c36cdd79268c31e7c4275f17675c94 100644 (file)
@@ -7,25 +7,20 @@
  */
 
 
+#include "spantmp_common.h"
+
 #ifndef DBG
 #define DBG 0
 #endif
 
-
 #ifndef HAVE_HW_DEPTH_SPANS
 #define HAVE_HW_DEPTH_SPANS 0
 #endif
+
 #ifndef HAVE_HW_DEPTH_PIXELS
 #define HAVE_HW_DEPTH_PIXELS 0
 #endif
 
-#ifndef HW_READ_LOCK
-#define HW_READ_LOCK()         HW_LOCK()
-#endif
-#ifndef HW_READ_UNLOCK
-#define HW_READ_UNLOCK()       HW_UNLOCK()
-#endif
-
 static void TAG(WriteDepthSpan)( GLcontext *ctx,
                                  struct gl_renderbuffer *rb,
                                  GLuint n, GLint x, GLint y,
index b15bbb257766372e0416d9b3fe09a24c5f29c445..f726e83053d3b18a938f7b23aa377d83dc61ee41 100644 (file)
  *    Gareth Hughes <gareth@nvidia.com>
  */
 
+#include "spantmp_common.h"
+
 #ifndef DBG
 #define DBG 0
 #endif
 
-#ifndef HW_WRITE_LOCK
-#define HW_WRITE_LOCK()                HW_LOCK()
-#endif
-
-#ifndef HW_WRITE_UNLOCK
-#define HW_WRITE_UNLOCK()      HW_UNLOCK()
-#endif
-
-#ifndef HW_READ_LOCK
-#define HW_READ_LOCK()         HW_LOCK()
-#endif
-
-#ifndef HW_READ_UNLOCK
-#define HW_READ_UNLOCK()       HW_UNLOCK()
-#endif
-
 #ifndef HW_READ_CLIPLOOP
 #define HW_READ_CLIPLOOP()     HW_CLIPLOOP()
 #endif
index b2b31863090b6dad884fdbdf05d35a06c2a87851..1a20a45970a4a1d009b72e68420573c7809fbe59 100644 (file)
  */
 
 #include "colormac.h"
+#include "spantmp_common.h"
 
 #ifndef DBG
 #define DBG 0
 #endif
 
-#ifndef HW_WRITE_LOCK
-#define HW_WRITE_LOCK()                HW_LOCK()
-#endif
-
-#ifndef HW_WRITE_UNLOCK
-#define HW_WRITE_UNLOCK()      HW_UNLOCK()
-#endif
-
-#ifndef HW_READ_LOCK
-#define HW_READ_LOCK()         HW_LOCK()
-#endif
-
-#ifndef HW_READ_UNLOCK
-#define HW_READ_UNLOCK()       HW_UNLOCK()
-#endif
-
 #ifndef HW_READ_CLIPLOOP
 #define HW_READ_CLIPLOOP()     HW_CLIPLOOP()
 #endif
 
 #if (SPANTMP_PIXEL_FMT == GL_RGB)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
 
+#ifndef GET_SRC_PTR
+#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#ifndef GET_DST_PTR
+#define GET_DST_PTR(_x, _y) (     buf + (_x) * 2 + (_y) * pitch)
+#endif
+
 #define INIT_MONO_PIXEL(p, color) \
   p = PACK_COLOR_565( color[0], color[1], color[2] )
 
 
 #elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
 
+#ifndef GET_SRC_PTR
+#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 4 + (_y) * pitch)
+#endif
+
+#ifndef GET_DST_PTR
+#define GET_DST_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
+#endif
+
 # define INIT_MONO_PIXEL(p, color)                       \
      p = PACK_COLOR_8888(color[3], color[0], color[1], color[2]) 
-    
+
 # define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
     do {                                                                \
        GLuint * _p = (GLuint *) GET_DST_PTR(_x, _y);                    \
diff --git a/src/mesa/drivers/dri/common/spantmp_common.h b/src/mesa/drivers/dri/common/spantmp_common.h
new file mode 100644 (file)
index 0000000..a4509a5
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2000-2001 VA Linux Systems, Inc.
+ * (C) Copyright IBM Corporation 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file spantmp_common.h
+ *
+ * common macros for span read / write functions to be used in the depth,
+ * stencil and pixel span templates.
+ */
+
+#ifndef HW_WRITE_LOCK
+#define HW_WRITE_LOCK()                HW_LOCK()
+#endif
+
+#ifndef HW_WRITE_UNLOCK
+#define HW_WRITE_UNLOCK()      HW_UNLOCK()
+#endif
+
+#ifndef HW_READ_LOCK
+#define HW_READ_LOCK()         HW_LOCK()
+#endif
+
+#ifndef HW_READ_UNLOCK
+#define HW_READ_UNLOCK()       HW_UNLOCK()
+#endif
+
+#ifndef HW_CLIPLOOP
+#define HW_CLIPLOOP()                                                  \
+   do {                                                                        \
+      int _nc = dPriv->numClipRects;                                   \
+      while ( _nc-- ) {                                                        \
+        int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;               \
+        int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;               \
+        int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;               \
+        int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
+#endif
+
+#ifndef HW_ENDCLIPLOOP
+#define HW_ENDCLIPLOOP()                                               \
+      }                                                                        \
+   } while (0)
+#endif
+
+#ifndef CLIPPIXEL
+#define CLIPPIXEL( _x, _y )                                            \
+   ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
+#endif
+
+#ifndef CLIPSPAN
+#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
+   if ( _y < miny || _y >= maxy /*|| _x + n < minx || _x >=maxx*/ ) {  \
+      _n1 = 0, _x1 = x;                                                        \
+   } else {                                                            \
+      _n1 = _n;                                                                \
+      _x1 = _x;                                                                \
+      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
+      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
+   }
+#endif
index ffcb1a4c1ee3292f03a17afc3f326c248904a943..dccab0660d4599bbfb4e5d575bdb63f72cb58656 100644 (file)
@@ -1,23 +1,11 @@
 /* $XFree86: xc/lib/GL/mesa/src/drv/common/stenciltmp.h,v 1.3 2001/03/21 16:14:20 dawes Exp $ */
 
+#include "spantmp_common.h"
+
 #ifndef DBG
 #define DBG 0
 #endif
 
-#ifndef HW_WRITE_LOCK
-#define HW_WRITE_LOCK()                HW_LOCK()
-#endif
-#ifndef HW_WRITE_UNLOCK
-#define HW_WRITE_UNLOCK()      HW_UNLOCK()
-#endif
-
-#ifndef HW_READ_LOCK
-#define HW_READ_LOCK()         HW_LOCK()
-#endif
-#ifndef HW_READ_UNLOCK
-#define HW_READ_UNLOCK()       HW_UNLOCK()
-#endif
-
 static void TAG(WriteStencilSpan)( GLcontext *ctx,
                                    struct gl_renderbuffer *rb,
                                   GLuint n, GLint x, GLint y,
index db61f1c7771dd89c164d978c1eb45c06e3b3636e..66cc961c64f90d7de4aa6c4c967b86e7ed6e8580 100644 (file)
 
 #define LOCAL_STENCIL_VARS     LOCAL_DEPTH_VARS
 
-
-#define CLIPPIXEL( _x, _y )                                            \
-   ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
 #define Y_FLIP( _y )           (height - _y - 1)
 
 #define HW_LOCK()                                                      \
    gammaGetLock( gmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );         \
    GAMMAHW_LOCK( gmesa );
 
-#define HW_CLIPLOOP()                                                  \
-   do {                                                                        \
-      __DRIdrawablePrivate *dPriv = gmesa->driDrawable;                        \
-      int _nc = dPriv->numClipRects;                                   \
-                                                                       \
-      while ( _nc-- ) {                                                        \
-        int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;               \
-        int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;               \
-        int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;               \
-        int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP()                                               \
-      }                                                                        \
-   } while (0)
-
 #define HW_UNLOCK() GAMMAHW_UNLOCK( gmesa )
 
 
@@ -156,7 +126,6 @@ do {                                                                        \
 #include "depthtmp.h"
 
 
-
 #if 0 /* Unused */
 /* 32 bit depthbuffer functions.
  */
index 78b8265b70d16bec107a337d135e4d85cb296559..1a976048c89e1d37decd596f69df155a8fb51cee 100644 (file)
 #define INIT_MONO_PIXEL(p, color) \
    p = PACK_COLOR_565( color[0], color[1], color[2] )
 
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
-                         _y >= miny && _y < maxy)
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
 #define Y_FLIP(_y) (height - _y - 1)
 
 #define HW_LOCK()
 
-#define HW_CLIPLOOP()                                          \
-  do {                                                         \
-    __DRIdrawablePrivate *dPriv = imesa->driDrawable;          \
-    int _nc = dPriv->numClipRects;                             \
-    while (_nc--) {                                            \
-       int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;                \
-       int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;        \
-       int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;                \
-       int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-
-#define HW_ENDCLIPLOOP()                       \
-    }                                          \
-  } while (0)
-
 #define HW_UNLOCK()
 
 /* 16 bit, 565 rgb color spanline and pixel functions
@@ -97,8 +68,6 @@ do {                                                                  \
 #define TAG(x) i810##x##_565
 #include "spantmp.h"
 
-
-
 /* 16 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d ) \
index a17ec9b6ac97510b82cace2c441e49101bc154b9..4a86784e8afb45aa742332ca4e78b9d30c4d4bff 100644 (file)
@@ -81,39 +81,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define INIT_MONO_PIXEL(p,color)\
         p = PACK_COLOR_565(color[0],color[1],color[2])
 
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
-                         _y >= miny && _y < maxy)
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                \
-   } else {                                                            \
-      _n1 = _n;                                                        \
-      _x1 = _x;                                                        \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                \
-   }
-
 #define Y_FLIP(_y) (height - _y - 1)
 
-
 #define HW_LOCK()
 
-#define HW_CLIPLOOP()                                          \
-  do {                                                         \
-    __DRIdrawablePrivate *dPriv = imesa->driDrawable;          \
-    int _nc = dPriv->numClipRects;                             \
-    while (_nc--) {                                            \
-       int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;                \
-       int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;        \
-       int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;                \
-       int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-
-#define HW_ENDCLIPLOOP()                       \
-    }                                          \
-  } while (0)
-
 #define HW_UNLOCK()
 
 /* 16 bit, 565 rgb color spanline and pixel functions
@@ -137,9 +108,6 @@ do {                                                                \
 #define TAG(x) i830##x##_565
 #include "spantmp.h"
 
-
-
-
 /* 15 bit, 555 rgb color spanline and pixel functions
  */
 #define WRITE_RGBA( _x, _y, r, g, b, a )                       \
index 7a051718aa2d2f14c60f4b3c84449d45fbf88f6c..3522f4f38fc3ed68c4fddf2fb69fcd59ceedd133 100644 (file)
 #define INIT_MONO_PIXEL(p,color)\
         p = INTEL_PACKCOLOR565(color[0],color[1],color[2])
 
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
-                         _y >= miny && _y < maxy)
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                \
-   } else {                                                            \
-      _n1 = _n;                                                        \
-      _x1 = _x;                                                        \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                \
-   }
-
 #define Y_FLIP(_y) (height - _y - 1)
 
-
 #define HW_LOCK()
 
-#define HW_CLIPLOOP()                                          \
-  do {                                                         \
-    __DRIdrawablePrivate *dPriv = intel->driDrawable;          \
-    int _nc = dPriv->numClipRects;                             \
-    while (_nc--) {                                            \
-       int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;                \
-       int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;        \
-       int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;                \
-       int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-
-#define HW_ENDCLIPLOOP()                       \
-    }                                          \
-  } while (0)
-
 #define HW_UNLOCK()
 
 /* 16 bit, 565 rgb color spanline and pixel functions
@@ -125,9 +96,6 @@ do {                                                         \
 #define TAG(x) intel##x##_565
 #include "spantmp.h"
 
-
-
-
 /* 15 bit, 555 rgb color spanline and pixel functions
  */
 #define WRITE_RGBA( _x, _y, r, g, b, a )                       \
index 067ffab8eddaf3cb7b7fd3551bdd8dff07f29294..88863471d4745e6d7dd9d9046d3c3e6f1a557529 100644 (file)
  * Authors:
  *     Gareth Hughes <gareth@valinux.com>
  *     Leif Delgass <ldelgass@retinalburn.net>
- *     José Fonseca <j_r_fonseca@yahoo.co.uk>
+ *     Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
  */
 
 #include "mach64_context.h"
 #include "mach64_ioctl.h"
 #include "mach64_state.h"
 #include "mach64_span.h"
-#include "mach64_tex.h"
 
 #include "swrast/swrast.h"
 
 
 #define LOCAL_STENCIL_VARS     LOCAL_DEPTH_VARS
 
-#define CLIPPIXEL( _x, _y )                                            \
-   ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if (( _y < miny) || (_y >= maxy)) {                                 \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if (_x1 < minx) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx;  \
-      if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx);                  \
-   }
-
 #define Y_FLIP( _y )   (height - _y - 1)
 
-
 #define HW_LOCK()
 
+/* FIXME could/should we use dPriv->numClipRects like the other drivers? */
 #define HW_CLIPLOOP()                                                  \
    do {                                                                        \
       int _nc = mmesa->numClipRects;                                   \
 
 /* 16 bit, RGB565 color spanline and pixel functions
  */
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 2 + _y * pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 2 + _y * pitch)
 #define SPANTMP_PIXEL_FMT GL_RGB
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
 
 
 /* 32 bit, ARGB8888 color spanline and pixel functions
  */
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 4 + _y * pitch)
+/* FIXME the old code always read back alpha as 0xff, i.e. fully opaque.
+   Was there a reason to do so ? If so that'll won't work with that template... */
 #define SPANTMP_PIXEL_FMT GL_BGRA
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
 
index 8487f4b83f6ea33a67e2eb246c2a5bf64fce25be..c62b1c875a2d029fc4921df9af7eac679543cb44 100644 (file)
@@ -52,7 +52,7 @@
                        dPriv->y * pitch);              \
    GLuint p;                                           \
    (void) read_buf; (void) buf; (void) p
-   
+
 
 
 #define LOCAL_DEPTH_VARS                                               \
 
 #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS 
 
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
-                         _y >= miny && _y < maxy)
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
-
 #define HW_LOCK()
 
+/* FIXME could/should we use dPriv->numClipRects like the other drivers? */
 #define HW_CLIPLOOP()                                          \
   do {                                                         \
     int _nc = mmesa->numClipRects;                             \
 
 
 
-
 #define Y_FLIP(_y) (height - _y - 1)
 
 /* 16 bit, RGB565 color spanline and pixel functions
  */
-
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 2 + _y * pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 2 + _y * pitch)
 #define SPANTMP_PIXEL_FMT GL_RGB
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
 
 
 /* 32 bit, ARGB8888 color spanline and pixel functions
  */
-
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 4 + _y * pitch)
 #define SPANTMP_PIXEL_FMT GL_BGRA
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
 
@@ -258,7 +238,7 @@ void mgaDDInitSpanFuncs( GLcontext *ctx )
    case 4:
 #if 0
       mgaInitPointers_8888( swdd );
-      
+
       if (!mmesa->hw_stencil) {
         swdd->ReadDepthSpan = mgaReadDepthSpan_32;
         swdd->WriteDepthSpan = mgaWriteDepthSpan_32;
index 9a2bf742b6bfa12caaabf8b986f74e70db0db8b2..fd4722b3b36d170aa4e3fa86bb4957c8abf12e3a 100644 (file)
@@ -75,41 +75,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define LOCAL_STENCIL_VARS     LOCAL_DEPTH_VARS
 
-
-#define CLIPPIXEL( _x, _y )                                            \
-   ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
 #define Y_FLIP( _y )           (height - _y - 1)
 
-
 #define HW_LOCK()
 
-#define HW_CLIPLOOP()                                                  \
-   do {                                                                        \
-      __DRIdrawablePrivate *dPriv = rmesa->driDrawable;                        \
-      int _nc = dPriv->numClipRects;                                   \
-                                                                       \
-      while ( _nc-- ) {                                                        \
-        int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;               \
-        int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;               \
-        int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;               \
-        int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP()                                               \
-      }                                                                        \
-   } while (0)
-
 #define HW_UNLOCK()
 
 
@@ -120,8 +89,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* 16 bit, RGB565 color spanline and pixel functions
  */
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 2 + _y * pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 2 + _y * pitch)
 #define SPANTMP_PIXEL_FMT GL_RGB
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
 
@@ -132,8 +99,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* 32 bit, ARGB8888 color spanline and pixel functions
  */
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 4 + _y * pitch)
 #define SPANTMP_PIXEL_FMT GL_BGRA
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
 
index a5c9b1bab646dc347f11218f7b7f1b9069b9c6eb..024e89461ed06236843c4b813694187e1164487e 100644 (file)
@@ -77,41 +77,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define LOCAL_STENCIL_VARS     LOCAL_DEPTH_VARS
 
-
-#define CLIPPIXEL( _x, _y )                                            \
-   ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
 #define Y_FLIP( _y )           (height - _y - 1)
 
-
 #define HW_LOCK() 
 
-#define HW_CLIPLOOP()                                                  \
-   do {                                                                        \
-      __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;               \
-      int _nc = dPriv->numClipRects;                                   \
-                                                                       \
-      while ( _nc-- ) {                                                        \
-        int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;               \
-        int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;               \
-        int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;               \
-        int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP()                                               \
-      }                                                                        \
-   } while (0)
-
 #define HW_UNLOCK()                                                    
 
 
@@ -122,9 +91,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* 16 bit, RGB565 color spanline and pixel functions
  */
-
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 2 + _y * pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 2 + _y * pitch)
 #define SPANTMP_PIXEL_FMT GL_RGB
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
 
@@ -134,9 +100,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* 32 bit, ARGB8888 color spanline and pixel functions
  */
-
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 4 + _y * pitch)
 #define SPANTMP_PIXEL_FMT GL_BGRA
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
 
@@ -354,7 +317,6 @@ static void r200SpanRenderFinish( GLcontext *ctx )
 
 void r200InitSpanFuncs( GLcontext *ctx )
 {
-   r200ContextPtr rmesa = R200_CONTEXT(ctx);
    struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
 
    swdd->SetBuffer = r200SetBuffer;
index 9315543c15f986955367fbc4e1a81a36ab6333cb..d5606d70a16da4bed65c00dfba25f78f74df3cbe 100644 (file)
@@ -78,41 +78,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define LOCAL_STENCIL_VARS     LOCAL_DEPTH_VARS
 
-
-#define CLIPPIXEL( _x, _y )                                            \
-   ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
 #define Y_FLIP( _y )           (height - _y - 1)
 
-
 #define HW_LOCK() 
 
-#define HW_CLIPLOOP()                                                  \
-   do {                                                                        \
-      __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;               \
-      int _nc = dPriv->numClipRects;                                   \
-                                                                       \
-      while ( _nc-- ) {                                                        \
-        int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;               \
-        int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;               \
-        int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;               \
-        int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP()                                               \
-      }                                                                        \
-   } while (0)
-
 #define HW_UNLOCK()                                                    
 
 
index e4a48ebfc84a409cbe9992fdcbcd80177a9cae72..49135a9c3ffe78c8b13986f14fb8b943b2a6eebc 100644 (file)
 
 #define LOCAL_STENCIL_VARS     LOCAL_DEPTH_VARS
 
-
-#define CLIPPIXEL( _x, _y ) \
-       ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
-       if ( _y < miny || _y >= maxy ) { \
-               _n1 = 0, _x1 = x; \
-       } else { \
-               _n1 = _n; \
-               _x1 = _x; \
-               if ( _x1 < minx ) \
-                       _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-               if ( _x1 + _n1 >= maxx ) \
-                       n1 -= (_x1 + n1 - maxx); \
-       }
-
 #define Y_FLIP( _y )   (height - _y - 1)
 
 #if _SPANLOCK  /* OK, we lock */
 
 #endif
 
-#define HW_CLIPLOOP()                                                  \
-   do {                                                                        \
-      __DRIdrawablePrivate *dPriv = vmesa->driDrawable;                        \
-      int _nc = dPriv->numClipRects;                                   \
-                                                                       \
-      while ( _nc-- ) {                                                        \
-        int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;               \
-        int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;               \
-        int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;               \
-        int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP()                                               \
-      }                                                                        \
-   } while (0)
-
 
 /* ================================================================
  * Color buffer
index fef0aeec7842e562dcc0452c6a23ef272024d79b..a261299cc5cb4ce03b7eaffd40350321d6147bb2 100644 (file)
@@ -42,6 +42,7 @@
    GLubyte *buf = map +                                        \
                  dPriv->x * cpp +                      \
                  dPriv->y * pitch;                     \
+   char *read_buf = buf;                                       \
    GLuint p;                                           \
    (void) p
 
 
 #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
 
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
-                         _y >= miny && _y < maxy)
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
 #define Y_FLIP(_y) (height - _y - 1)
 
 #define HW_LOCK()
        savageContextPtr imesa = SAVAGE_CONTEXT(ctx);   \
        GLubyte *map = imesa->readMap;
 
-#define HW_CLIPLOOP()                                          \
-  do {                                                         \
-    __DRIdrawablePrivate *dPriv = imesa->driDrawable;          \
-    int _nc = dPriv->numClipRects;                             \
-    while (_nc--) {                                            \
-       int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;                \
-       int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;        \
-       int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;                \
-       int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-
-#define HW_ENDCLIPLOOP()                       \
-    }                                          \
-  } while (0)
-
 
 /* 16 bit, 565 rgb color spanline and pixel functions
  */
-#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
 
 
 /* 32 bit, 8888 ARGB color spanline and pixel functions
  */
-#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
 
 
 
 
-
 /* 16 bit float depthbuffer functions
  */
 #define WRITE_DEPTH( _x, _y, d ) \
 
 
 
-
 /* 8-bit stencil /24-bit integer depth depthbuffer functions.
  * Depth range is reversed. See also savageCalcViewport.
  */
 
 
 
-
 /* 24 bit float depthbuffer functions
  */
 #define WRITE_DEPTH( _x, _y, d ) do {                          \
index abf3d652c0033caf927f7031f7878996a8f5d401..78ce74b8725b28102568ce4f0fe6fc347c29ca20 100644 (file)
@@ -43,6 +43,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define LOCAL_VARS                                                     \
    sisContextPtr smesa = SIS_CONTEXT(ctx);                             \
+   __DRIdrawablePrivate *dPriv = smesa->driDrawable;                   \
    char *buf = (char *)(smesa->FbBase + smesa->drawOffset);            \
    char *read_buf = (char *)(smesa->FbBase + smesa->readOffset);       \
    GLuint p;                                                           \
@@ -50,40 +51,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define LOCAL_DEPTH_VARS                                               \
    sisContextPtr smesa = SIS_CONTEXT(ctx);                             \
+   __DRIdrawablePrivate *dPriv = smesa->driDrawable;                   \
    char *buf = smesa->depthbuffer;                                     \
 
 #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS 
 
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
-                         _y >= miny && _y < maxy)
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
 #define HW_LOCK() do {} while(0);
 
-#define HW_CLIPLOOP()                                                  \
-   do {                                                                        \
-      __DRIdrawablePrivate *dPriv = smesa->driDrawable;                        \
-      int _nc = dPriv->numClipRects;                                   \
-                                                                       \
-      while ( _nc-- ) {                                                        \
-        int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;               \
-        int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;               \
-        int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;               \
-        int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP()                                               \
-      }                                                                        \
-   } while (0)
-
 #define HW_UNLOCK() do {} while(0);
 
 /* RGB565 */
index f27af2efcff091aab31190ba8a3fd0162b3f0e99..b00b7ad8dbaf0bb9f798f17aadfd8183320796f7 100644 (file)
    (void) buf; (void) p;
 
 
-#define CLIPPIXEL( _x, _y )    ( _x >= minx && _x < maxx &&            \
-                                 _y >= miny && _y < maxy )
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i )                           \
-   if ( _y < miny || _y >= maxy ) {                                    \
-      _n1 = 0, _x1 = x;                                                        \
-   } else {                                                            \
-      _n1 = _n;                                                                \
-      _x1 = _x;                                                                \
-      if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
-      if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx);                        \
-   }
-
 #define Y_FLIP(_y)             (height - _y - 1)
 
 
index 0fbac9b506ac5b39a2b296252c8ed8168c9c4982..16a1aa8b367a2131468e870b8cf4f186dda01a7d 100644 (file)
 
 #define DBG 0
 
-#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx &&    \
-                          _y >= miny && _y < maxy)
-
-
-#define CLIPSPAN(_x, _y, _n, _x1, _n1, _i)                                  \
-    if (_y < miny || _y >= maxy) {                                          \
-        _n1 = 0, _x1 = x;                                                   \
-    }                                                                       \
-    else {                                                                  \
-        _n1 = _n;                                                           \
-        _x1 = _x;                                                           \
-        if (_x1 < minx) _i += (minx -_x1), n1 -= (minx -_x1), _x1 = minx;   \
-        if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx);                     \
-   }
-
 #define Y_FLIP(_y) (height - _y - 1)
 
 #define HW_LOCK() 
-#define HW_CLIPLOOP()                                                  \
-    do {                                                               \
-        __DRIdrawablePrivate *dPriv = vmesa->driDrawable;              \
-        int _nc = dPriv->numClipRects;                                 \
-        while (_nc--) {                                                        \
-               int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;        \
-               int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;        \
-               int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;        \
-               int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-
-#define HW_ENDCLIPLOOP()                                            \
-        }                                                           \
-    } while (0)
 
 #define HW_UNLOCK()
 
@@ -86,8 +57,8 @@
 
 /* 16 bit, RGB565 color spanline and pixel functions
  */
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 2 + _y * read_pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 2 + _y * draw_pitch)
+#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 2 + (_y) * read_pitch)
+#define GET_DST_PTR(_x, _y) (     buf + (_x) * 2 + (_y) * draw_pitch)
 #define SPANTMP_PIXEL_FMT GL_RGB
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
 
@@ -98,8 +69,8 @@
 
 /* 32 bit, ARGB8888 color spanline and pixel functions
  */
-#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * read_pitch)
-#define GET_DST_PTR(_x, _y) (     buf + _x * 4 + _y * draw_pitch)
+#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 4 + (_y) * read_pitch)
+#define GET_DST_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * draw_pitch)
 #define SPANTMP_PIXEL_FMT GL_BGRA
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
 
@@ -226,12 +197,12 @@ void viaInitSpanFuncs(GLcontext *ctx)
 #endif
 #if 0
     if (vmesa->glCtx->Visual.depthBits == 16) {
-       swdd->ReadDepthSpan = viaReadDepthSpan_16;
+       swdd->ReadDepthSpan = viaReadDepthSpan_16;
        swdd->WriteDepthSpan = viaWriteDepthSpan_16;
        swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_16;
        swdd->ReadDepthPixels = viaReadDepthPixels_16;
        swdd->WriteDepthPixels = viaWriteDepthPixels_16;
-    }  
+    }
     else if (vmesa->glCtx->Visual.depthBits == 24) {
         swdd->ReadDepthSpan = viaReadDepthSpan_24_8;
        swdd->WriteDepthSpan = viaWriteDepthSpan_24_8;
@@ -245,7 +216,7 @@ void viaInitSpanFuncs(GLcontext *ctx)
        swdd->ReadStencilPixels = viaReadStencilPixels_24_8;
     }
     else if (vmesa->glCtx->Visual.depthBits == 32) {
-       swdd->ReadDepthSpan = viaReadDepthSpan_32;
+       swdd->ReadDepthSpan = viaReadDepthSpan_32;
        swdd->WriteDepthSpan = viaWriteDepthSpan_32;
        swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_32;
        swdd->ReadDepthPixels = viaReadDepthPixels_32;
@@ -256,7 +227,7 @@ void viaInitSpanFuncs(GLcontext *ctx)
     swdd->SpanRenderStart = viaSpanRenderStart;
     swdd->SpanRenderFinish = viaSpanRenderFinish; 
 
-#if 0    
+#if 0
     swdd->WriteCI8Span = NULL;
     swdd->WriteCI32Span = NULL;
     swdd->WriteMonoCISpan = NULL;