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.

This commit is contained in:
Roland Scheidegger
2005-07-01 00:08:46 +00:00
parent c212abf99a
commit cf5b2f7419
19 changed files with 124 additions and 475 deletions

View 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,

View File

@@ -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

View File

@@ -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); \

View File

@@ -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

View 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,

View File

@@ -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.
*/

View File

@@ -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 ) \

View 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 ) \

View File

@@ -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 ) \

View File

@@ -26,14 +26,13 @@
* Authors:
* Gareth Hughes <gareth@valinux.com>
* Leif Delgass <ldelgass@retinalburn.net>
* Jos<6F> Fonseca <j_r_fonseca@yahoo.co.uk>
* Jos<6F>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

View File

@@ -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;

View 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

View 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;

View 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()

View File

@@ -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

View File

@@ -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 { \

View 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 */

View File

@@ -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)

View File

@@ -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;