Allocate a sw_span struct in the swrast context instead of allocating it
on the stack frame in the point/line/triangle functions. (Klaus Niederkrueger) This should solve the performance problem Karl found on Windows.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: xm_tri.c,v 1.21 2001/12/17 04:56:29 brianp Exp $ */
|
||||
/* $Id: xm_tri.c,v 1.22 2002/04/19 14:05:51 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -68,21 +68,21 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx,
|
||||
#define INTERP_RGB 1
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
unsigned long p; \
|
||||
PACK_TRUECOLOR(p, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
PACK_TRUECOLOR(p, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
XMesaPutPixel(img, x, y, p); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -108,17 +108,17 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = PACK_8B8G8R(FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
pRow[i] = PACK_8B8G8R(FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -143,17 +143,17 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
pRow[i] = PACK_8R8G8B(FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -178,19 +178,19 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
PIXEL_TYPE *ptr = pRow + i; \
|
||||
ptr->r = FixedToInt(span.red); \
|
||||
ptr->g = FixedToInt(span.green); \
|
||||
ptr->b = FixedToInt(span.blue); \
|
||||
ptr->r = FixedToInt(span->red); \
|
||||
ptr->g = FixedToInt(span->green); \
|
||||
ptr->b = FixedToInt(span->blue); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -213,20 +213,20 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
unsigned long p; \
|
||||
PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
PACK_TRUEDITHER(p, x, y, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
XMesaPutPixel(img, x, y, p); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -251,17 +251,17 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = PACK_5R6G5B(FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
pRow[i] = PACK_5R6G5B(FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -286,18 +286,18 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -322,19 +322,19 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
XDITHER_SETUP(y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red),\
|
||||
FixedToInt(span.green), FixedToInt(span.blue) ); \
|
||||
pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span->red),\
|
||||
FixedToInt(span->green), FixedToInt(span->blue) ); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -357,20 +357,20 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
XDITHER_SETUP(y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
unsigned long p = XDITHER(x, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
unsigned long p = XDITHER(x, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
XMesaPutPixel(img, x, y, p); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -396,17 +396,17 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx,
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
LOOKUP_SETUP; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = LOOKUP(FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
pRow[i] = LOOKUP(FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -432,18 +432,18 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue) ); \
|
||||
pRow[i] = DITHER_HPCR(x, y, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue) ); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span.z += span.zStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -468,14 +468,14 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
XMesaPutPixel(img, x, y, pixel); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -501,13 +501,13 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx,
|
||||
v2->color[1], v2->color[2] );
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = (PIXEL_TYPE) p; \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -533,13 +533,13 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx,
|
||||
v2->color[1], v2->color[2] );
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = (PIXEL_TYPE) p; \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -563,8 +563,8 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
PIXEL_TYPE *ptr = pRow + i; \
|
||||
ptr->r = color[RCOMP]; \
|
||||
@@ -572,7 +572,7 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx,
|
||||
ptr->b = color[BCOMP]; \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -593,9 +593,9 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx,
|
||||
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
unsigned long p; \
|
||||
PACK_TRUEDITHER(p, x, y, v2->color[0], \
|
||||
@@ -603,7 +603,7 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx,
|
||||
XMesaPutPixel(img, x, y, p); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -629,13 +629,13 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx,
|
||||
v2->color[1], v2->color[2] );
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = (PIXEL_TYPE) p; \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -659,15 +659,15 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \
|
||||
color[GCOMP], color[BCOMP]); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -693,15 +693,15 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, y)); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -725,16 +725,16 @@ static void flat_DITHER_z_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
FLAT_DITHER_ROW_SETUP(y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
unsigned long p = FLAT_DITHER(x); \
|
||||
XMesaPutPixel(img, x, y, p); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -761,14 +761,14 @@ static void flat_HPCR_z_triangle( GLcontext *ctx,
|
||||
GLubyte b = v2->color[2];
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -797,13 +797,13 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx,
|
||||
GLubyte p = LOOKUP(r,g,b);
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span.z); \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
const DEPTH_TYPE z = FixedToDepth(span->z); \
|
||||
if (z < zRow[i]) { \
|
||||
pRow[i] = p; \
|
||||
zRow[i] = z; \
|
||||
} \
|
||||
span.z += span.zStep; \
|
||||
span->z += span->zStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -824,15 +824,15 @@ static void smooth_TRUECOLOR_triangle( GLcontext *ctx,
|
||||
#define INTERP_RGB 1
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
unsigned long p; \
|
||||
PACK_TRUECOLOR(p, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
PACK_TRUECOLOR(p, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
XMesaPutPixel(img, x, y, p); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -854,12 +854,12 @@ static void smooth_8A8B8G8R_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
pRow[i] = PACK_8B8G8R(FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue) ); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
pRow[i] = PACK_8B8G8R(FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue) ); \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
} \
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -881,12 +881,12 @@ static void smooth_8R8G8B_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue) ); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
pRow[i] = PACK_8R8G8B(FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue) ); \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -909,13 +909,13 @@ static void smooth_8R8G8B24_triangle( GLcontext *ctx,
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
PIXEL_TYPE *pixel = pRow; \
|
||||
for (i = 0; i < span.end; i++, pixel++) { \
|
||||
pixel->r = FixedToInt(span.red); \
|
||||
pixel->g = FixedToInt(span.green); \
|
||||
pixel->b = FixedToInt(span.blue); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
for (i = 0; i < span->end; i++, pixel++) { \
|
||||
pixel->r = FixedToInt(span->red); \
|
||||
pixel->g = FixedToInt(span->green); \
|
||||
pixel->b = FixedToInt(span->blue); \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -935,15 +935,15 @@ static void smooth_TRUEDITHER_triangle( GLcontext *ctx,
|
||||
#define INTERP_RGB 1
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
unsigned long p; \
|
||||
PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
PACK_TRUEDITHER(p, x, y, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
XMesaPutPixel(img, x, y, p ); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -965,12 +965,12 @@ static void smooth_5R6G5B_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -992,13 +992,13 @@ static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -1020,14 +1020,14 @@ static void smooth_DITHER8_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
XDITHER_SETUP(y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue) ); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue) ); \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -1048,15 +1048,15 @@ static void smooth_DITHER_triangle( GLcontext *ctx,
|
||||
#define INTERP_RGB 1
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
XDITHER_SETUP(y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
unsigned long p = XDITHER(x, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue) ); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
unsigned long p = XDITHER(x, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue) ); \
|
||||
XMesaPutPixel(img, x, y, p); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -1080,12 +1080,12 @@ static void smooth_LOOKUP8_triangle( GLcontext *ctx,
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
LOOKUP_SETUP; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
pRow[i] = LOOKUP(FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue));\
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
pRow[i] = LOOKUP(FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue));\
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -1109,13 +1109,13 @@ static void smooth_HPCR_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \
|
||||
FixedToInt(span.green), FixedToInt(span.blue)); \
|
||||
span.red += span.redStep; \
|
||||
span.green += span.greenStep; \
|
||||
span.blue += span.blueStep; \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
pRow[i] = DITHER_HPCR(x, y, FixedToInt(span->red), \
|
||||
FixedToInt(span->green), FixedToInt(span->blue)); \
|
||||
span->red += span->redStep; \
|
||||
span->green += span->greenStep; \
|
||||
span->blue += span->blueStep; \
|
||||
}
|
||||
|
||||
#include "swrast/s_tritemp.h"
|
||||
@@ -1138,8 +1138,8 @@ static void flat_TRUECOLOR_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
XMesaPutPixel(img, x, y, pixel); \
|
||||
}
|
||||
|
||||
@@ -1164,7 +1164,7 @@ static void flat_8A8B8G8R_triangle( GLcontext *ctx,
|
||||
v2->color[1], v2->color[2] );
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
pRow[i] = (PIXEL_TYPE) p; \
|
||||
}
|
||||
|
||||
@@ -1189,7 +1189,7 @@ static void flat_8R8G8B_triangle( GLcontext *ctx,
|
||||
v2->color[1], v2->color[2] );
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
pRow[i] = (PIXEL_TYPE) p; \
|
||||
}
|
||||
|
||||
@@ -1213,7 +1213,7 @@ static void flat_8R8G8B24_triangle( GLcontext *ctx,
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
PIXEL_TYPE *pixel = pRow; \
|
||||
for (i = 0; i < span.end; i++, pixel++) { \
|
||||
for (i = 0; i < span->end; i++, pixel++) { \
|
||||
pixel->r = color[RCOMP]; \
|
||||
pixel->g = color[GCOMP]; \
|
||||
pixel->b = color[BCOMP]; \
|
||||
@@ -1235,8 +1235,8 @@ static void flat_TRUEDITHER_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
unsigned long p; \
|
||||
PACK_TRUEDITHER(p, x, y, v2->color[0], \
|
||||
v2->color[1], v2->color[2] ); \
|
||||
@@ -1265,7 +1265,7 @@ static void flat_5R6G5B_triangle( GLcontext *ctx,
|
||||
v2->color[1], v2->color[2] );
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
pRow[i] = (PIXEL_TYPE) p; \
|
||||
}
|
||||
|
||||
@@ -1288,8 +1288,8 @@ static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx,
|
||||
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \
|
||||
color[GCOMP], color[BCOMP]); \
|
||||
}
|
||||
@@ -1315,9 +1315,9 @@ static void flat_DITHER8_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, y)); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \
|
||||
}
|
||||
|
||||
@@ -1340,9 +1340,9 @@ static void flat_DITHER_triangle( GLcontext *ctx,
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
FLAT_DITHER_ROW_SETUP(y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
unsigned long p = FLAT_DITHER(x); \
|
||||
XMesaPutPixel(img, x, y, p ); \
|
||||
}
|
||||
@@ -1369,8 +1369,8 @@ static void flat_HPCR_triangle( GLcontext *ctx,
|
||||
GLubyte b = v2->color[2];
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
|
||||
for (i = 0; i < span.end; i++, x++) { \
|
||||
GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y); \
|
||||
for (i = 0; i < span->end; i++, x++) { \
|
||||
pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \
|
||||
}
|
||||
|
||||
@@ -1398,7 +1398,7 @@ static void flat_LOOKUP8_triangle( GLcontext *ctx,
|
||||
GLubyte p = LOOKUP(r,g,b);
|
||||
#define RENDER_SPAN( span ) \
|
||||
GLuint i; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
for (i = 0; i < span->end; i++) { \
|
||||
pRow[i] = (PIXEL_TYPE) p; \
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user