summaryrefslogtreecommitdiff
path: root/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c')
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
index 8af85a608..2574a846a 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
@@ -32,7 +32,7 @@
* Authors:
* Gareth Hughes <gareth@valinux.com>
* Brian Paul <brianp@valinux.com>
- * Keith Whitwell <keithw@valinux.com>
+ * Keith Whitwell <keith@tungstengraphics.com>
*
*/
@@ -572,30 +572,28 @@ GetFbParams(tdfxContextPtr fxMesa,
*
* Recall that x and y are screen coordinates.
*/
+#define GET_FB_DATA(ReadParamsp, type, x, y) \
+ (((x) < (ReadParamsp)->firstWrappedX) \
+ ? (((type *)((ReadParamsp)->lfbPtr)) \
+ [(y) * ((ReadParamsp)->LFBStrideInElts) \
+ + (x)]) \
+ : (((type *)((ReadParamsp)->lfbWrapPtr)) \
+ [((y)) * ((ReadParamsp)->LFBStrideInElts) \
+ + ((x) - (ReadParamsp)->firstWrappedX)]))
#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) \
- ((*(type **)(&(ReadParamsp)->lfbPtr)) \
+ (((type *)((ReadParamsp)->lfbPtr)) \
[(y) * ((ReadParamsp)->LFBStrideInElts) \
+ (x)])
#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) \
- ((*(type **)(&(ReadParamsp)->lfbWrapPtr)) \
- [(y) * ((ReadParamsp)->LFBStrideInElts) \
+ (((type *)((ReadParamsp)->lfbWrapPtr)) \
+ [((y)) * ((ReadParamsp)->LFBStrideInElts) \
+ ((x) - (ReadParamsp)->firstWrappedX)])
-#define GET_FB_DATA(ReadParamsp, type, x, y) \
- (((x) < (ReadParamsp)->firstWrappedX) ? \
- GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) : \
- GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y))
-
-#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value) \
+#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \
+ (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
+#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value) \
(GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
-#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value) \
+#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value) \
(GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
-#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \
- do { \
- if ((x) < (ReadParamsp)->firstWrappedX) \
- PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value); \
- else \
- PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value); \
- } while(0)
static void
tdfxDDWriteDepthSpan(GLcontext * ctx,
@@ -1309,21 +1307,19 @@ static void tdfxSpanRenderFinish( GLcontext *ctx )
}
/* Set the buffer used for reading */
-static void tdfxDDSetReadBuffer( GLcontext *ctx,
- GLframebuffer *buffer, GLenum mode )
+static void tdfxDDSetBuffer( GLcontext *ctx,
+ GLframebuffer *buffer, GLuint bufferBit )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
(void) buffer;
- switch ( mode ) {
- case GL_FRONT_LEFT:
- fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
+ switch ( bufferBit ) {
+ case FRONT_LEFT_BIT:
+ fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
break;
-
- case GL_BACK_LEFT:
- fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
+ case BACK_LEFT_BIT:
+ fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
break;
-
default:
break;
}
@@ -1338,7 +1334,7 @@ void tdfxDDInitSpanFuncs( GLcontext *ctx )
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
- swdd->SetReadBuffer = tdfxDDSetReadBuffer;
+ swdd->SetBuffer = tdfxDDSetBuffer;
if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) )
{