From 462183fe4cb6df6d90632d9e2cee881c8d26b1cb Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Mon, 26 Apr 2004 10:10:22 +0000 Subject: bring over build fixes from stable branch --- src/mesa/drivers/dri/tdfx/tdfx_span.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/mesa/drivers/dri/tdfx/tdfx_span.c') diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c index 43fcb90fd2..0d2bc811e0 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c @@ -572,14 +572,6 @@ 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)) \ [(y) * ((ReadParamsp)->LFBStrideInElts) \ @@ -588,12 +580,21 @@ GetFbParams(tdfxContextPtr fxMesa, (((type *)((ReadParamsp)->lfbWrapPtr)) \ [((y)) * ((ReadParamsp)->LFBStrideInElts) \ + ((x) - (ReadParamsp)->firstWrappedX)]) -#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \ - (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) +#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) \ (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(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, -- cgit v1.2.3