summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Scheidegger <rscheidegger@gmx.ch>2005-07-01 00:08:46 +0000
committerRoland Scheidegger <rscheidegger@gmx.ch>2005-07-01 00:08:46 +0000
commitcf5b2f7419b28cdd533c60e205d5a90d96e85c8e (patch)
treec9e0fe4db16d0a4fdbe2b7f0711203770be23a75
parentc212abf99af494f024b0b981a83350f7ac9821ef (diff)
remove common macros used in the span functions of most drivers from the individual drivers and put them in common code. It is still possible for a driver to define its own macros if it has special needs. This affects CLIPPIXEL, CLIPSPAN, HW_CLIPLOOP, HW_ENDCLIPLOOP, and for drivers using the spantmp2 template also GET_SRC_PTR and GET_DST_PTR.
-rw-r--r--src/mesa/drivers/dri/common/depthtmp.h11
-rw-r--r--src/mesa/drivers/dri/common/spantmp.h18
-rw-r--r--src/mesa/drivers/dri/common/spantmp2.h35
-rw-r--r--src/mesa/drivers/dri/common/spantmp_common.h81
-rw-r--r--src/mesa/drivers/dri/common/stenciltmp.h16
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_span.c31
-rw-r--r--src/mesa/drivers/dri/i810/i810span.c31
-rw-r--r--src/mesa/drivers/dri/i830/i830_span.c32
-rw-r--r--src/mesa/drivers/dri/i915/intel_span.c32
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_span.c25
-rw-r--r--src/mesa/drivers/dri/mga/mgaspan.c26
-rw-r--r--src/mesa/drivers/dri/r128/r128_span.c35
-rw-r--r--src/mesa/drivers/dri/r200/r200_span.c38
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_span.c31
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_span.c32
-rw-r--r--src/mesa/drivers/dri/savage/savagespan.c37
-rw-r--r--src/mesa/drivers/dri/sis/sis_span.c30
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_span.c13
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c45
19 files changed, 124 insertions, 475 deletions
diff --git a/src/mesa/drivers/dri/common/depthtmp.h b/src/mesa/drivers/dri/common/depthtmp.h
index bea4ea38d5..1875d157b4 100644
--- a/src/mesa/drivers/dri/common/depthtmp.h
+++ b/src/mesa/drivers/dri/common/depthtmp.h
@@ -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,
diff --git a/src/mesa/drivers/dri/common/spantmp.h b/src/mesa/drivers/dri/common/spantmp.h
index b15bbb2577..f726e83053 100644
--- a/src/mesa/drivers/dri/common/spantmp.h
+++ b/src/mesa/drivers/dri/common/spantmp.h
@@ -27,26 +27,12 @@
* 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
diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h
index b2b3186309..1a20a45970 100644
--- a/src/mesa/drivers/dri/common/spantmp2.h
+++ b/src/mesa/drivers/dri/common/spantmp2.h
@@ -34,27 +34,12 @@
*/
#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
@@ -65,6 +50,14 @@
#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] )
@@ -92,9 +85,17 @@
#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
index 0000000000..a4509a569d
--- /dev/null
+++ b/src/mesa/drivers/dri/common/spantmp_common.h
@@ -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
diff --git a/src/mesa/drivers/dri/common/stenciltmp.h b/src/mesa/drivers/dri/common/stenciltmp.h
index ffcb1a4c1e..dccab0660d 100644
--- a/src/mesa/drivers/dri/common/stenciltmp.h
+++ b/src/mesa/drivers/dri/common/stenciltmp.h
@@ -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,
diff --git a/src/mesa/drivers/dri/gamma/gamma_span.c b/src/mesa/drivers/dri/gamma/gamma_span.c
index db61f1c777..66cc961c64 100644
--- a/src/mesa/drivers/dri/gamma/gamma_span.c
+++ b/src/mesa/drivers/dri/gamma/gamma_span.c
@@ -40,21 +40,6 @@
#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() \
@@ -63,21 +48,6 @@
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.
*/
diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c
index 78b8265b70..1a976048c8 100644
--- a/src/mesa/drivers/dri/i810/i810span.c
+++ b/src/mesa/drivers/dri/i810/i810span.c
@@ -41,39 +41,10 @@
#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 ) \
diff --git a/src/mesa/drivers/dri/i830/i830_span.c b/src/mesa/drivers/dri/i830/i830_span.c
index a17ec9b6ac..4a86784e8a 100644
--- a/src/mesa/drivers/dri/i830/i830_span.c
+++ b/src/mesa/drivers/dri/i830/i830_span.c
@@ -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 ) \
diff --git a/src/mesa/drivers/dri/i915/intel_span.c b/src/mesa/drivers/dri/i915/intel_span.c
index 7a051718aa..3522f4f38f 100644
--- a/src/mesa/drivers/dri/i915/intel_span.c
+++ b/src/mesa/drivers/dri/i915/intel_span.c
@@ -69,39 +69,10 @@
#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 ) \
diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c
index 067ffab8ed..88863471d4 100644
--- a/src/mesa/drivers/dri/mach64/mach64_span.c
+++ b/src/mesa/drivers/dri/mach64/mach64_span.c
@@ -26,14 +26,13 @@
* 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"
@@ -71,25 +70,11 @@
#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; \
@@ -114,8 +99,6 @@
/* 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
@@ -126,8 +109,8 @@
/* 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
diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c
index 8487f4b83f..c62b1c875a 100644
--- a/src/mesa/drivers/dri/mga/mgaspan.c
+++ b/src/mesa/drivers/dri/mga/mgaspan.c
@@ -52,7 +52,7 @@
dPriv->y * pitch); \
GLuint p; \
(void) read_buf; (void) buf; (void) p
-
+
#define LOCAL_DEPTH_VARS \
@@ -69,22 +69,9 @@
#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; \
@@ -102,14 +89,10 @@
-
#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
@@ -119,9 +102,6 @@
/* 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;
diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c
index 9a2bf742b6..fd4722b3b3 100644
--- a/src/mesa/drivers/dri/r128/r128_span.c
+++ b/src/mesa/drivers/dri/r128/r128_span.c
@@ -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
diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c
index a5c9b1bab6..024e89461e 100644
--- a/src/mesa/drivers/dri/r200/r200_span.c
+++ b/src/mesa/drivers/dri/r200/r200_span.c
@@ -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;
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 9315543c15..d5606d70a1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -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()
diff --git a/src/mesa/drivers/dri/s3v/s3v_span.c b/src/mesa/drivers/dri/s3v/s3v_span.c
index e4a48ebfc8..49135a9c3f 100644
--- a/src/mesa/drivers/dri/s3v/s3v_span.c
+++ b/src/mesa/drivers/dri/s3v/s3v_span.c
@@ -45,23 +45,6 @@
#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 */
@@ -83,21 +66,6 @@
#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
diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c
index fef0aeec78..a261299cc5 100644
--- a/src/mesa/drivers/dri/savage/savagespan.c
+++ b/src/mesa/drivers/dri/savage/savagespan.c
@@ -42,6 +42,7 @@
GLubyte *buf = map + \
dPriv->x * cpp + \
dPriv->y * pitch; \
+ char *read_buf = buf; \
GLuint p; \
(void) p
@@ -58,20 +59,6 @@
#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()
@@ -86,26 +73,9 @@
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
@@ -116,8 +86,6 @@
/* 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
@@ -148,7 +116,6 @@
-
/* 16 bit float depthbuffer functions
*/
#define WRITE_DEPTH( _x, _y, d ) \
@@ -166,7 +133,6 @@
-
/* 8-bit stencil /24-bit integer depth depthbuffer functions.
* Depth range is reversed. See also savageCalcViewport.
*/
@@ -186,7 +152,6 @@
-
/* 24 bit float depthbuffer functions
*/
#define WRITE_DEPTH( _x, _y, d ) do { \
diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c
index abf3d652c0..78ce74b872 100644
--- a/src/mesa/drivers/dri/sis/sis_span.c
+++ b/src/mesa/drivers/dri/sis/sis_span.c
@@ -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 */
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c
index f27af2efcf..b00b7ad8db 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_span.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c
@@ -60,19 +60,6 @@
(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)
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index 0fbac9b506..16a1aa8b36 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -33,38 +33,9 @@
#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;