used indent to clean-up the code

This commit is contained in:
Brian Paul 2001-03-03 20:59:06 +00:00
parent 188f2949ea
commit d62269757b
13 changed files with 5604 additions and 5312 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -63,7 +63,7 @@
#endif
#if !defined(FXMESA_USE_ARGB)
#if !defined(FXMESA_USE_ARGB)
@ -101,33 +101,28 @@
( ((unsigned int)(c[RCOMP]))<<16 ) | \
( ((unsigned int)(c[GCOMP]))<<8 ) | \
( (unsigned int)(c[BCOMP])) )
inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
FxU32 dst_x,
FxU32 dst_y,
FxU32 src_width,
FxI32 src_stride,
void *src_data )
inline void
LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
FxU32 dst_x,
FxU32 dst_y,
FxU32 src_width, FxI32 src_stride, void *src_data)
{
/* Covert to ARGB */
GLubyte (*rgba)[4] = src_data;
GLubyte(*rgba)[4] = src_data;
GLuint argb[MAX_WIDTH];
int i;
for (i = 0; i < src_width; i++)
{
for (i = 0; i < src_width; i++) {
argb[i] = MESACOLOR_TO_ARGB(rgba[i]);
}
writeRegionClipped( /*fxMesa,*/ NULL, dst_buffer,
dst_x,
dst_y,
GR_LFB_SRC_FMT_8888,
src_width,
1,
src_stride,
(void*)argb);
writeRegionClipped( /*fxMesa, */ NULL, dst_buffer,
dst_x,
dst_y,
GR_LFB_SRC_FMT_8888,
src_width, 1, src_stride, (void *) argb);
}
#endif /* !defined(FXMESA_USE_RGBA) */
@ -136,162 +131,178 @@ inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
/************************************************************************/
static void fxDDWriteRGBASpan(const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[])
static void
fxDDWriteRGBASpan(const GLcontext * ctx,
GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLuint i;
GLint bottom = fxMesa->height - 1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBASpan(...)\n");
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteRGBASpan(...)\n");
}
if (mask) {
int span=0;
if (mask) {
int span = 0;
for (i=0;i<n;i++) {
if (mask[i]) {
++span;
} else {
if (span > 0) {
LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x+i-span, bottom-y,
/* GR_LFB_SRC_FMT_8888,*/ span, /*1,*/ 0, (void *) rgba[i-span] );
span = 0;
}
for (i = 0; i < n; i++) {
if (mask[i]) {
++span;
}
else {
if (span > 0) {
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x + i - span,
bottom - y,
/* GR_LFB_SRC_FMT_8888, */ span, /*1, */ 0,
(void *) rgba[i - span]);
span = 0;
}
}
}
}
if (span > 0)
LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x+n-span, bottom-y,
/* GR_LFB_SRC_FMT_8888, */ span, /*1,*/ 0, (void *) rgba[n-span] );
} else
LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x, bottom-y,/* GR_LFB_SRC_FMT_8888,*/
n,/* 1,*/ 0, (void *) rgba );
if (span > 0)
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x + n - span, bottom - y,
/* GR_LFB_SRC_FMT_8888, */ span, /*1, */ 0,
(void *) rgba[n - span]);
}
else
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x, bottom - y, /* GR_LFB_SRC_FMT_8888, */
n, /* 1, */ 0, (void *) rgba);
}
static void fxDDWriteRGBSpan(const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLubyte rgb[][3], const GLubyte mask[])
static void
fxDDWriteRGBSpan(const GLcontext * ctx,
GLuint n, GLint x, GLint y,
const GLubyte rgb[][3], const GLubyte mask[])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLubyte rgba[MAX_WIDTH][4];
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLuint i;
GLint bottom = fxMesa->height - 1;
GLubyte rgba[MAX_WIDTH][4];
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBSpan()\n");
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteRGBSpan()\n");
}
if (mask) {
int span=0;
if (mask) {
int span = 0;
for (i=0;i<n;i++) {
if (mask[i]) {
rgba[span][RCOMP] = rgb[i][0];
rgba[span][GCOMP] = rgb[i][1];
rgba[span][BCOMP] = rgb[i][2];
rgba[span][ACOMP] = 255;
++span;
} else {
if (span > 0) {
LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x+i-span, bottom-y,
/*GR_LFB_SRC_FMT_8888,*/ span,/* 1,*/ 0, (void *) rgba );
span = 0;
}
for (i = 0; i < n; i++) {
if (mask[i]) {
rgba[span][RCOMP] = rgb[i][0];
rgba[span][GCOMP] = rgb[i][1];
rgba[span][BCOMP] = rgb[i][2];
rgba[span][ACOMP] = 255;
++span;
}
else {
if (span > 0) {
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x + i - span,
bottom - y,
/*GR_LFB_SRC_FMT_8888, */ span, /* 1, */ 0,
(void *) rgba);
span = 0;
}
}
}
}
if (span > 0)
LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x+n-span, bottom-y,
/*GR_LFB_SRC_FMT_8888,*/ span,/* 1,*/ 0, (void *) rgba );
} else {
for (i=0;i<n;i++) {
rgba[i][RCOMP]=rgb[i][0];
rgba[i][GCOMP]=rgb[i][1];
rgba[i][BCOMP]=rgb[i][2];
rgba[i][ACOMP]=255;
}
if (span > 0)
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x + n - span, bottom - y,
/*GR_LFB_SRC_FMT_8888, */ span, /* 1, */ 0,
(void *) rgba);
}
else {
for (i = 0; i < n; i++) {
rgba[i][RCOMP] = rgb[i][0];
rgba[i][GCOMP] = rgb[i][1];
rgba[i][BCOMP] = rgb[i][2];
rgba[i][ACOMP] = 255;
}
LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x, bottom-y,/* GR_LFB_SRC_FMT_8888,*/
n,/* 1,*/ 0, (void *) rgba );
}
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x, bottom - y, /* GR_LFB_SRC_FMT_8888, */
n, /* 1, */ 0, (void *) rgba);
}
}
static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLchan color[4], const GLubyte mask[])
static void
fxDDWriteMonoRGBASpan(const GLcontext * ctx,
GLuint n, GLint x, GLint y,
const GLchan color[4], const GLubyte mask[])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GLuint data[MAX_WIDTH];
GrColor_t gColor = FXCOLOR4(color);
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLuint i;
GLint bottom = fxMesa->height - 1;
GLuint data[MAX_WIDTH];
GrColor_t gColor = FXCOLOR4(color);
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n");
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteMonoRGBASpan(...)\n");
}
if (mask) {
int span=0;
if (mask) {
int span = 0;
for (i=0;i<n;i++) {
if (mask[i]) {
data[span] = (GLuint) gColor;
++span;
} else {
if (span > 0) {
writeRegionClipped(fxMesa, fxMesa->currentFB, x+i-span, bottom-y,
GR_LFB_SRC_FMT_8888, span, 1, 0,
(void *) data );
span = 0;
}
for (i = 0; i < n; i++) {
if (mask[i]) {
data[span] = (GLuint) gColor;
++span;
}
else {
if (span > 0) {
writeRegionClipped(fxMesa, fxMesa->currentFB, x + i - span,
bottom - y, GR_LFB_SRC_FMT_8888, span, 1, 0,
(void *) data);
span = 0;
}
}
}
}
if (span > 0)
writeRegionClipped(fxMesa, fxMesa->currentFB, x+n-span, bottom-y,
GR_LFB_SRC_FMT_8888, span, 1, 0,
(void *) data );
} else {
for (i=0;i<n;i++) {
data[i]=(GLuint) gColor;
}
if (span > 0)
writeRegionClipped(fxMesa, fxMesa->currentFB, x + n - span,
bottom - y, GR_LFB_SRC_FMT_8888, span, 1, 0,
(void *) data);
}
else {
for (i = 0; i < n; i++) {
data[i] = (GLuint) gColor;
}
writeRegionClipped(fxMesa, fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888,
n, 1, 0, (void *) data );
}
writeRegionClipped(fxMesa, fxMesa->currentFB, x, bottom - y,
GR_LFB_SRC_FMT_8888, n, 1, 0, (void *) data);
}
}
#if 0
static void fxDDReadRGBASpan(const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLubyte rgba[][4])
static void
fxDDReadRGBASpan(const GLcontext * ctx,
GLuint n, GLint x, GLint y, GLubyte rgba[][4])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLushort data[MAX_WIDTH];
GLuint i;
GLint bottom=fxMesa->height-1;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLushort data[MAX_WIDTH];
GLuint i;
GLint bottom = fxMesa->height - 1;
printf("read span %d, %d, %d\n", x,y,n);
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDReadRGBASpan(...)\n");
}
printf("read span %d, %d, %d\n", x, y, n);
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDReadRGBASpan(...)\n");
}
assert(n < MAX_WIDTH);
assert(n < MAX_WIDTH);
FX_grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data);
FX_grLfbReadRegion(fxMesa->currentFB, x, bottom - y, n, 1, 0, data);
for (i=0;i<n;i++) {
GLushort pixel = data[i];
rgba[i][RCOMP] = FX_PixelToR[pixel];
rgba[i][GCOMP] = FX_PixelToG[pixel];
rgba[i][BCOMP] = FX_PixelToB[pixel];
rgba[i][ACOMP] = 255;
}
for (i = 0; i < n; i++) {
GLushort pixel = data[i];
rgba[i][RCOMP] = FX_PixelToR[pixel];
rgba[i][GCOMP] = FX_PixelToG[pixel];
rgba[i][BCOMP] = FX_PixelToB[pixel];
rgba[i][ACOMP] = 255;
}
}
#endif
@ -300,52 +311,49 @@ static void fxDDReadRGBASpan(const GLcontext *ctx,
* Read a span of 16-bit RGB pixels. Note, we don't worry about cliprects
* since OpenGL says obscured pixels have undefined values.
*/
static void read_R5G6B5_span(const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLubyte rgba[][4])
static void
read_R5G6B5_span(const GLcontext * ctx,
GLuint n, GLint x, GLint y, GLubyte rgba[][4])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
fxMesa->currentFB,
GR_LFBWRITEMODE_ANY,
GR_ORIGIN_UPPER_LEFT,
FXFALSE,
&info)) {
const GLint winX = 0;
const GLint winY = fxMesa->height - 1;
const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
const GLushort *data16 = (const GLushort *) info.lfbPtr
+ (winY - y) * srcStride
+ (winX + x);
const GLuint *data32 = (const GLuint *) data16;
GLuint i, j;
GLuint extraPixel = (n & 1);
n -= extraPixel;
for (i = j = 0; i < n; i += 2, j++) {
GLuint pixel = data32[j];
GLuint pixel0 = pixel & 0xffff;
GLuint pixel1 = pixel >> 16;
rgba[i][RCOMP] = FX_PixelToR[pixel0];
rgba[i][GCOMP] = FX_PixelToG[pixel0];
rgba[i][BCOMP] = FX_PixelToB[pixel0];
rgba[i][ACOMP] = 255;
rgba[i+1][RCOMP] = FX_PixelToR[pixel1];
rgba[i+1][GCOMP] = FX_PixelToG[pixel1];
rgba[i+1][BCOMP] = FX_PixelToB[pixel1];
rgba[i+1][ACOMP] = 255;
}
if (extraPixel) {
GLushort pixel = data16[n];
rgba[n][RCOMP] = FX_PixelToR[pixel];
rgba[n][GCOMP] = FX_PixelToG[pixel];
rgba[n][BCOMP] = FX_PixelToB[pixel];
rgba[n][ACOMP] = 255;
}
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
fxMesa->currentFB,
GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
const GLint winX = 0;
const GLint winY = fxMesa->height - 1;
const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
const GLushort *data16 = (const GLushort *) info.lfbPtr
+ (winY - y) * srcStride + (winX + x);
const GLuint *data32 = (const GLuint *) data16;
GLuint i, j;
GLuint extraPixel = (n & 1);
n -= extraPixel;
for (i = j = 0; i < n; i += 2, j++) {
GLuint pixel = data32[j];
GLuint pixel0 = pixel & 0xffff;
GLuint pixel1 = pixel >> 16;
rgba[i][RCOMP] = FX_PixelToR[pixel0];
rgba[i][GCOMP] = FX_PixelToG[pixel0];
rgba[i][BCOMP] = FX_PixelToB[pixel0];
rgba[i][ACOMP] = 255;
rgba[i + 1][RCOMP] = FX_PixelToR[pixel1];
rgba[i + 1][GCOMP] = FX_PixelToG[pixel1];
rgba[i + 1][BCOMP] = FX_PixelToB[pixel1];
rgba[i + 1][ACOMP] = 255;
}
if (extraPixel) {
GLushort pixel = data16[n];
rgba[n][RCOMP] = FX_PixelToR[pixel];
rgba[n][GCOMP] = FX_PixelToG[pixel];
rgba[n][BCOMP] = FX_PixelToB[pixel];
rgba[n][ACOMP] = 255;
}
grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
}
END_BOARD_LOCK();
grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
}
END_BOARD_LOCK();
}
@ -353,76 +361,75 @@ static void read_R5G6B5_span(const GLcontext *ctx,
/***** Pixel functions *****/
/************************************************************************/
static void fxDDWriteRGBAPixels(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
CONST GLubyte rgba[][4], const GLubyte mask[])
static void
fxDDWriteRGBAPixels(const GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
CONST GLubyte rgba[][4], const GLubyte mask[])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLuint i;
GLint bottom = fxMesa->height - 1;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteRGBAPixels(...)\n");
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteRGBAPixels(...)\n");
}
for(i=0;i<n;i++)
if(mask[i])
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i], bottom-y[i],
1, 1, (void *)rgba[i]);
for (i = 0; i < n; i++)
if (mask[i])
LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i], bottom - y[i],
1, 1, (void *) rgba[i]);
}
static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLchan color[4], const GLubyte mask[])
static void
fxDDWriteMonoRGBAPixels(const GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
const GLchan color[4], const GLubyte mask[])
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i;
GLint bottom=fxMesa->height-1;
GrColor_t gColor = FXCOLOR4(color);
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLuint i;
GLint bottom = fxMesa->height - 1;
GrColor_t gColor = FXCOLOR4(color);
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n");
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteMonoRGBAPixels(...)\n");
}
for(i=0;i<n;i++)
if(mask[i])
writeRegionClipped(fxMesa, fxMesa->currentFB,x[i],bottom-y[i],
GR_LFB_SRC_FMT_8888,1,1,0,(void *) &gColor);
for (i = 0; i < n; i++)
if (mask[i])
writeRegionClipped(fxMesa, fxMesa->currentFB, x[i], bottom - y[i],
GR_LFB_SRC_FMT_8888, 1, 1, 0, (void *) &gColor);
}
static void read_R5G6B5_pixels(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[])
static void
read_R5G6B5_pixels(const GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[])
{
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
fxMesa->currentFB,
GR_LFBWRITEMODE_ANY,
GR_ORIGIN_UPPER_LEFT,
FXFALSE,
&info)) {
const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
const GLint winX = 0;
const GLint winY = fxMesa->height - 1;
GLuint i;
for(i=0;i<n;i++) {
if(mask[i]) {
const GLushort *data16 = (const GLushort *) info.lfbPtr
+ (winY - y[i]) * srcStride
+ (winX + x[i]);
const GLushort pixel = *data16;
rgba[i][RCOMP] = FX_PixelToR[pixel];
rgba[i][GCOMP] = FX_PixelToG[pixel];
rgba[i][BCOMP] = FX_PixelToB[pixel];
rgba[i][ACOMP] = 255;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
fxMesa->currentFB,
GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
const GLint winX = 0;
const GLint winY = fxMesa->height - 1;
GLuint i;
for (i = 0; i < n; i++) {
if (mask[i]) {
const GLushort *data16 = (const GLushort *) info.lfbPtr
+ (winY - y[i]) * srcStride + (winX + x[i]);
const GLushort pixel = *data16;
rgba[i][RCOMP] = FX_PixelToR[pixel];
rgba[i][GCOMP] = FX_PixelToG[pixel];
rgba[i][BCOMP] = FX_PixelToB[pixel];
rgba[i][ACOMP] = 255;
}
}
}
grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
}
END_BOARD_LOCK();
grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
}
END_BOARD_LOCK();
}
@ -431,102 +438,106 @@ static void read_R5G6B5_pixels(const GLcontext *ctx,
/***** Depth functions *****/
/************************************************************************/
void fxDDWriteDepthSpan(GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth depth[],
const GLubyte mask[])
void
fxDDWriteDepthSpan(GLcontext * ctx,
GLuint n, GLint x, GLint y, const GLdepth depth[],
const GLubyte mask[])
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
GLint bottom = fxMesa->height - 1;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLint bottom = fxMesa->height - 1;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n");
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n");
}
if (mask) {
GLint i;
for (i = 0; i < n; i++) {
if (mask[i]) {
GLshort d = depth[i];
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom - y,
GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d);
if (mask) {
GLint i;
for (i = 0; i < n; i++) {
if (mask[i]) {
GLshort d = depth[i];
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom - y,
GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d);
}
}
}
}
else {
GLushort depth16[MAX_WIDTH];
GLint i;
for (i = 0; i < n; i++) {
depth16[i] = depth[i];
}
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom - y,
GR_LFB_SRC_FMT_ZA16, n, 1, 0, (void *) depth16);
}
}
else {
GLushort depth16[MAX_WIDTH];
GLint i;
for (i = 0; i < n; i++) {
depth16[i] = depth[i];
}
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom - y,
GR_LFB_SRC_FMT_ZA16, n, 1, 0, (void *) depth16);
}
}
void fxDDReadDepthSpan(GLcontext *ctx,
GLuint n, GLint x, GLint y, GLdepth depth[])
void
fxDDReadDepthSpan(GLcontext * ctx,
GLuint n, GLint x, GLint y, GLdepth depth[])
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
GLint bottom = fxMesa->height - 1;
GLushort depth16[MAX_WIDTH];
GLuint i;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLint bottom = fxMesa->height - 1;
GLushort depth16[MAX_WIDTH];
GLuint i;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n");
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n");
}
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16);
for (i = 0; i < n; i++) {
depth[i] = depth16[i];
}
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16);
for (i = 0; i < n; i++) {
depth[i] = depth16[i];
}
}
void fxDDWriteDepthPixels(GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLdepth depth[], const GLubyte mask[])
void
fxDDWriteDepthPixels(GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
const GLdepth depth[], const GLubyte mask[])
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
GLint bottom = fxMesa->height - 1;
GLuint i;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLint bottom = fxMesa->height - 1;
GLuint i;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteDepthPixels(...)\n");
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDWriteDepthPixels(...)\n");
}
for (i = 0; i < n; i++) {
if (mask[i]) {
for (i = 0; i < n; i++) {
if (mask[i]) {
int xpos = x[i];
int ypos = bottom - y[i];
GLushort d = depth[i];
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos,
GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d);
}
}
}
void
fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
const GLint x[], const GLint y[], GLdepth depth[])
{
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLint bottom = fxMesa->height - 1;
GLuint i;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDReadDepthPixels(...)\n");
}
for (i = 0; i < n; i++) {
int xpos = x[i];
int ypos = bottom - y[i];
GLushort d = depth[i];
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos,
GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d);
}
}
}
void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], GLdepth depth[])
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
GLint bottom = fxMesa->height - 1;
GLuint i;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDReadDepthPixels(...)\n");
}
for (i = 0; i < n; i++) {
int xpos = x[i];
int ypos = bottom - y[i];
GLushort d;
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, xpos, ypos, 1, 1, 0, &d);
depth[i] = d;
}
GLushort d;
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, xpos, ypos, 1, 1, 0, &d);
depth[i] = d;
}
}
@ -535,26 +546,27 @@ void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
/************************************************************************/
void fxSetupDDSpanPointers(GLcontext *ctx)
void
fxSetupDDSpanPointers(GLcontext * ctx)
{
ctx->Driver.WriteRGBASpan =fxDDWriteRGBASpan;
ctx->Driver.WriteRGBSpan =fxDDWriteRGBSpan;
ctx->Driver.WriteMonoRGBASpan =fxDDWriteMonoRGBASpan;
ctx->Driver.WriteRGBAPixels =fxDDWriteRGBAPixels;
ctx->Driver.WriteMonoRGBAPixels =fxDDWriteMonoRGBAPixels;
ctx->Driver.WriteRGBASpan = fxDDWriteRGBASpan;
ctx->Driver.WriteRGBSpan = fxDDWriteRGBSpan;
ctx->Driver.WriteMonoRGBASpan = fxDDWriteMonoRGBASpan;
ctx->Driver.WriteRGBAPixels = fxDDWriteRGBAPixels;
ctx->Driver.WriteMonoRGBAPixels = fxDDWriteMonoRGBAPixels;
ctx->Driver.WriteCI8Span =NULL;
ctx->Driver.WriteCI32Span =NULL;
ctx->Driver.WriteMonoCISpan =NULL;
ctx->Driver.WriteCI32Pixels =NULL;
ctx->Driver.WriteMonoCIPixels =NULL;
ctx->Driver.WriteCI8Span = NULL;
ctx->Driver.WriteCI32Span = NULL;
ctx->Driver.WriteMonoCISpan = NULL;
ctx->Driver.WriteCI32Pixels = NULL;
ctx->Driver.WriteMonoCIPixels = NULL;
/* ctx->Driver.ReadRGBASpan =fxDDReadRGBASpan;*/
ctx->Driver.ReadRGBASpan = read_R5G6B5_span;
ctx->Driver.ReadRGBAPixels = read_R5G6B5_pixels;
/* ctx->Driver.ReadRGBASpan =fxDDReadRGBASpan; */
ctx->Driver.ReadRGBASpan = read_R5G6B5_span;
ctx->Driver.ReadRGBAPixels = read_R5G6B5_pixels;
ctx->Driver.ReadCI32Span =NULL;
ctx->Driver.ReadCI32Pixels =NULL;
ctx->Driver.ReadCI32Span = NULL;
ctx->Driver.ReadCI32Pixels = NULL;
}
@ -566,9 +578,10 @@ void fxSetupDDSpanPointers(GLcontext *ctx)
*/
extern int gl_fx_dummy_function_span(void);
int gl_fx_dummy_function_span(void)
int
gl_fx_dummy_function_span(void)
{
return 0;
return 0;
}
#endif /* FX */
#endif /* FX */

File diff suppressed because it is too large Load diff

View file

@ -96,29 +96,33 @@ extern float gl_ubyte_to_float_255_color_tab[256];
/* Should have size == 16 * sizeof(float).
*/
typedef union {
GrVertex v;
GLfloat f[16];
GLuint ui[16];
} fxVertex;
typedef union
{
GrVertex v;
GLfloat f[16];
GLuint ui[16];
}
fxVertex;
/* Used in the fxvtxfmt t&l engine.
*/
typedef struct {
typedef struct
{
GrVertex v;
GLfloat clip[4];
GLfloat texcoord[2][2];
GLubyte mask;
GLfloat normal[3]; /* for replay & fallback */
} fxClipVertex;
}
fxClipVertex;
typedef void (*vfmt_project_func)( GLcontext *ctx, fxClipVertex *v );
typedef void (*vfmt_interpolate_func)( GLfloat t,
fxClipVertex *O,
const fxClipVertex *I,
const fxClipVertex *J );
typedef void (*vfmt_project_func) (GLcontext * ctx, fxClipVertex * v);
typedef void (*vfmt_interpolate_func) (GLfloat t,
fxClipVertex * O,
const fxClipVertex * I,
const fxClipVertex * J);
@ -204,87 +208,97 @@ typedef void (*vfmt_interpolate_func)( GLfloat t,
/*
Memory range from startAddr to endAddr-1
*/
typedef struct MemRange_t {
struct MemRange_t *next;
FxU32 startAddr, endAddr;
} MemRange;
typedef struct MemRange_t
{
struct MemRange_t *next;
FxU32 startAddr, endAddr;
}
MemRange;
typedef struct {
GLsizei width, height; /* image size */
GLint wScale, hScale; /* image scale factor */
GrTextureFormat_t glideFormat; /* Glide image format */
} tfxMipMapLevel;
typedef struct
{
GLsizei width, height; /* image size */
GLint wScale, hScale; /* image scale factor */
GrTextureFormat_t glideFormat; /* Glide image format */
}
tfxMipMapLevel;
/*
* TDFX-specific texture object data. This hangs off of the
* struct gl_texture_object DriverData pointer.
*/
typedef struct tfxTexInfo_t {
struct tfxTexInfo *next;
struct gl_texture_object *tObj;
typedef struct tfxTexInfo_t
{
struct tfxTexInfo *next;
struct gl_texture_object *tObj;
GLuint lastTimeUsed;
FxU32 whichTMU;
GLboolean isInTM;
GLuint lastTimeUsed;
FxU32 whichTMU;
GLboolean isInTM;
MemRange *tm[FX_NUM_TMU];
MemRange *tm[FX_NUM_TMU];
GLint minLevel, maxLevel;
GLint baseLevelInternalFormat;
GLint minLevel, maxLevel;
GLint baseLevelInternalFormat;
GrTexInfo info;
GrTexInfo info;
GrTextureFilterMode_t minFilt;
GrTextureFilterMode_t maxFilt;
FxBool LODblend;
GrTextureFilterMode_t minFilt;
GrTextureFilterMode_t maxFilt;
FxBool LODblend;
GrTextureClampMode_t sClamp;
GrTextureClampMode_t tClamp;
GrTextureClampMode_t sClamp;
GrTextureClampMode_t tClamp;
GrMipMapMode_t mmMode;
GrMipMapMode_t mmMode;
GLfloat sScale, tScale;
GLint int_sScale, int_tScale; /* x86 floating point trick for
* multiplication by powers of 2.
* Used in fxfasttmp.h
*/
GLfloat sScale, tScale;
GLint int_sScale, int_tScale; /* x86 floating point trick for
* multiplication by powers of 2.
* Used in fxfasttmp.h
*/
GuTexPalette palette;
GuTexPalette palette;
GLboolean fixedPalette;
GLboolean validated;
} tfxTexInfo;
GLboolean fixedPalette;
GLboolean validated;
}
tfxTexInfo;
typedef struct {
GLuint swapBuffer;
GLuint reqTexUpload;
GLuint texUpload;
GLuint memTexUpload;
} tfxStats;
typedef struct
{
GLuint swapBuffer;
GLuint reqTexUpload;
GLuint texUpload;
GLuint memTexUpload;
}
tfxStats;
typedef struct {
/* Alpha test */
typedef struct
{
/* Alpha test */
GLboolean alphaTestEnabled;
GrCmpFnc_t alphaTestFunc;
GrAlpha_t alphaTestRefValue;
GLboolean alphaTestEnabled;
GrCmpFnc_t alphaTestFunc;
GrAlpha_t alphaTestRefValue;
/* Blend function */
/* Blend function */
GLboolean blendEnabled;
GrAlphaBlendFnc_t blendSrcFuncRGB;
GrAlphaBlendFnc_t blendDstFuncRGB;
GrAlphaBlendFnc_t blendSrcFuncAlpha;
GrAlphaBlendFnc_t blendDstFuncAlpha;
GLboolean blendEnabled;
GrAlphaBlendFnc_t blendSrcFuncRGB;
GrAlphaBlendFnc_t blendDstFuncRGB;
GrAlphaBlendFnc_t blendSrcFuncAlpha;
GrAlphaBlendFnc_t blendDstFuncAlpha;
/* Depth test */
/* Depth test */
GLboolean depthTestEnabled;
GLboolean depthMask;
GrCmpFnc_t depthTestFunc;
} tfxUnitsState;
GLboolean depthTestEnabled;
GLboolean depthMask;
GrCmpFnc_t depthTestFunc;
}
tfxUnitsState;
@ -360,7 +374,7 @@ typedef struct {
_NEW_MODELVIEW | \
_TNL_NEW_NEED_EYE_COORDS | \
_FX_NEW_RENDERSTATE)
/* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values.
@ -370,20 +384,22 @@ extern GLubyte FX_PixelToG[0x10000];
extern GLubyte FX_PixelToB[0x10000];
typedef void (*fx_tri_func)( GLcontext *, const fxVertex *,
const fxVertex *, const fxVertex * );
typedef void (*fx_line_func)( GLcontext *, const fxVertex *, const fxVertex * );
typedef void (*fx_point_func)( GLcontext *, const fxVertex * );
typedef void (*fx_tri_func) (GLcontext *, const fxVertex *,
const fxVertex *, const fxVertex *);
typedef void (*fx_line_func) (GLcontext *, const fxVertex *,
const fxVertex *);
typedef void (*fx_point_func) (GLcontext *, const fxVertex *);
struct tfxMesaContext {
struct tfxMesaContext
{
GuTexPalette glbPalette;
GLcontext *glCtx; /* the core Mesa context */
GLvisual *glVis; /* describes the color buffer */
GLframebuffer *glBuffer; /* the ancillary buffers */
GLcontext *glCtx; /* the core Mesa context */
GLvisual *glVis; /* describes the color buffer */
GLframebuffer *glBuffer; /* the ancillary buffers */
GLint board; /* the board used for this context */
GLint width, height; /* size of color buffer */
GLint board; /* the board used for this context */
GLint width, height; /* size of color buffer */
GrBuffer_t currentFB;
@ -395,10 +411,10 @@ struct tfxMesaContext {
GrCullMode_t cullMode;
tfxUnitsState unitsState;
tfxUnitsState restoreUnitsState; /* saved during multipass */
tfxUnitsState restoreUnitsState; /* saved during multipass */
GLuint new_state;
GLuint new_state;
/* Texture Memory Manager Data
*/
@ -476,7 +492,7 @@ struct tfxMesaContext {
GLboolean haveGlobalPaletteTexture;
GLint swapInterval;
GLint maxPendingSwapBuffers;
FX_GrContext_t glideContext;
int screen_width;
@ -493,18 +509,18 @@ struct tfxMesaContext {
GLvertexformat vtxfmt;
fxClipVertex current;
fxClipVertex *vert; /* points into verts[] */
void (*fire_on_vertex)( GLcontext * );
void (*fire_on_end)( GLcontext * );
void (*fire_on_fallback)( GLcontext * );
void (*fire_on_vertex) (GLcontext *);
void (*fire_on_end) (GLcontext *);
void (*fire_on_fallback) (GLcontext *);
vfmt_project_func project_vertex;
vfmt_interpolate_func interpolate_vertices;
int vtxfmt_fallback_count;
int vtxfmt_installed;
void (*old_begin)( GLenum );
void (*old_begin) (GLenum);
GLenum prim;
GLuint accel_light;
GLfloat basecolor[4];
@ -516,7 +532,7 @@ struct tfxMesaContext {
GLuint size;
};
typedef void (*tfxSetupFunc)(GLcontext *ctx, GLuint, GLuint );
typedef void (*tfxSetupFunc) (GLcontext * ctx, GLuint, GLuint);
extern GrHwConfiguration glbHWConfig;
extern int glbCurrentBoard;
@ -527,40 +543,41 @@ extern void fxSetupDDPointers(GLcontext *);
/* fxvsetup:
*/
extern void fxDDSetupInit(void);
extern void fxAllocVB( GLcontext *ctx );
extern void fxFreeVB( GLcontext *ctx );
extern void fxPrintSetupFlags( const char *msg, GLuint flags );
extern void fx_BuildProjVerts( GLcontext *ctx,
GLuint start, GLuint count,
GLuint newinputs );
extern void fx_validate_BuildProjVerts(GLcontext *ctx,
extern void fxAllocVB(GLcontext * ctx);
extern void fxFreeVB(GLcontext * ctx);
extern void fxPrintSetupFlags(const char *msg, GLuint flags);
extern void fx_BuildProjVerts(GLcontext * ctx,
GLuint start, GLuint count, GLuint newinputs);
extern void fx_validate_BuildProjVerts(GLcontext * ctx,
GLuint start, GLuint count,
GLuint newinputs );
GLuint newinputs);
/* fxtrifuncs:
*/
extern void fxDDTrifuncInit(void);
extern void fxDDChooseRenderState( GLcontext *ctx );
extern void fxDDChooseRenderState(GLcontext * ctx);
extern void fxUpdateDDSpanPointers(GLcontext *);
extern void fxSetupDDSpanPointers(GLcontext *);
extern void fxPrintTextureData(tfxTexInfo *ti);
extern void fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat, GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void fxPrintTextureData(tfxTexInfo * ti);
extern void fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
GLint internalFormat, GLint width, GLint height,
GLint border, GLenum format, GLenum type,
const GLvoid * pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid * pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *);
extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *,
GLenum, const GLfloat *);
@ -575,7 +592,7 @@ extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum);
extern void fxDDDepthMask(GLcontext *, GLboolean);
extern void fxDDDepthFunc(GLcontext *, GLenum);
extern void fxDDInitExtensions( GLcontext *ctx );
extern void fxDDInitExtensions(GLcontext * ctx);
extern void fxTMInit(fxMesaContext ctx);
extern void fxTMClose(fxMesaContext ctx);
@ -584,64 +601,64 @@ extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
#define fxTMMoveOutTM_NoLock fxTMMoveOutTM
extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *, GLint);
extern void fxTMReloadSubMipMapLevel(fxMesaContext, struct gl_texture_object *,
GLint, GLint, GLint);
extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *,
GLint);
extern void fxTMReloadSubMipMapLevel(fxMesaContext,
struct gl_texture_object *, GLint, GLint,
GLint);
extern void fxTexGetFormat(GLenum, GrTextureFormat_t *, GLint *);
extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
float *, float *, int *, int *, int *, int *);
extern void fxDDScissor( GLcontext *ctx,
GLint x, GLint y, GLsizei w, GLsizei h );
extern void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params );
extern void fxDDColorMask(GLcontext *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a );
extern void fxDDScissor(GLcontext * ctx,
GLint x, GLint y, GLsizei w, GLsizei h);
extern void fxDDFogfv(GLcontext * ctx, GLenum pname, const GLfloat * params);
extern void fxDDColorMask(GLcontext * ctx,
GLboolean r, GLboolean g, GLboolean b, GLboolean a);
extern void fxDDWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLdepth depth[], const GLubyte mask[]);
extern void fxDDWriteDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
const GLdepth depth[], const GLubyte mask[]);
extern void fxDDReadDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
GLdepth depth[]);
extern void fxDDReadDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
GLdepth depth[]);
extern void fxDDWriteDepthPixels(GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLdepth depth[], const GLubyte mask[]);
extern void fxDDWriteDepthPixels(GLcontext * ctx, GLuint n,
const GLint x[], const GLint y[],
const GLdepth depth[], const GLubyte mask[]);
extern void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
GLdepth depth[]);
extern void fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
const GLint x[], const GLint y[],
GLdepth depth[]);
extern void fxDDShadeModel(GLcontext *ctx, GLenum mode);
extern void fxDDShadeModel(GLcontext * ctx, GLenum mode);
extern void fxDDCullFace(GLcontext *ctx, GLenum mode);
extern void fxDDFrontFace(GLcontext *ctx, GLenum mode);
extern void fxDDCullFace(GLcontext * ctx, GLenum mode);
extern void fxDDFrontFace(GLcontext * ctx, GLenum mode);
extern void fxPrintRenderState( const char *msg, GLuint state );
extern void fxPrintHintState( const char *msg, GLuint state );
extern void fxPrintRenderState(const char *msg, GLuint state);
extern void fxPrintHintState(const char *msg, GLuint state);
extern int fxDDInitFxMesaContext( fxMesaContext fxMesa );
extern void fxDDDestroyFxMesaContext( fxMesaContext fxMesa );
extern int fxDDInitFxMesaContext(fxMesaContext fxMesa);
extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa);
extern void fxSetScissorValues(GLcontext *ctx);
extern void fxSetScissorValues(GLcontext * ctx);
extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
struct gl_texture_object *tObj,
GLint where);
struct gl_texture_object *tObj, GLint where);
extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
/* fxvtxfmt:
*/
extern void fxDDCheckVtxfmt( GLcontext *ctx );
extern void fx_update_lighting( GLcontext *ctx );
extern void fxDDInitVtxfmt( GLcontext *ctx );
extern void fxDDCheckVtxfmt(GLcontext * ctx);
extern void fx_update_lighting(GLcontext * ctx);
extern void fxDDInitVtxfmt(GLcontext * ctx);
/* fxsimplerender
*/
extern const struct gl_pipeline_stage fx_render_stage;
extern const struct gl_pipeline_stage fx_render_stage;
#endif

View file

@ -41,7 +41,7 @@
* See fxapi.h for more revision/author details.
*/
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -54,280 +54,319 @@
#include <stdlib.h>
#include <string.h>
FxI32 FX_grGetInteger_NoLock(FxU32 pname)
FxI32
FX_grGetInteger_NoLock(FxU32 pname)
{
#if !defined(FX_GLIDE3)
switch (pname)
{
case FX_FOG_TABLE_ENTRIES:
return GR_FOG_TABLE_SIZE;
case FX_GLIDE_STATE_SIZE:
return sizeof(GrState);
case FX_LFB_PIXEL_PIPE:
return FXFALSE;
case FX_PENDING_BUFFERSWAPS:
return grBufferNumPending();
case FX_TEXTURE_ALIGN:
/* This is a guess from reading the glide3 docs */
return 8;
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
}
return -1;
}
switch (pname) {
case FX_FOG_TABLE_ENTRIES:
return GR_FOG_TABLE_SIZE;
case FX_GLIDE_STATE_SIZE:
return sizeof(GrState);
case FX_LFB_PIXEL_PIPE:
return FXFALSE;
case FX_PENDING_BUFFERSWAPS:
return grBufferNumPending();
case FX_TEXTURE_ALIGN:
/* This is a guess from reading the glide3 docs */
return 8;
default:
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n");
}
return -1;
}
#else
FxU32 grname;
FxI32 result;
switch (pname)
{
case FX_FOG_TABLE_ENTRIES:
case FX_GLIDE_STATE_SIZE:
case FX_LFB_PIXEL_PIPE:
case FX_PENDING_BUFFERSWAPS:
case FX_TEXTURE_ALIGN:
grname = pname;
break;
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
}
return -1;
}
FxU32 grname;
FxI32 result;
grGet(grname,4,&result);
return result;
switch (pname) {
case FX_FOG_TABLE_ENTRIES:
case FX_GLIDE_STATE_SIZE:
case FX_LFB_PIXEL_PIPE:
case FX_PENDING_BUFFERSWAPS:
case FX_TEXTURE_ALIGN:
grname = pname;
break;
default:
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n");
}
return -1;
}
grGet(grname, 4, &result);
return result;
#endif
}
FxI32 FX_grGetInteger(FxU32 pname)
FxI32
FX_grGetInteger(FxU32 pname)
{
int result;
int result;
BEGIN_BOARD_LOCK();
result=FX_grGetInteger_NoLock(pname);
END_BOARD_LOCK();
return result;
BEGIN_BOARD_LOCK();
result = FX_grGetInteger_NoLock(pname);
END_BOARD_LOCK();
return result;
}
FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
FxBool pixelPipeline, GrLfbInfo_t *info ) {
FxBool result;
FxBool
FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
FxBool pixelPipeline, GrLfbInfo_t * info)
{
FxBool result;
BEGIN_BOARD_LOCK();
result=grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
END_BOARD_LOCK();
return result;
BEGIN_BOARD_LOCK();
result = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
END_BOARD_LOCK();
return result;
}
FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info) {
FxU32 result;
FxU32
FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo * info)
{
FxU32 result;
BEGIN_BOARD_LOCK();
result=grTexTextureMemRequired(evenOdd, info);
END_BOARD_LOCK();
return result;
BEGIN_BOARD_LOCK();
result = grTexTextureMemRequired(evenOdd, info);
END_BOARD_LOCK();
return result;
}
FxU32 FX_grTexMinAddress(GrChipID_t tmu) {
FxU32 result;
FxU32
FX_grTexMinAddress(GrChipID_t tmu)
{
FxU32 result;
BEGIN_BOARD_LOCK();
result=grTexMinAddress(tmu);
END_BOARD_LOCK();
return result;
BEGIN_BOARD_LOCK();
result = grTexMinAddress(tmu);
END_BOARD_LOCK();
return result;
}
extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) {
FxU32 result;
extern FxU32
FX_grTexMaxAddress(GrChipID_t tmu)
{
FxU32 result;
BEGIN_BOARD_LOCK();
result=grTexMaxAddress(tmu);
END_BOARD_LOCK();
return result;
BEGIN_BOARD_LOCK();
result = grTexMaxAddress(tmu);
END_BOARD_LOCK();
return result;
}
FxBool FX_grSstControl(FxU32 code)
FxBool
FX_grSstControl(FxU32 code)
{
#if defined(FX_GLIDE3)
/* The glide 3 sources call for grEnable/grDisable to be called in exchange
* for grSstControl. */
switch(code) {
case GR_CONTROL_ACTIVATE:
/* The glide 3 sources call for grEnable/grDisable to be called in exchange
* for grSstControl. */
switch (code) {
case GR_CONTROL_ACTIVATE:
grEnable(GR_PASSTHRU);
break;
case GR_CONTROL_DEACTIVATE:
case GR_CONTROL_DEACTIVATE:
grDisable(GR_PASSTHRU);
break;
}
/* Appearently GR_CONTROL_RESIZE can be ignored. */
return 1; /* OK? */
}
/* Appearently GR_CONTROL_RESIZE can be ignored. */
return 1; /* OK? */
#else
FxU32 result;
BEGIN_BOARD_LOCK();
result = grSstControl(code);
END_BOARD_LOCK();
return result;
FxU32 result;
BEGIN_BOARD_LOCK();
result = grSstControl(code);
END_BOARD_LOCK();
return result;
#endif
}
#if defined(FX_GLIDE3)
void FX_grGammaCorrectionValue(float val)
void
FX_grGammaCorrectionValue(float val)
{
(void)val;
(void) val;
/* ToDo */
}
int FX_getFogTableSize(void)
int
FX_getFogTableSize(void)
{
int result;
BEGIN_BOARD_LOCK();
grGet(GR_FOG_TABLE_ENTRIES,sizeof(int),(void*)&result);
grGet(GR_FOG_TABLE_ENTRIES, sizeof(int), (void *) &result);
END_BOARD_LOCK();
return result;
return result;
}
int FX_getGrStateSize(void)
int
FX_getGrStateSize(void)
{
int result;
BEGIN_BOARD_LOCK();
grGet(GR_GLIDE_STATE_SIZE,sizeof(int),(void*)&result);
grGet(GR_GLIDE_STATE_SIZE, sizeof(int), (void *) &result);
END_BOARD_LOCK();
return result;
}
int FX_grSstScreenWidth()
int
FX_grSstScreenWidth()
{
FxI32 result[4];
BEGIN_BOARD_LOCK();
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
grGet(GR_VIEWPORT, sizeof(FxI32) * 4, result);
END_BOARD_LOCK();
return result[2];
}
int FX_grSstScreenHeight()
int
FX_grSstScreenHeight()
{
FxI32 result[4];
BEGIN_BOARD_LOCK();
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
grGet(GR_VIEWPORT, sizeof(FxI32) * 4, result);
END_BOARD_LOCK();
return result[3];
}
void FX_grGlideGetVersion(char *buf)
void
FX_grGlideGetVersion(char *buf)
{
BEGIN_BOARD_LOCK();
strcpy(buf,grGetString(GR_VERSION));
END_BOARD_LOCK();
BEGIN_BOARD_LOCK();
strcpy(buf, grGetString(GR_VERSION));
END_BOARD_LOCK();
}
void FX_grSstPerfStats(GrSstPerfStats_t *st)
void
FX_grSstPerfStats(GrSstPerfStats_t * st)
{
FxI32 n;
grGet(GR_STATS_PIXELS_IN, 4, &n); st->pixelsIn = n;
grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n); st->chromaFail = n;
grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n); st->zFuncFail = n;
grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n); st->aFuncFail = n;
grGet(GR_STATS_PIXELS_OUT, 4, &n); st->pixelsOut = n;
FxI32 n;
grGet(GR_STATS_PIXELS_IN, 4, &n);
st->pixelsIn = n;
grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n);
st->chromaFail = n;
grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n);
st->zFuncFail = n;
grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n);
st->aFuncFail = n;
grGet(GR_STATS_PIXELS_OUT, 4, &n);
st->pixelsOut = n;
}
void FX_grAADrawLine(GrVertex *a,GrVertex *b)
void
FX_grAADrawLine(GrVertex * a, GrVertex * b)
{
/* ToDo */
BEGIN_CLIP_LOOP();
grDrawLine(a,b);
grDrawLine(a, b);
END_CLIP_LOOP();
}
void FX_grAADrawPoint(GrVertex *a)
void
FX_grAADrawPoint(GrVertex * a)
{
BEGIN_CLIP_LOOP();
grDrawPoint(a);
END_CLIP_LOOP();
BEGIN_CLIP_LOOP();
grDrawPoint(a);
END_CLIP_LOOP();
}
void FX_grDrawPolygonVertexList(int n, GrVertex *verts)
void
FX_grDrawPolygonVertexList(int n, GrVertex * verts)
{
BEGIN_CLIP_LOOP();
grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex));
END_CLIP_LOOP();
BEGIN_CLIP_LOOP();
grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex));
END_CLIP_LOOP();
}
void FX_setupGrVertexLayout(void)
void
FX_setupGrVertexLayout(void)
{
BEGIN_BOARD_LOCK();
grReset(GR_VERTEX_PARAMETER);
grCoordinateSpace(GR_WINDOW_COORDS);
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
END_BOARD_LOCK();
BEGIN_BOARD_LOCK();
grReset(GR_VERTEX_PARAMETER);
grCoordinateSpace(GR_WINDOW_COORDS);
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2,
GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
GR_PARAM_DISABLE);
END_BOARD_LOCK();
}
void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
void
FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
{
switch(hintType) {
case GR_HINT_STWHINT:
{
if (hintMask & GR_STWHINT_W_DIFF_TMU0)
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_W_DIFF_TMU1)
grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
}
}
switch (hintType) {
case GR_HINT_STWHINT:
{
if (hintMask & GR_STWHINT_W_DIFF_TMU0)
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_W_DIFF_TMU1)
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
GR_PARAM_ENABLE);
else
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
GR_PARAM_DISABLE);
}
}
}
void FX_grHints(GrHint_t hintType, FxU32 hintMask) {
BEGIN_BOARD_LOCK();
FX_grHints_NoLock(hintType, hintMask);
END_BOARD_LOCK();
void
FX_grHints(GrHint_t hintType, FxU32 hintMask)
{
BEGIN_BOARD_LOCK();
FX_grHints_NoLock(hintType, hintMask);
END_BOARD_LOCK();
}
/*
* Glide3 doesn't have the grSstQueryHardware function anymore.
* Instead, we call grGet() and fill in the data structures ourselves.
*/
int FX_grSstQueryHardware(GrHwConfiguration *config)
int
FX_grSstQueryHardware(GrHwConfiguration * config)
{
int i, j;
int numFB;
BEGIN_BOARD_LOCK();
grGet(GR_NUM_BOARDS, 4, (void*)&(config->num_sst));
grGet(GR_NUM_BOARDS, 4, (void *) &(config->num_sst));
if (config->num_sst == 0)
return 0;
for (i = 0; i< config->num_sst; i++) {
for (i = 0; i < config->num_sst; i++) {
FxI32 result;
config->SSTs[i].type = GR_SSTTYPE_VOODOO;
@ -335,24 +374,25 @@ int FX_grSstQueryHardware(GrHwConfiguration *config)
grGet(GR_MEMORY_FB, 4, &result);
config->SSTs[i].sstBoard.VoodooConfig.fbRam = result / (1024 * 1024);
grGet(GR_NUM_TMU, 4, &result);
config->SSTs[i].sstBoard.VoodooConfig.nTexelfx = result;
grGet(GR_REVISION_FB, 4, &result);
config->SSTs[i].sstBoard.VoodooConfig.fbiRev = result;
grGet(GR_NUM_FB,4,(void*)&numFB);
grGet(GR_NUM_FB, 4, (void *) &numFB);
if (numFB > 1)
config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXTRUE;
config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXTRUE;
else
config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXFALSE;
config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXFALSE;
for (j = 0; j < config->SSTs[i].sstBoard.VoodooConfig.nTexelfx; j++) {
grGet(GR_MEMORY_TMU, 4, &result);
config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam = result / (1024*1024);
grGet(GR_REVISION_TMU, 4, &result);
config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRev = result;
grGet(GR_MEMORY_TMU, 4, &result);
config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam =
result / (1024 * 1024);
grGet(GR_REVISION_TMU, 4, &result);
config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRev = result;
}
}
END_BOARD_LOCK();
@ -361,7 +401,8 @@ int FX_grSstQueryHardware(GrHwConfiguration *config)
#else
int FX_grSstScreenWidth()
int
FX_grSstScreenWidth()
{
int i;
BEGIN_BOARD_LOCK();
@ -370,7 +411,8 @@ int FX_grSstScreenWidth()
return i;
}
int FX_grSstScreenHeight()
int
FX_grSstScreenHeight()
{
int i;
BEGIN_BOARD_LOCK();
@ -379,51 +421,49 @@ int FX_grSstScreenHeight()
return i;
}
int FX_grSstQueryHardware(GrHwConfiguration *c)
int
FX_grSstQueryHardware(GrHwConfiguration * c)
{
int i;
BEGIN_BOARD_LOCK();
i = grSstQueryHardware(c);
END_BOARD_LOCK();
return i;
}
}
#endif /* FX_GLIDE3 */
#endif /* FX_GLIDE3 */
/* It appears to me that this function is needed either way. */
FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers,
int nAuxBuffers)
FX_GrContext_t
FX_grSstWinOpen(FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers, int nAuxBuffers)
{
FX_GrContext_t i;
BEGIN_BOARD_LOCK();
i = grSstWinOpen( hWnd,
screen_resolution,
refresh_rate,
color_format,
origin_location,
nColBuffers,
nAuxBuffers );
i = grSstWinOpen(hWnd,
screen_resolution,
refresh_rate,
color_format, origin_location, nColBuffers, nAuxBuffers);
/*
fprintf(stderr,
"grSstWinOpen( win %d res %d ref %d fmt %d\n"
" org %d ncol %d naux %d )\n"
" ==> %d\n",
hWnd,
screen_resolution,
refresh_rate,
color_format,
origin_location,
nColBuffers,
nAuxBuffers,
i);
*/
fprintf(stderr,
"grSstWinOpen( win %d res %d ref %d fmt %d\n"
" org %d ncol %d naux %d )\n"
" ==> %d\n",
hWnd,
screen_resolution,
refresh_rate,
color_format,
origin_location,
nColBuffers,
nAuxBuffers,
i);
*/
END_BOARD_LOCK();
return i;
}
@ -437,9 +477,10 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
*/
extern int gl_fx_dummy_function_glidew(void);
int gl_fx_dummy_function_glidew(void)
int
gl_fx_dummy_function_glidew(void)
{
return 0;
return 0;
}
#endif /* FX */

View file

@ -51,9 +51,9 @@
* General context:
*/
#if !defined(FX_GLIDE3)
typedef FxU32 FX_GrContext_t; /* Not used in Glide2 */
typedef FxU32 FX_GrContext_t; /* Not used in Glide2 */
#else
typedef GrContext_t FX_GrContext_t;
typedef GrContext_t FX_GrContext_t;
#endif
/*
@ -61,22 +61,22 @@
*/
#if !defined(FX_GLIDE3)
/* Constanst for FX_grGetInteger( ) */
#define FX_FOG_TABLE_ENTRIES 0x0004 /* The number of entries in the hardware fog table. */
#define FX_GLIDE_STATE_SIZE 0x0006 /* Size of buffer, in bytes, needed to save Glide state. */
#define FX_LFB_PIXEL_PIPE 0x0009 /* 1 if LFB writes can go through the 3D pixel pipe. */
#define FX_PENDING_BUFFERSWAPS 0x0014 /* The number of buffer swaps pending. */
#define FX_TEXTURE_ALIGN 0x0024 /* The required alignment for textures */
#define FX_FOG_TABLE_ENTRIES 0x0004 /* The number of entries in the hardware fog table. */
#define FX_GLIDE_STATE_SIZE 0x0006 /* Size of buffer, in bytes, needed to save Glide state. */
#define FX_LFB_PIXEL_PIPE 0x0009 /* 1 if LFB writes can go through the 3D pixel pipe. */
#define FX_PENDING_BUFFERSWAPS 0x0014 /* The number of buffer swaps pending. */
#define FX_TEXTURE_ALIGN 0x0024 /* The required alignment for textures */
#else
#define FX_FOG_TABLE_ENTRIES GR_FOG_TABLE_ENTRIES
#define FX_GLIDE_STATE_SIZE GR_GLIDE_STATE_SIZE
#define FX_LFB_PIXEL_PIPE GR_LFB_PIXEL_PIPE
#define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS
#define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN
#define FX_FOG_TABLE_ENTRIES GR_FOG_TABLE_ENTRIES
#define FX_GLIDE_STATE_SIZE GR_GLIDE_STATE_SIZE
#define FX_LFB_PIXEL_PIPE GR_LFB_PIXEL_PIPE
#define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS
#define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN
#endif
/*
* Genral warper functions for Glide2/Glide3:
*/
*/
extern FxI32 FX_grGetInteger(FxU32 pname);
extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
@ -96,7 +96,7 @@ extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
#define GR_LOD_256 GR_LOD_LOG2_256
#define GR_LOD_128 GR_LOD_LOG2_128
#define GR_LOD_64 GR_LOD_LOG2_64
#define GR_LOD_32 GR_LOD_LOG2_32
#define GR_LOD_32 GR_LOD_LOG2_32
#define GR_LOD_16 GR_LOD_LOG2_16
#define GR_LOD_8 GR_LOD_LOG2_8
#define GR_LOD_4 GR_LOD_LOG2_4
@ -114,43 +114,57 @@ typedef int GrSstType;
#define GR_SSTTYPE_AT3D 2
#define GR_SSTTYPE_Voodoo2 3
typedef struct GrTMUConfig_St {
int tmuRev; /* Rev of Texelfx chip */
int tmuRam; /* 1, 2, or 4 MB */
} GrTMUConfig_t;
typedef struct GrTMUConfig_St
{
int tmuRev; /* Rev of Texelfx chip */
int tmuRam; /* 1, 2, or 4 MB */
}
GrTMUConfig_t;
typedef struct GrVoodooConfig_St {
int fbRam; /* 1, 2, or 4 MB */
int fbiRev; /* Rev of Pixelfx chip */
int nTexelfx; /* How many texelFX chips are there? */
FxBool sliDetect; /* Is it a scan-line interleaved board? */
GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
} GrVoodooConfig_t;
typedef struct GrVoodooConfig_St
{
int fbRam; /* 1, 2, or 4 MB */
int fbiRev; /* Rev of Pixelfx chip */
int nTexelfx; /* How many texelFX chips are there? */
FxBool sliDetect; /* Is it a scan-line interleaved board? */
GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
}
GrVoodooConfig_t;
typedef struct GrSst96Config_St {
int fbRam; /* How much? */
int nTexelfx;
GrTMUConfig_t tmuConfig;
} GrSst96Config_t;
typedef struct GrSst96Config_St
{
int fbRam; /* How much? */
int nTexelfx;
GrTMUConfig_t tmuConfig;
}
GrSst96Config_t;
typedef GrVoodooConfig_t GrVoodoo2Config_t;
typedef struct GrAT3DConfig_St {
int rev;
} GrAT3DConfig_t;
typedef struct GrAT3DConfig_St
{
int rev;
}
GrAT3DConfig_t;
typedef struct {
int num_sst; /* # of HW units in the system */
struct {
GrSstType type; /* Which hardware is it? */
union SstBoard_u {
GrVoodooConfig_t VoodooConfig;
GrSst96Config_t SST96Config;
GrAT3DConfig_t AT3DConfig;
GrVoodoo2Config_t Voodoo2Config;
} sstBoard;
} SSTs[MAX_NUM_SST]; /* configuration for each board */
} GrHwConfiguration;
typedef struct
{
int num_sst; /* # of HW units in the system */
struct
{
GrSstType type; /* Which hardware is it? */
union SstBoard_u
{
GrVoodooConfig_t VoodooConfig;
GrSst96Config_t SST96Config;
GrAT3DConfig_t AT3DConfig;
GrVoodoo2Config_t Voodoo2Config;
}
sstBoard;
}
SSTs[MAX_NUM_SST]; /* configuration for each board */
}
GrHwConfiguration;
typedef FxU32 GrHint_t;
#define GR_HINTTYPE_MIN 0
@ -173,22 +187,25 @@ typedef FxU32 GrSTWHint_t;
/*
** move the vertex layout defintion to application
*/
typedef struct {
float sow; /* s texture ordinate (s over w) */
float tow; /* t texture ordinate (t over w) */
float oow; /* 1/w (used mipmapping - really 0xfff/w) */
} GrTmuVertex;
typedef struct
{
float sow; /* s texture ordinate (s over w) */
float tow; /* t texture ordinate (t over w) */
float oow; /* 1/w (used mipmapping - really 0xfff/w) */
}
GrTmuVertex;
typedef struct
{
float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
float r, g, b; /* R, G, B, ([0..255.0]) */
float ooz; /* 65535/Z (used for Z-buffering) */
float a; /* Alpha [0..255.0] */
float oow; /* 1/W (used for W-buffering, texturing) */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
} GrVertex;
float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
float r, g, b; /* R, G, B, ([0..255.0]) */
float ooz; /* 65535/Z (used for Z-buffering) */
float a; /* Alpha [0..255.0] */
float oow; /* 1/W (used for W-buffering, texturing) */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
}
GrVertex;
#define GR_VERTEX_X_OFFSET 0
#define GR_VERTEX_Y_OFFSET 1
@ -248,7 +265,7 @@ typedef struct
grSstIdle(); \
END_BOARD_LOCK(); \
} while (0)
#endif
#endif
#define FX_grFinish() \
do { \
@ -300,54 +317,54 @@ typedef struct
* For Lod/LodLog2 conversion.
*/
#if defined(FX_GLIDE3)
#define FX_largeLodLog2(info) (info).largeLodLog2
#define FX_largeLodLog2(info) (info).largeLodLog2
#else
#define FX_largeLodLog2(info) (info).largeLod
#define FX_largeLodLog2(info) (info).largeLod
#endif
#if defined(FX_GLIDE3)
#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
#else
#define FX_aspectRatioLog2(info) (info).aspectRatio
#define FX_aspectRatioLog2(info) (info).aspectRatio
#endif
#if defined(FX_GLIDE3)
#define FX_smallLodLog2(info) (info).smallLodLog2
#define FX_smallLodLog2(info) (info).smallLodLog2
#else
#define FX_smallLodLog2(info) (info).smallLod
#define FX_smallLodLog2(info) (info).smallLod
#endif
#if defined(FX_GLIDE3)
#define FX_lodToValue(val) ((int)(GR_LOD_256-val))
#define FX_lodToValue(val) ((int)(GR_LOD_256-val))
#else
#define FX_lodToValue(val) ((int)(val))
#define FX_lodToValue(val) ((int)(val))
#endif
#if defined(FX_GLIDE3)
#define FX_largeLodValue(info) ((int)(GR_LOD_256-(info).largeLodLog2))
#define FX_largeLodValue(info) ((int)(GR_LOD_256-(info).largeLodLog2))
#else
#define FX_largeLodValue(info) ((int)(info).largeLod)
#define FX_largeLodValue(info) ((int)(info).largeLod)
#endif
#define FX_largeLodValue_NoLock FX_largeLodValue
#if defined(FX_GLIDE3)
#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
#else
#define FX_smallLodValue(info) ((int)(info).smallLod)
#define FX_smallLodValue(info) ((int)(info).smallLod)
#endif
#define FX_smallLodValue_NoLock FX_smallLodValue
#if defined(FX_GLIDE3)
#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
#else
#define FX_valueToLod(val) ((GrLOD_t)(val))
#define FX_valueToLod(val) ((GrLOD_t)(val))
#endif
/*
* ScreenWidth/Height stuff.
*/
extern int FX_grSstScreenWidth(void);
extern int FX_grSstScreenHeight(void);
extern int FX_grSstScreenWidth(void);
extern int FX_grSstScreenHeight(void);
@ -355,9 +372,9 @@ typedef struct
* Version string.
*/
#if defined(FX_GLIDE3)
extern void FX_grGlideGetVersion(char *buf);
extern void FX_grGlideGetVersion(char *buf);
#else
#define FX_grGlideGetVersion(b) \
#define FX_grGlideGetVersion(b) \
do { \
BEGIN_BOARD_LOCK(); \
grGlideGetVersion(b); \
@ -368,9 +385,9 @@ typedef struct
* Performance statistics
*/
#if defined(FX_GLIDE3)
extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
extern void FX_grSstPerfStats(GrSstPerfStats_t * st);
#else
#define FX_grSstPerfStats(s) \
#define FX_grSstPerfStats(s) \
do { \
BEGIN_BOARD_LOCK(); \
grSstPerfStats(s); \
@ -381,30 +398,30 @@ typedef struct
/*
* Hardware Query
*/
extern int FX_grSstQueryHardware(GrHwConfiguration *config);
extern int FX_grSstQueryHardware(GrHwConfiguration * config);
/*
* GrHints
*/
#if defined(FX_GLIDE3)
extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
extern void FX_grHints(GrHint_t hintType, FxU32 hintMask);
extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
extern void FX_grHints(GrHint_t hintType, FxU32 hintMask);
#else
#define FX_grHints(t,m) \
#define FX_grHints(t,m) \
do { \
BEGIN_BOARD_LOCK(); \
grHints(t, m); \
END_BOARD_LOCK(); \
} while(0)
#define FX_grHints_NoLock grHints
#define FX_grHints_NoLock grHints
#endif
/*
* Antialiashed line+point drawing.
*/
#if defined(FX_GLIDE3)
extern void FX_grAADrawLine(GrVertex *a,GrVertex *b);
extern void FX_grAADrawLine(GrVertex * a, GrVertex * b);
#else
#define FX_grAADrawLine(a,b) \
#define FX_grAADrawLine(a,b) \
do { \
BEGIN_CLIP_LOOP(); \
grAADrawLine(a,b); \
@ -413,9 +430,9 @@ typedef struct
#endif
#if defined(FX_GLIDE3)
extern void FX_grAADrawPoint(GrVertex *a);
extern void FX_grAADrawPoint(GrVertex * a);
#else
#define FX_grAADrawPoint(a) \
#define FX_grAADrawPoint(a) \
do { \
BEGIN_CLIP_LOOP(); \
grAADrawPoint(a); \
@ -427,9 +444,9 @@ typedef struct
* Needed for Glide3 only, to set up Glide2 compatible vertex layout.
*/
#if defined(FX_GLIDE3)
extern void FX_setupGrVertexLayout(void);
extern void FX_setupGrVertexLayout(void);
#else
#define FX_setupGrVertexLayout() do {} while (0)
#define FX_setupGrVertexLayout() do {} while (0)
#endif
/*
* grSstControl stuff
@ -440,9 +457,9 @@ extern FxBool FX_grSstControl(FxU32 code);
* grGammaCorrectionValue
*/
#if defined(FX_GLIDE3)
extern void FX_grGammaCorrectionValue(float val);
extern void FX_grGammaCorrectionValue(float val);
#else
#define FX_grGammaCorrectionValue(v) \
#define FX_grGammaCorrectionValue(v) \
do { \
BEGIN_BOARD_LOCK(); \
grGammaCorrectionValue(v) \
@ -467,13 +484,12 @@ extern FxBool FX_grSstControl(FxU32 code);
#endif
extern FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers,
int nAuxBuffers);
extern FX_GrContext_t FX_grSstWinOpen(FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers, int nAuxBuffers);
#define FX_grDrawLine(v1, v2) \
@ -491,7 +507,7 @@ extern FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
} while (0)
#if defined(FX_GLIDE3)
extern void FX_grDrawPolygonVertexList(int n, GrVertex *v);
extern void FX_grDrawPolygonVertexList(int n, GrVertex * v);
#else
#define FX_grDrawPolygonVertexList(n, v) \
do { \
@ -536,10 +552,10 @@ extern void FX_grDrawPolygonVertexList(int n, GrVertex *v);
END_BOARD_LOCK(); \
} while (0)
extern FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode,
GrOriginLocation_t origin, FxBool pixelPipeline,
GrLfbInfo_t *info );
extern FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode,
GrOriginLocation_t origin, FxBool pixelPipeline,
GrLfbInfo_t * info);
#define FX_grLfbUnlock(t, b) \
do { \
@ -718,7 +734,7 @@ extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu);
#define FX_grTexSource_NoLock grTexSource
extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info);
extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo * info);
#define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired
#define FX_grGlideGetState(s) \
@ -797,4 +813,3 @@ extern int FX_getFogTableSize(void);
extern int FX_getGrStateSize(void);
#endif /* __FX_GLIDE_WARPER__ */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -23,17 +23,15 @@
static void
fx_draw_point( GLcontext *ctx, const fxVertex *v )
static void
fx_draw_point(GLcontext * ctx, const fxVertex * v)
{
GLfloat sz = ctx->Point._Size;
if ( sz <= 1.0 )
{
grDrawPoint( &(v->v) );
if (sz <= 1.0) {
grDrawPoint(&(v->v));
}
else
{
else {
GrVertex verts[4];
sz *= .5;
@ -48,30 +46,28 @@ fx_draw_point( GLcontext *ctx, const fxVertex *v )
verts[1].x = v->v.x + sz;
verts[1].y = v->v.y - sz;
verts[2].x = v->v.x + sz;
verts[2].y = v->v.y + sz;
verts[3].x = v->v.x - sz;
verts[3].y = v->v.y + sz;
grDrawTriangle( &verts[0], &verts[1], &verts[3] );
grDrawTriangle( &verts[1], &verts[2], &verts[3] );
grDrawTriangle(&verts[0], &verts[1], &verts[3]);
grDrawTriangle(&verts[1], &verts[2], &verts[3]);
}
}
static void
fx_draw_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 )
static void
fx_draw_line(GLcontext * ctx, const fxVertex * v0, const fxVertex * v1)
{
float width = ctx->Line.Width;
if ( width <= 1.0 )
{
grDrawLine( &(v0->v), &(v1->v) );
if (width <= 1.0) {
grDrawLine(&(v0->v), &(v1->v));
}
else
{
else {
GrVertex verts[4];
float dx, dy, ix, iy;
@ -81,7 +77,8 @@ fx_draw_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 )
if (dx * dx > dy * dy) {
iy = width * .5;
ix = 0;
} else {
}
else {
iy = 0;
ix = width * .5;
}
@ -103,16 +100,16 @@ fx_draw_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 )
verts[3].x -= ix;
verts[3].y -= iy;
grDrawTriangle( &verts[0], &verts[1], &verts[3] );
grDrawTriangle( &verts[1], &verts[2], &verts[3] );
grDrawTriangle(&verts[0], &verts[1], &verts[3]);
grDrawTriangle(&verts[1], &verts[2], &verts[3]);
}
}
static void
fx_draw_tri( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1,
const fxVertex *v2 )
static void
fx_draw_tri(GLcontext * ctx, const fxVertex * v0, const fxVertex * v1,
const fxVertex * v2)
{
grDrawTriangle( &(v0->v), &(v1->v), &(v2->v) );
grDrawTriangle(&(v0->v), &(v1->v), &(v2->v));
}
@ -141,12 +138,14 @@ fx_draw_tri( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1,
#define FX_FALLBACK_BIT 0x20
#define FX_MAX_TRIFUNC 0x40
static struct {
points_func points;
line_func line;
triangle_func triangle;
quad_func quad;
} rast_tab[FX_MAX_TRIFUNC];
static struct
{
points_func points;
line_func line;
triangle_func triangle;
quad_func quad;
}
rast_tab[FX_MAX_TRIFUNC];
#define IND (0)
@ -282,7 +281,8 @@ static struct {
void fxDDTrifuncInit( void )
void
fxDDTrifuncInit(void)
{
init();
init_flat();
@ -330,13 +330,13 @@ void fxDDTrifuncInit( void )
* primitives are being drawn, and only for the unaccelerated
* primitives.
*/
static void
fx_translate_vertex(GLcontext *ctx, const fxVertex *src, SWvertex *dst)
static void
fx_translate_vertex(GLcontext * ctx, const fxVertex * src, SWvertex * dst)
{
fxMesaContext fxMesa = FX_CONTEXT( ctx );
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint ts0 = fxMesa->tmu_source[0];
GLuint ts1 = fxMesa->tmu_source[1];
GLfloat w = 1.0 / src->v.oow;
GLfloat w = 1.0 / src->v.oow;
dst->win[0] = src->v.x;
dst->win[1] = src->v.y;
@ -359,52 +359,53 @@ fx_translate_vertex(GLcontext *ctx, const fxVertex *src, SWvertex *dst)
dst->texcoord[ts1][0] = fxMesa->inv_s1scale * src->v.tmuvtx[1].sow * w;
dst->texcoord[ts1][1] = fxMesa->inv_t1scale * src->v.tmuvtx[1].tow * w;
if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU1)
if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU1)
dst->texcoord[ts1][3] = src->v.tmuvtx[1].oow * w;
else
dst->texcoord[ts1][3] = 1.0;
}
static void
fx_fallback_tri( GLcontext *ctx,
const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 )
static void
fx_fallback_tri(GLcontext * ctx,
const fxVertex * v0, const fxVertex * v1, const fxVertex * v2)
{
SWvertex v[3];
fx_translate_vertex( ctx, v0, &v[0] );
fx_translate_vertex( ctx, v1, &v[1] );
fx_translate_vertex( ctx, v2, &v[2] );
_swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
fx_translate_vertex(ctx, v0, &v[0]);
fx_translate_vertex(ctx, v1, &v[1]);
fx_translate_vertex(ctx, v2, &v[2]);
_swrast_Triangle(ctx, &v[0], &v[1], &v[2]);
}
static void
fx_fallback_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 )
static void
fx_fallback_line(GLcontext * ctx, const fxVertex * v0, const fxVertex * v1)
{
SWvertex v[2];
fx_translate_vertex( ctx, v0, &v[0] );
fx_translate_vertex( ctx, v1, &v[1] );
_swrast_Line( ctx, &v[0], &v[1] );
fx_translate_vertex(ctx, v0, &v[0]);
fx_translate_vertex(ctx, v1, &v[1]);
_swrast_Line(ctx, &v[0], &v[1]);
}
static void
fx_fallback_point( GLcontext *ctx, const fxVertex *v0 )
static void
fx_fallback_point(GLcontext * ctx, const fxVertex * v0)
{
SWvertex v[1];
fx_translate_vertex( ctx, v0, &v[0] );
_swrast_Point( ctx, &v[0] );
fx_translate_vertex(ctx, v0, &v[0]);
_swrast_Point(ctx, &v[0]);
}
/* System to turn culling off for rasterized lines and points, and
* back on for rasterized triangles.
*/
static void
fx_cull_draw_tri( GLcontext *ctx,
const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 )
static void
fx_cull_draw_tri(GLcontext * ctx,
const fxVertex * v0, const fxVertex * v1,
const fxVertex * v2)
{
fxMesaContext fxMesa = FX_CONTEXT( ctx );
fxMesaContext fxMesa = FX_CONTEXT(ctx);
FX_grCullMode(fxMesa->cullMode);
@ -412,29 +413,29 @@ fx_cull_draw_tri( GLcontext *ctx,
fxMesa->draw_point = fxMesa->initial_point;
fxMesa->draw_tri = fxMesa->subsequent_tri;
fxMesa->draw_tri( ctx, v0, v1, v2 );
fxMesa->draw_tri(ctx, v0, v1, v2);
}
static void
fx_cull_draw_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 )
static void
fx_cull_draw_line(GLcontext * ctx, const fxVertex * v0, const fxVertex * v1)
{
fxMesaContext fxMesa = FX_CONTEXT( ctx );
fxMesaContext fxMesa = FX_CONTEXT(ctx);
FX_grCullMode( GR_CULL_DISABLE );
FX_grCullMode(GR_CULL_DISABLE);
fxMesa->draw_point = fxMesa->initial_point;
fxMesa->draw_tri = fxMesa->initial_tri;
fxMesa->draw_line = fxMesa->subsequent_line;
fxMesa->draw_line( ctx, v0, v1 );
fxMesa->draw_line(ctx, v0, v1);
}
static void
fx_cull_draw_point( GLcontext *ctx, const fxVertex *v0 )
static void
fx_cull_draw_point(GLcontext * ctx, const fxVertex * v0)
{
fxMesaContext fxMesa = FX_CONTEXT( ctx );
fxMesaContext fxMesa = FX_CONTEXT(ctx);
FX_grCullMode(GR_CULL_DISABLE);
@ -442,13 +443,13 @@ fx_cull_draw_point( GLcontext *ctx, const fxVertex *v0 )
fxMesa->draw_tri = fxMesa->initial_tri;
fxMesa->draw_point = fxMesa->subsequent_point;
fxMesa->draw_point( ctx, v0 );
fxMesa->draw_point(ctx, v0);
}
static void
fx_null_tri( GLcontext *ctx,
const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 )
static void
fx_null_tri(GLcontext * ctx,
const fxVertex * v0, const fxVertex * v1, const fxVertex * v2)
{
(void) v0;
(void) v1;
@ -488,8 +489,8 @@ fx_null_tri( GLcontext *ctx,
/* Verts, no clipping.
*/
#define ELT(x) x
#define RESET_STIPPLE
#define RESET_OCCLUSION
#define RESET_STIPPLE
#define RESET_OCCLUSION
#define PRESERVE_VB_DEFS
#include "tnl/t_vb_rendertmp.h"
@ -514,7 +515,7 @@ fx_null_tri( GLcontext *ctx,
#define LINE_FALLBACK (DD_LINE_STIPPLE)
#define TRI_FALLBACK (DD_TRI_SMOOTH | DD_TRI_STIPPLE )
#define ANY_FALLBACK (POINT_FALLBACK | LINE_FALLBACK | TRI_FALLBACK)
#define ANY_RENDER_FLAGS (DD_FLATSHADE | \
DD_TRI_LIGHT_TWOSIDE | \
@ -527,13 +528,14 @@ fx_null_tri( GLcontext *ctx,
* current rendering state. Wherever possible, use the hardware to
* render the primitive. Otherwise, fallback to software rendering.
*/
void fxDDChooseRenderState( GLcontext *ctx )
void
fxDDChooseRenderState(GLcontext * ctx)
{
fxMesaContext fxMesa = FX_CONTEXT( ctx );
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint flags = ctx->_TriangleCaps;
GLuint index = 0;
if ( !fxMesa->is_in_hardware ) {
if (!fxMesa->is_in_hardware) {
/* Build software vertices directly. No acceleration is
* possible. GrVertices may be insufficient for this mode.
*/
@ -548,20 +550,22 @@ void fxDDChooseRenderState( GLcontext *ctx )
return;
}
if ( flags & ANY_RENDER_FLAGS ) {
if ( flags & DD_FLATSHADE ) index |= FX_FLAT_BIT;
if ( flags & DD_TRI_LIGHT_TWOSIDE ) index |= FX_TWOSIDE_BIT;
if ( flags & DD_TRI_OFFSET ) index |= FX_OFFSET_BIT;
if ( flags & DD_TRI_UNFILLED ) index |= FX_UNFILLED_BIT;
if (flags & ANY_RENDER_FLAGS) {
if (flags & DD_FLATSHADE)
index |= FX_FLAT_BIT;
if (flags & DD_TRI_LIGHT_TWOSIDE)
index |= FX_TWOSIDE_BIT;
if (flags & DD_TRI_OFFSET)
index |= FX_OFFSET_BIT;
if (flags & DD_TRI_UNFILLED)
index |= FX_UNFILLED_BIT;
}
if ( flags & (ANY_FALLBACK|
DD_LINE_WIDTH|
DD_POINT_SIZE|
DD_TRI_CULL_FRONT_BACK) ) {
if (flags & (ANY_FALLBACK |
DD_LINE_WIDTH | DD_POINT_SIZE | DD_TRI_CULL_FRONT_BACK)) {
/* Hook in fallbacks for specific primitives.
*
* Set up a system to turn culling on/off for wide points and
* lines. Alternately: figure out what tris to send so that
* culling isn't a problem.
@ -577,19 +581,19 @@ void fxDDChooseRenderState( GLcontext *ctx )
fxMesa->subsequent_line = fx_draw_line;
fxMesa->subsequent_tri = fx_draw_tri;
if ( flags & POINT_FALLBACK )
if (flags & POINT_FALLBACK)
fxMesa->initial_point = fx_fallback_point;
if ( flags & LINE_FALLBACK )
if (flags & LINE_FALLBACK)
fxMesa->initial_line = fx_fallback_line;
if ((flags & DD_LINE_SMOOTH) && ctx->Line.Width != 1.0)
if ((flags & DD_LINE_SMOOTH) && ctx->Line.Width != 1.0)
fxMesa->initial_line = fx_fallback_line;
if ( flags & TRI_FALLBACK )
if (flags & TRI_FALLBACK)
fxMesa->initial_tri = fx_fallback_tri;
if ( flags & DD_TRI_CULL_FRONT_BACK )
if (flags & DD_TRI_CULL_FRONT_BACK)
fxMesa->initial_tri = fx_null_tri;
fxMesa->draw_point = fxMesa->initial_point;
@ -599,7 +603,7 @@ void fxDDChooseRenderState( GLcontext *ctx )
else if (fxMesa->render_index & FX_FALLBACK_BIT) {
FX_grCullMode(fxMesa->cullMode);
}
ctx->Driver.PointsFunc = rast_tab[index].points;
ctx->Driver.LineFunc = rast_tab[index].line;
ctx->Driver.TriangleFunc = rast_tab[index].triangle;
@ -609,7 +613,8 @@ void fxDDChooseRenderState( GLcontext *ctx )
if (fxMesa->render_index == 0) {
ctx->Driver.RenderTabVerts = fx_render_tab_verts;
ctx->Driver.RenderTabElts = fx_render_tab_elts;
} else {
}
else {
ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
}
@ -626,9 +631,10 @@ void fxDDChooseRenderState( GLcontext *ctx )
*/
extern int gl_fx_dummy_function_trifuncs(void);
int gl_fx_dummy_function_trifuncs(void)
int
gl_fx_dummy_function_trifuncs(void)
{
return 0;
return 0;
}
#endif /* FX */
#endif /* FX */

View file

@ -48,23 +48,24 @@
#include "tnl/t_pipeline.h"
void fxPrintSetupFlags( const char *msg, GLuint flags )
void
fxPrintSetupFlags(const char *msg, GLuint flags)
{
fprintf(stderr, "%s: %d %s%s%s%s%s\n",
msg,
flags,
(flags & SETUP_XYZW) ? " xyzw," : "",
(flags & SETUP_SNAP) ? " snap," : "",
(flags & SETUP_RGBA) ? " rgba," : "",
(flags & SETUP_TMU0) ? " tmu0," : "",
(flags & SETUP_TMU1) ? " tmu1," : "");
msg,
flags,
(flags & SETUP_XYZW) ? " xyzw," : "",
(flags & SETUP_SNAP) ? " snap," : "",
(flags & SETUP_RGBA) ? " rgba," : "",
(flags & SETUP_TMU0) ? " tmu0," : "",
(flags & SETUP_TMU1) ? " tmu1," : "");
}
static void project_texcoords( fxVertex *v,
struct vertex_buffer *VB,
GLuint tmu_nr, GLuint tc_nr,
GLuint start, GLuint count )
{
static void
project_texcoords(fxVertex * v,
struct vertex_buffer *VB,
GLuint tmu_nr, GLuint tc_nr, GLuint start, GLuint count)
{
GrTmuVertex *tmu = &(v->v.tmuvtx[tmu_nr]);
GLvector4f *vec = VB->TexCoordPtr[tc_nr];
@ -72,43 +73,42 @@ static void project_texcoords( fxVertex *v,
GLuint stride = vec->stride;
GLfloat *data = VEC_ELT(vec, GLfloat, start);
for (i = start ; i < count ; i++, STRIDE_F(data, stride), v++) {
for (i = start; i < count; i++, STRIDE_F(data, stride), v++) {
tmu->oow = v->v.oow * data[3];
tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex));
}
tmu = (GrTmuVertex *) ((char *) tmu + sizeof(fxVertex));
}
}
static void copy_w( fxVertex *v,
struct vertex_buffer *VB,
GLuint tmu_nr,
GLuint start, GLuint count )
{
static void
copy_w(fxVertex * v,
struct vertex_buffer *VB, GLuint tmu_nr, GLuint start, GLuint count)
{
GrTmuVertex *tmu = &(v->v.tmuvtx[tmu_nr]);
GLuint i;
for (i = start ; i < count ; i++, v++) {
for (i = start; i < count; i++, v++) {
tmu->oow = v->v.oow;
tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex));
}
tmu = (GrTmuVertex *) ((char *) tmu + sizeof(fxVertex));
}
}
/* need to compute W values for fogging purposes
*/
static void fx_fake_fog_w( GLcontext *ctx,
fxVertex *verts,
struct vertex_buffer *VB,
GLuint start, GLuint end )
static void
fx_fake_fog_w(GLcontext * ctx,
fxVertex * verts,
struct vertex_buffer *VB, GLuint start, GLuint end)
{
const GLfloat m10 = ctx->ProjectionMatrix.m[10];
const GLfloat m14 = ctx->ProjectionMatrix.m[14];
GLfloat (*clip)[4] = VB->ClipPtr->data;
GLfloat(*clip)[4] = VB->ClipPtr->data;
GLubyte *clipmask = VB->ClipMask;
GLuint i;
for ( i = start ; i < end ; i++) {
for (i = start; i < end; i++) {
if (clipmask[i] == 0) {
verts[i].v.oow = - m10 / (clip[i][2] - m14); /* -1/zEye */
verts[i].v.oow = -m10 / (clip[i][2] - m14); /* -1/zEye */
}
}
}
@ -238,59 +238,61 @@ static tfxSetupFunc setupfuncs[MAX_SETUP];
static void
fxsetup_invalid( GLcontext *ctx, GLuint start, GLuint end )
fxsetup_invalid(GLcontext * ctx, GLuint start, GLuint end)
{
fprintf(stderr, "fxMesa: invalid setup function\n");
(void) (ctx && start && end);
}
void fxDDSetupInit( void )
void
fxDDSetupInit(void)
{
GLuint i;
for (i = 0 ; i < Elements(setupfuncs) ; i++)
for (i = 0; i < Elements(setupfuncs); i++)
setupfuncs[i] = fxsetup_invalid;
setupfuncs[SETUP_XYZW] = fxsetupXYZW;
setupfuncs[SETUP_XYZW|SETUP_RGBA] = fxsetupXYZWRGBA;
setupfuncs[SETUP_XYZW|SETUP_TMU0] = fxsetupXYZWT0;
setupfuncs[SETUP_XYZW|SETUP_TMU1] = fxsetupXYZWT1;
setupfuncs[SETUP_XYZW|SETUP_TMU0|SETUP_RGBA] = fxsetupXYZWRGBAT0;
setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_RGBA] = fxsetupXYZWRGBAT1;
setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_TMU0] = fxsetupXYZWT0T1;
setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] =
setupfuncs[SETUP_XYZW | SETUP_RGBA] = fxsetupXYZWRGBA;
setupfuncs[SETUP_XYZW | SETUP_TMU0] = fxsetupXYZWT0;
setupfuncs[SETUP_XYZW | SETUP_TMU1] = fxsetupXYZWT1;
setupfuncs[SETUP_XYZW | SETUP_TMU0 | SETUP_RGBA] = fxsetupXYZWRGBAT0;
setupfuncs[SETUP_XYZW | SETUP_TMU1 | SETUP_RGBA] = fxsetupXYZWRGBAT1;
setupfuncs[SETUP_XYZW | SETUP_TMU1 | SETUP_TMU0] = fxsetupXYZWT0T1;
setupfuncs[SETUP_XYZW | SETUP_TMU1 | SETUP_TMU0 | SETUP_RGBA] =
fxsetupXYZWRGBAT0T1;
setupfuncs[SETUP_XYZW|SETUP_SNAP] = fxsetupXYZW_SNAP;
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_RGBA] = fxsetupXYZW_SNAP_RGBA;
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU0] = fxsetupXYZW_SNAP_T0;
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1] = fxsetupXYZW_SNAP_T1;
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU0|SETUP_RGBA] =
setupfuncs[SETUP_XYZW | SETUP_SNAP] = fxsetupXYZW_SNAP;
setupfuncs[SETUP_XYZW | SETUP_SNAP | SETUP_RGBA] = fxsetupXYZW_SNAP_RGBA;
setupfuncs[SETUP_XYZW | SETUP_SNAP | SETUP_TMU0] = fxsetupXYZW_SNAP_T0;
setupfuncs[SETUP_XYZW | SETUP_SNAP | SETUP_TMU1] = fxsetupXYZW_SNAP_T1;
setupfuncs[SETUP_XYZW | SETUP_SNAP | SETUP_TMU0 | SETUP_RGBA] =
fxsetupXYZW_SNAP_RGBAT0;
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_RGBA] =
setupfuncs[SETUP_XYZW | SETUP_SNAP | SETUP_TMU1 | SETUP_RGBA] =
fxsetupXYZW_SNAP_RGBAT1;
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0] =
setupfuncs[SETUP_XYZW | SETUP_SNAP | SETUP_TMU1 | SETUP_TMU0] =
fxsetupXYZW_SNAP_T0T1;
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] =
fxsetupXYZW_SNAP_RGBAT0T1;
setupfuncs[SETUP_XYZW | SETUP_SNAP | SETUP_TMU1 | SETUP_TMU0 | SETUP_RGBA]
= fxsetupXYZW_SNAP_RGBAT0T1;
setupfuncs[SETUP_RGBA] = fxsetupRGBA;
setupfuncs[SETUP_TMU0] = fxsetupT0;
setupfuncs[SETUP_TMU1] = fxsetupT1;
setupfuncs[SETUP_TMU1|SETUP_TMU0] = fxsetupT0T1;
setupfuncs[SETUP_TMU0|SETUP_RGBA] = fxsetupRGBAT0;
setupfuncs[SETUP_TMU1|SETUP_RGBA] = fxsetupRGBAT1;
setupfuncs[SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] = fxsetupRGBAT0T1;
setupfuncs[SETUP_TMU1 | SETUP_TMU0] = fxsetupT0T1;
setupfuncs[SETUP_TMU0 | SETUP_RGBA] = fxsetupRGBAT0;
setupfuncs[SETUP_TMU1 | SETUP_RGBA] = fxsetupRGBAT1;
setupfuncs[SETUP_TMU1 | SETUP_TMU0 | SETUP_RGBA] = fxsetupRGBAT0T1;
}
void fx_validate_BuildProjVerts(GLcontext *ctx, GLuint start, GLuint count,
GLuint newinputs )
void
fx_validate_BuildProjVerts(GLcontext * ctx, GLuint start, GLuint count,
GLuint newinputs)
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
if (!fxMesa->is_in_hardware)
if (!fxMesa->is_in_hardware)
ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
else {
GLuint setupindex = SETUP_XYZW;
@ -299,56 +301,61 @@ void fx_validate_BuildProjVerts(GLcontext *ctx, GLuint start, GLuint count,
fxMesa->tmu_source[1] = 1;
fxMesa->tex_dest[0] = SETUP_TMU0;
fxMesa->tex_dest[1] = SETUP_TMU1;
/* For flat and two-side-lit triangles, colors will always be added
* to vertices in the triangle functions. Vertices will *always*
* have rbga values, but only sometimes will they come from here.
*/
if ((ctx->_TriangleCaps & (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE)) == 0)
if ((ctx->_TriangleCaps & (DD_FLATSHADE | DD_TRI_LIGHT_TWOSIDE)) == 0)
setupindex |= SETUP_RGBA;
if (ctx->Texture._ReallyEnabled & TEXTURE0_2D)
if (ctx->Texture._ReallyEnabled & TEXTURE0_2D)
setupindex |= SETUP_TMU0;
if (ctx->Texture._ReallyEnabled & TEXTURE1_2D) {
if ((ctx->Texture._ReallyEnabled & TEXTURE0_2D) == 0) {
fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[0] = SETUP_TMU1;
fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[1] = SETUP_TMU0;
fxMesa->tmu_source[0] = 1;
fxMesa->tex_dest[0] = SETUP_TMU1;
fxMesa->tmu_source[1] = 0;
fxMesa->tex_dest[1] = SETUP_TMU0;
setupindex |= SETUP_TMU0;
} else {
}
else {
setupindex |= SETUP_TMU1;
}
}
if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE|VERBOSE_STATE))
fxPrintSetupFlags("fxmesa: vertex setup function", setupindex);
if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_PIPELINE | VERBOSE_STATE))
fxPrintSetupFlags("fxmesa: vertex setup function", setupindex);
fxMesa->setupindex = setupindex;
ctx->Driver.BuildProjectedVertices = fx_BuildProjVerts;
}
ctx->Driver.BuildProjectedVertices( ctx, start, count, newinputs );
ctx->Driver.BuildProjectedVertices(ctx, start, count, newinputs);
}
void fx_BuildProjVerts( GLcontext *ctx, GLuint start, GLuint count,
GLuint newinputs )
void
fx_BuildProjVerts(GLcontext * ctx, GLuint start, GLuint count,
GLuint newinputs)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
if (newinputs == ~0) {
/* build interpolated vertices */
setupfuncs[fxMesa->setupindex]( ctx, start, count );
} else {
setupfuncs[fxMesa->setupindex] (ctx, start, count);
}
else {
GLuint ind = fxMesa->setup_gone;
fxMesa->setup_gone = 0;
if (newinputs & VERT_CLIP)
if (newinputs & VERT_CLIP)
ind = fxMesa->setupindex; /* clipmask has potentially changed */
else {
if (newinputs & VERT_TEX0)
ind |= fxMesa->tex_dest[0];
if (newinputs & VERT_TEX1)
ind |= fxMesa->tex_dest[1];
@ -359,30 +366,32 @@ void fx_BuildProjVerts( GLcontext *ctx, GLuint start, GLuint count,
}
if (ind) {
if (fxMesa->new_state)
fxSetupFXUnits( ctx ); /* why? */
if (fxMesa->new_state)
fxSetupFXUnits(ctx); /* why? */
if (VB->importable_data & newinputs)
VB->import_data( ctx, VB->importable_data & newinputs,
VEC_BAD_STRIDE );
setupfuncs[ind]( ctx, start, count );
VB->import_data(ctx, VB->importable_data & newinputs,
VEC_BAD_STRIDE);
setupfuncs[ind] (ctx, start, count);
}
}
}
void fxAllocVB( GLcontext *ctx )
void
fxAllocVB(GLcontext * ctx)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
fxMesa->verts = ALIGN_MALLOC( tnl->vb.Size * sizeof(fxMesa->verts[0]), 32 );
fxMesa->verts = ALIGN_MALLOC(tnl->vb.Size * sizeof(fxMesa->verts[0]), 32);
}
void fxFreeVB( GLcontext *ctx )
void
fxFreeVB(GLcontext * ctx)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (fxMesa->verts)
ALIGN_FREE( fxMesa->verts );
ALIGN_FREE(fxMesa->verts);
fxMesa->verts = 0;
}
@ -395,9 +404,10 @@ void fxFreeVB( GLcontext *ctx )
*/
extern int gl_fx_dummy_function_vsetup(void);
int gl_fx_dummy_function_vsetup(void)
int
gl_fx_dummy_function_vsetup(void)
{
return 0;
return 0;
}
#endif /* FX */
#endif /* FX */

View file

@ -27,17 +27,18 @@
*/
static void NAME(GLcontext *ctx, GLuint start, GLuint end )
static void
NAME(GLcontext * ctx, GLuint start, GLuint end)
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
fxVertex *verts = fxMesa->verts;
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLuint tmu0_source = fxMesa->tmu_source[0];
GLuint tmu1_source = fxMesa->tmu_source[1];
GLfloat (*tmu0_data)[4];
GLfloat (*tmu1_data)[4];
GLubyte (*color)[4];
GLfloat (*proj)[4] = VB->ProjectedClipPtr->data;
GLfloat(*tmu0_data)[4];
GLfloat(*tmu1_data)[4];
GLubyte(*color)[4];
GLfloat(*proj)[4] = VB->ProjectedClipPtr->data;
fxVertex *v = &verts[start];
GLfloat sscale0 = fxMesa->s0scale;
GLfloat tscale0 = fxMesa->t0scale;
@ -45,36 +46,36 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end )
GLfloat tscale1 = fxMesa->t1scale;
GLubyte *clipmask = VB->ClipMask;
GLuint i;
const GLfloat * const s = ctx->Viewport._WindowMap.m;
const GLfloat *const s = ctx->Viewport._WindowMap.m;
if (IND & SETUP_TMU0)
tmu0_data = VB->TexCoordPtr[tmu0_source]->data;
if (IND & SETUP_TMU1)
tmu1_data = VB->TexCoordPtr[tmu1_source]->data;
if (IND & SETUP_RGBA)
color = VB->ColorPtr[0]->data;
if (VB->ClipOrMask) {
for (i = start ; i < end ; i++, v++) {
for (i = start; i < end; i++, v++) {
if (!clipmask[i]) {
if (IND & SETUP_XYZW) {
v->v.x = s[0] * proj[i][0] + s[12];
v->v.y = s[5] * proj[i][1] + s[13];
v->v.ooz = s[10] * proj[i][2] + s[14];
v->v.oow = proj[i][3];
v->v.x = s[0] * proj[i][0] + s[12];
v->v.y = s[5] * proj[i][1] + s[13];
v->v.ooz = s[10] * proj[i][2] + s[14];
v->v.oow = proj[i][3];
if (IND & SETUP_SNAP) {
#if defined(USE_IEEE)
const float snapper = (3L<<18);
v->v.x += snapper;
v->v.x -= snapper;
v->v.y += snapper;
v->v.y -= snapper;
const float snapper = (3L << 18);
v->v.x += snapper;
v->v.x -= snapper;
v->v.y += snapper;
v->v.y -= snapper;
#else
v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f);
v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f);
v->v.x = ((int) (v->v.x * 16.0f)) * (1.0f / 16.0f);
v->v.y = ((int) (v->v.y * 16.0f)) * (1.0f / 16.0f);
#endif
}
}
@ -85,34 +86,34 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end )
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]);
}
if (IND & SETUP_TMU0) {
v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow;
v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow;
v->v.tmuvtx[0].sow = sscale0 * tmu0_data[i][0] * v->v.oow;
v->v.tmuvtx[0].tow = tscale0 * tmu0_data[i][1] * v->v.oow;
}
if (IND & SETUP_TMU1) {
v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow;
v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow;
v->v.tmuvtx[1].sow = sscale1 * tmu1_data[i][0] * v->v.oow;
v->v.tmuvtx[1].tow = tscale1 * tmu1_data[i][1] * v->v.oow;
}
}
}
}
else {
for (i = start ; i < end ; i++, v++) {
for (i = start; i < end; i++, v++) {
if (IND & SETUP_XYZW) {
v->v.x = s[0] * proj[i][0] + s[12];
v->v.y = s[5] * proj[i][1] + s[13];
v->v.ooz = s[10] * proj[i][2] + s[14];
v->v.oow = proj[i][3];
v->v.x = s[0] * proj[i][0] + s[12];
v->v.y = s[5] * proj[i][1] + s[13];
v->v.ooz = s[10] * proj[i][2] + s[14];
v->v.oow = proj[i][3];
if (IND & SETUP_SNAP) {
#if defined(USE_IEEE)
const float snapper = (3L<<18);
v->v.x += snapper;
v->v.x -= snapper;
v->v.y += snapper;
v->v.y -= snapper;
const float snapper = (3L << 18);
v->v.x += snapper;
v->v.x -= snapper;
v->v.y += snapper;
v->v.y -= snapper;
#else
v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f);
v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f);
v->v.x = ((int) (v->v.x * 16.0f)) * (1.0f / 16.0f);
v->v.y = ((int) (v->v.y * 16.0f)) * (1.0f / 16.0f);
#endif
}
}
@ -123,29 +124,27 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end )
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]);
}
if (IND & SETUP_TMU0) {
v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow;
v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow;
v->v.tmuvtx[0].sow = sscale0 * tmu0_data[i][0] * v->v.oow;
v->v.tmuvtx[0].tow = tscale0 * tmu0_data[i][1] * v->v.oow;
}
if (IND & SETUP_TMU1) {
v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow;
v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow;
v->v.tmuvtx[1].sow = sscale1 * tmu1_data[i][0] * v->v.oow;
v->v.tmuvtx[1].tow = tscale1 * tmu1_data[i][1] * v->v.oow;
}
}
}
if ((IND & SETUP_XYZW) &&
ctx->ProjectionMatrix.m[15] != 0.0F &&
ctx->Fog.Enabled)
{
fx_fake_fog_w( ctx, v, VB, start, end );
ctx->ProjectionMatrix.m[15] != 0.0F && ctx->Fog.Enabled) {
fx_fake_fog_w(ctx, v, VB, start, end);
}
/* Check for and enable projective texturing in each texture unit.
*/
if (IND & (SETUP_TMU0|SETUP_TMU1)) {
if (IND & (SETUP_TMU0 | SETUP_TMU1)) {
GLuint tmu0_sz = 2;
GLuint tmu1_sz = 2;
GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 |
GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 |
GR_STWHINT_W_DIFF_TMU1);
if (VB->TexCoordPtr[tmu0_source])
@ -155,15 +154,15 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end )
tmu1_sz = VB->TexCoordPtr[tmu1_source]->size;
if (tmu0_sz == 4) {
project_texcoords( v, VB, 0, tmu0_source, start, end );
project_texcoords(v, VB, 0, tmu0_source, start, end);
if (tmu1_sz == 4)
project_texcoords( v, VB, 1, tmu1_source, start, end );
else
copy_w( v, VB, 1, start, end );
hs |= (GR_STWHINT_W_DIFF_TMU0|GR_STWHINT_W_DIFF_TMU1);
}
project_texcoords(v, VB, 1, tmu1_source, start, end);
else
copy_w(v, VB, 1, start, end);
hs |= (GR_STWHINT_W_DIFF_TMU0 | GR_STWHINT_W_DIFF_TMU1);
}
else if (tmu1_sz == 4) {
project_texcoords( v, VB, 1, tmu1_source, start, end );
project_texcoords(v, VB, 1, tmu1_source, start, end);
hs |= GR_STWHINT_W_DIFF_TMU1;
}

File diff suppressed because it is too large Load diff