-/* $Id: osmesa.c,v 1.86 2002/07/09 01:22:51 brianp Exp $ */
+/* $Id: osmesa.c,v 1.87 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define INTERP_ALPHA 1
#define RENDER_SPAN( span ) \
GLuint i; \
- GLchan *img = PIXELADDR4(span->x, span->y); \
- for (i = 0; i < span->end; i++, img += 4) { \
- const GLdepth z = FixedToDepth(span->z); \
+ GLchan *img = PIXELADDR4(span.x, span.y); \
+ for (i = 0; i < span.end; i++, img += 4) { \
+ const GLdepth z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
- PACK_RGBA(img, FixedToChan(span->red), \
- FixedToChan(span->green), FixedToChan(span->blue), \
- FixedToChan(span->alpha)); \
+ PACK_RGBA(img, FixedToChan(span.red), \
+ FixedToChan(span.green), FixedToChan(span.blue), \
+ FixedToChan(span.alpha)); \
zRow[i] = z; \
} \
- span->red += span->redStep; \
- span->green += span->greenStep; \
- span->blue += span->blueStep; \
- span->alpha += span->alphaStep; \
- span->z += span->zStep; \
+ span.red += span.redStep; \
+ span.green += span.greenStep; \
+ span.blue += span.blueStep; \
+ span.alpha += span.alphaStep; \
+ span.z += span.zStep; \
}
#ifdef WIN32
#define RENDER_SPAN( span ) \
GLuint i; \
- GLuint *img = (GLuint *) PIXELADDR4(span->x, span->y); \
- for (i = 0; i < span->end; i++) { \
- const GLdepth z = FixedToDepth(span->z); \
+ GLuint *img = (GLuint *) PIXELADDR4(span.x, span.y); \
+ for (i = 0; i < span.end; i++) { \
+ const GLdepth z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
img[i] = pixel; \
zRow[i] = z; \
} \
- span->z += span->zStep; \
+ span.z += span.zStep; \
}
#ifdef WIN32
-/* $Id: xm_tri.c,v 1.26 2002/06/25 15:25:17 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.27 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
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"
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"
#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]; \
ptr->b = color[BCOMP]; \
zRow[i] = z; \
} \
- span->z += span->zStep; \
+ span.z += span.zStep; \
}
#include "swrast/s_tritemp.h"
#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], \
XMesaPutPixel(img, x, y, p); \
zRow[i] = z; \
} \
- span->z += span->zStep; \
+ span.z += span.zStep; \
}
#include "swrast/s_tritemp.h"
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"
#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"
#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"
#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"
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"
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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
-
#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"
const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-
#define INTERP_RGB 1
#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
#define PIXEL_TYPE GLubyte
#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"
const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-
#define INTERP_RGB 1
#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
#define PIXEL_TYPE GLubyte
#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"
#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); \
}
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; \
}
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; \
}
#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]; \
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
-
#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] ); \
#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
#define PIXEL_TYPE GLushort
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
-#define SETUP_CODE \
+#define SETUP_CODE \
unsigned long p = PACK_5R6G5B( v2->color[0], \
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; \
}
#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]); \
}
#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); \
}
#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 ); \
}
#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
#define PIXEL_TYPE GLubyte
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
-#define SETUP_CODE \
+#define SETUP_CODE \
GLubyte r = v2->color[0]; \
GLubyte g = v2->color[1]; \
GLubyte b = v2->color[2];
-#define RENDER_SPAN( span ) \
+#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); \
}
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; \
}
-/* $Id: s_aaline.c,v 1.15 2002/06/15 03:03:10 brianp Exp $ */
+/* $Id: s_aaline.c,v 1.16 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLfloat lambda[MAX_TEXTURE_UNITS];
GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS];
- struct sw_span *span;
+ struct sw_span span;
};
-/* $Id: s_aalinetemp.h,v 1.20 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_aalinetemp.h,v 1.21 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLfloat fx = (GLfloat) ix;
const GLfloat fy = (GLfloat) iy;
const GLfloat coverage = compute_coveragef(line, ix, iy);
- const GLuint i = line->span->end;
+ const GLuint i = line->span.end;
if (coverage == 0.0)
return;
- line->span->end++;
- line->span->coverage[i] = coverage;
- line->span->xArray[i] = ix;
- line->span->yArray[i] = iy;
+ line->span.end++;
+ line->span.array->coverage[i] = coverage;
+ line->span.array->x[i] = ix;
+ line->span.array->y[i] = iy;
/*
* Compute Z, color, texture coords, fog for the fragment by
* solving the plane equations at (ix,iy).
*/
#ifdef DO_Z
- line->span->zArray[i] = (GLdepth) solve_plane(fx, fy, line->zPlane);
+ line->span.array->z[i] = (GLdepth) solve_plane(fx, fy, line->zPlane);
#endif
#ifdef DO_FOG
- line->span->fogArray[i] = solve_plane(fx, fy, line->fPlane);
+ line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane);
#endif
#ifdef DO_RGBA
- line->span->color.rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane);
- line->span->color.rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane);
- line->span->color.rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane);
- line->span->color.rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane);
+ line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane);
+ line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane);
+ line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane);
+ line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane);
#endif
#ifdef DO_INDEX
- line->span->color.index[i] = (GLint) solve_plane(fx, fy, line->iPlane);
+ line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane);
#endif
#ifdef DO_SPEC
- line->span->specArray[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane);
- line->span->specArray[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane);
- line->span->specArray[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane);
+ line->span.array->spec[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane);
+ line->span.array->spec[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane);
+ line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane);
#endif
#ifdef DO_TEX
{
const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[0]);
- line->span->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ;
- line->span->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ;
- line->span->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ;
- line->span->lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ,
+ line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ;
+ line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ;
+ line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ;
+ line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ,
line->texWidth[0], line->texHeight[0]);
}
#elif defined(DO_MULTITEX)
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[unit]);
- line->span->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ;
- line->span->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ;
- line->span->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ;
- line->span->lambda[unit][i] = compute_lambda(line->sPlane[unit],
+ line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ;
+ line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ;
+ line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ;
+ line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit],
line->tPlane[unit], invQ,
line->texWidth[unit], line->texHeight[unit]);
}
}
#endif
- if (line->span->end == MAX_WIDTH) {
+ if (line->span.end == MAX_WIDTH) {
#if defined(DO_TEX) || defined(DO_MULTITEX)
- _mesa_write_texture_span(ctx, line->span);
+ _mesa_write_texture_span(ctx, &(line->span));
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, line->span);
+ _mesa_write_rgba_span(ctx, &(line->span));
#else
- _mesa_write_index_span(ctx, line->span);
+ _mesa_write_index_span(ctx, &(line->span));
#endif
- line->span->end = 0; /* reset counter */
+ line->span.end = 0; /* reset counter */
}
}
if (line.len == 0.0 || IS_INF_OR_NAN(line.len))
return;
- line.span = swrast->span;
INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE);
line.xAdj = line.dx / line.len * line.halfWidth;
line.yAdj = line.dy / line.len * line.halfWidth;
#ifdef DO_Z
- line.span->arrayMask |= SPAN_Z;
+ line.span.arrayMask |= SPAN_Z;
compute_plane(line.x0, line.y0, line.x1, line.y1,
v0->win[2], v1->win[2], line.zPlane);
#endif
#ifdef DO_FOG
- line.span->arrayMask |= SPAN_FOG;
+ line.span.arrayMask |= SPAN_FOG;
compute_plane(line.x0, line.y0, line.x1, line.y1,
v0->fog, v1->fog, line.fPlane);
#endif
#ifdef DO_RGBA
- line.span->arrayMask |= SPAN_RGBA;
+ line.span.arrayMask |= SPAN_RGBA;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
compute_plane(line.x0, line.y0, line.x1, line.y1,
v0->color[RCOMP], v1->color[RCOMP], line.rPlane);
}
#endif
#ifdef DO_SPEC
- line.span->arrayMask |= SPAN_SPEC;
+ line.span.arrayMask |= SPAN_SPEC;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
compute_plane(line.x0, line.y0, line.x1, line.y1,
v0->specular[RCOMP], v1->specular[RCOMP], line.srPlane);
}
#endif
#ifdef DO_INDEX
- line.span->arrayMask |= SPAN_INDEX;
+ line.span.arrayMask |= SPAN_INDEX;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
compute_plane(line.x0, line.y0, line.x1, line.y1,
(GLfloat) v0->index, (GLfloat) v1->index, line.iPlane);
const GLfloat r1 = v1->texcoord[0][2] * invW0;
const GLfloat q0 = v0->texcoord[0][3] * invW0;
const GLfloat q1 = v1->texcoord[0][3] * invW0;
- line.span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[0]);
compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[0]);
compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[0]);
#elif defined(DO_MULTITEX)
{
GLuint u;
- line.span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
}
#if defined(DO_TEX) || defined(DO_MULTITEX)
- _mesa_write_texture_span(ctx, line.span);
+ _mesa_write_texture_span(ctx, &(line.span));
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, line.span);
+ _mesa_write_rgba_span(ctx, &(line.span));
#else
- _mesa_write_index_span(ctx, line.span);
+ _mesa_write_index_span(ctx, &(line.span));
#endif
}
-/* $Id: s_aatritemp.h,v 1.29 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.30 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLboolean ltor;
GLfloat majDx, majDy; /* major (i.e. long) edge dx and dy */
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
#ifdef DO_Z
GLfloat zPlane[4];
*/
#ifdef DO_Z
compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane);
- span->arrayMask |= SPAN_Z;
+ span.arrayMask |= SPAN_Z;
#endif
#ifdef DO_FOG
compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane);
- span->arrayMask |= SPAN_FOG;
+ span.arrayMask |= SPAN_FOG;
#endif
#ifdef DO_RGBA
if (ctx->Light.ShadeModel == GL_SMOOTH) {
constant_plane(v2->color[BCOMP], bPlane);
constant_plane(v2->color[ACOMP], aPlane);
}
- span->arrayMask |= SPAN_RGBA;
+ span.arrayMask |= SPAN_RGBA;
#endif
#ifdef DO_INDEX
if (ctx->Light.ShadeModel == GL_SMOOTH) {
else {
constant_plane((GLfloat) v2->index, iPlane);
}
- span->arrayMask |= SPAN_INDEX;
+ span.arrayMask |= SPAN_INDEX;
#endif
#ifdef DO_SPEC
if (ctx->Light.ShadeModel == GL_SMOOTH) {
constant_plane(v2->specular[GCOMP], sgPlane);
constant_plane(v2->specular[BCOMP], sbPlane);
}
- span->arrayMask |= SPAN_SPEC;
+ span.arrayMask |= SPAN_SPEC;
#endif
#ifdef DO_TEX
{
texWidth = (GLfloat) texImage->Width;
texHeight = (GLfloat) texImage->Height;
}
- span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
#elif defined(DO_MULTITEX)
{
GLuint u;
}
}
}
- span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
#endif
/* Begin bottom-to-top scan over the triangle.
while (coverage > 0.0F) {
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
+ struct span_arrays *array = span.array;
#ifdef DO_INDEX
- span->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
+ array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
#else
- span->coverage[count] = coverage;
+ array->coverage[count] = coverage;
#endif
#ifdef DO_Z
- span->zArray[count] = (GLdepth) solve_plane(cx, cy, zPlane);
+ array->z[count] = (GLdepth) solve_plane(cx, cy, zPlane);
#endif
#ifdef DO_FOG
- span->fogArray[count] = solve_plane(cx, cy, fogPlane);
+ array->fog[count] = solve_plane(cx, cy, fogPlane);
#endif
#ifdef DO_RGBA
- span->color.rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
- span->color.rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
- span->color.rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
- span->color.rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
+ array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
+ array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
+ array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
+ array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
#endif
#ifdef DO_INDEX
- span->color.index[count] = (GLint) solve_plane(cx, cy, iPlane);
+ array->index[count] = (GLint) solve_plane(cx, cy, iPlane);
#endif
#ifdef DO_SPEC
- span->specArray[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
- span->specArray[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
- span->specArray[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
+ array->spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
+ array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
+ array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
#endif
#ifdef DO_TEX
{
const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
- span->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
- span->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
- span->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
- span->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane,
+ array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
+ array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
+ array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
+ array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane,
cx, cy, invQ,
texWidth, texHeight);
}
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
- span->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
- span->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
- span->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
- span->lambda[unit][count] = compute_lambda(sPlane[unit],
+ array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
+ array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
+ array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
+ array->lambda[unit][count] = compute_lambda(sPlane[unit],
tPlane[unit], vPlane[unit], cx, cy, invQ,
texWidth[unit], texHeight[unit]);
}
if (ix <= startX)
continue;
- span->x = startX;
- span->y = iy;
- span->end = (GLuint) ix - (GLuint) startX;
- ASSERT(span->interpMask == 0);
+ span.x = startX;
+ span.y = iy;
+ span.end = (GLuint) ix - (GLuint) startX;
+ ASSERT(span.interpMask == 0);
#if defined(DO_MULTITEX) || defined(DO_TEX)
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
#elif defined(DO_INDEX)
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
#endif
}
}
while (coverage > 0.0F) {
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
+ struct span_arrays *array = span.array;
#ifdef DO_INDEX
- span->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
+ array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
#else
- span->coverage[ix] = coverage;
+ array->coverage[ix] = coverage;
#endif
#ifdef DO_Z
- span->zArray[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
+ array->z[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
#endif
#ifdef DO_FOG
- span->fogArray[ix] = solve_plane(cx, cy, fogPlane);
+ array->fog[ix] = solve_plane(cx, cy, fogPlane);
#endif
#ifdef DO_RGBA
- span->color.rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
- span->color.rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
- span->color.rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
- span->color.rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
+ array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
+ array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
+ array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
+ array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
#endif
#ifdef DO_INDEX
- span->color.index[ix] = (GLint) solve_plane(cx, cy, iPlane);
+ array->index[ix] = (GLint) solve_plane(cx, cy, iPlane);
#endif
#ifdef DO_SPEC
- span->specArray[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
- span->specArray[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
- span->specArray[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
+ array->spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
+ array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
+ array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
#endif
#ifdef DO_TEX
{
const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
- span->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
- span->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
- span->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
- span->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane,
+ array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
+ array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
+ array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
+ array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane,
cx, cy, invQ, texWidth, texHeight);
}
#elif defined(DO_MULTITEX)
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
- span->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
- span->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
- span->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
- span->lambda[unit][ix] = compute_lambda(sPlane[unit],
+ array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
+ array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
+ array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
+ array->lambda[unit][ix] = compute_lambda(sPlane[unit],
tPlane[unit],
vPlane[unit],
cx, cy, invQ,
/* shift all values to the left */
/* XXX this is temporary */
{
+ struct span_arrays *array = span.array;
GLint j;
for (j = 0; j < (GLint) n; j++) {
#ifdef DO_RGBA
- COPY_4V(span->color.rgba[j], span->color.rgba[j + left]);
+ COPY_4V(array->rgba[j], array->rgba[j + left]);
#endif
#ifdef DO_SPEC
- COPY_4V(span->specArray[j], span->specArray[j + left]);
+ COPY_4V(array->spec[j], array->spec[j + left]);
#endif
#ifdef DO_INDEX
- span->color.index[j] = span->color.index[j + left];
+ array->index[j] = array->index[j + left];
#endif
#ifdef DO_Z
- span->zArray[j] = span->zArray[j + left];
+ array->z[j] = array->z[j + left];
#endif
#ifdef DO_FOG
- span->fogArray[j] = span->fogArray[j + left];
+ array->fog[j] = array->fog[j + left];
#endif
#ifdef DO_TEX
- COPY_4V(span->texcoords[0][j], span->texcoords[0][j + left]);
+ COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]);
#endif
#if defined(DO_MULTITEX) || defined(DO_TEX)
- span->lambda[0][j] = span->lambda[0][j + left];
+ array->lambda[0][j] = array->lambda[0][j + left];
#endif
- span->coverage[j] = span->coverage[j + left];
+ array->coverage[j] = array->coverage[j + left];
}
}
#ifdef DO_MULTITEX
/* shift texcoords */
{
+ struct span_arrays *array = span.array;
GLuint unit;
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLint j;
for (j = 0; j < (GLint) n; j++) {
- span->texcoords[unit][j][0] = span->texcoords[unit][j + left][0];
- span->texcoords[unit][j][1] = span->texcoords[unit][j + left][1];
- span->texcoords[unit][j][2] = span->texcoords[unit][j + left][2];
- span->lambda[unit][j] = span->lambda[unit][j + left];
+ array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0];
+ array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1];
+ array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2];
+ array->lambda[unit][j] = array->lambda[unit][j + left];
}
}
}
}
#endif
- span->x = left;
- span->y = iy;
- span->end = n;
- ASSERT(span->interpMask == 0);
+ span.x = left;
+ span.y = iy;
+ span.end = n;
+ ASSERT(span.interpMask == 0);
#if defined(DO_MULTITEX) || defined(DO_TEX)
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
#elif defined(DO_INDEX)
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
#endif
}
}
-/* $Id: s_alpha.c,v 1.10 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_alpha.c,v 1.11 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLint
_mesa_alpha_test( const GLcontext *ctx, struct sw_span *span )
{
- const GLchan (*rgba)[4] = (const GLchan (*)[4]) span->color.rgba;
+ const GLchan (*rgba)[4] = (const GLchan (*)[4]) span->array->rgba;
const GLchan ref = ctx->Color.AlphaRef;
const GLuint n = span->end;
- GLubyte *mask = span->mask;
+ GLubyte *mask = span->array->mask;
GLuint i;
if (span->arrayMask & SPAN_RGBA) {
-/* $Id: s_bitmap.c,v 1.18 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_bitmap.c,v 1.19 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLint row, col;
GLuint count = 0;
- struct sw_span *span = swrast->span;
+ struct sw_span span;
ASSERT(ctx->RenderMode == GL_RENDER);
ASSERT(bitmap);
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
if (ctx->Visual.rgbMode) {
- span->interpMask |= SPAN_RGBA;
- span->red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF);
- span->green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF);
- span->blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF);
- span->alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF);
- span->redStep = span->greenStep = span->blueStep = span->alphaStep = 0;
+ span.interpMask |= SPAN_RGBA;
+ span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF);
+ span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF);
+ span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF);
+ span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF);
+ span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0;
}
else {
- span->interpMask |= SPAN_INDEX;
- span->index = ChanToFixed(ctx->Current.RasterIndex);
- span->indexStep = 0;
+ span.interpMask |= SPAN_INDEX;
+ span.index = ChanToFixed(ctx->Current.RasterIndex);
+ span.indexStep = 0;
}
if (ctx->Depth.Test)
- _mesa_span_default_z(ctx, span);
+ _mesa_span_default_z(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
- for (row = 0; row < height; row++, span->y++) {
+ for (row = 0; row < height; row++, span.y++) {
const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack,
bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
for (col = 0; col < width; col++) {
if (*src & mask) {
- span->xArray[count] = px + col;
- span->yArray[count] = py + row;
+ span.array->x[count] = px + col;
+ span.array->y[count] = py + row;
count++;
}
if (mask == 128U) {
GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
for (col = 0; col < width; col++) {
if (*src & mask) {
- span->xArray[count] = px + col;
- span->yArray[count] = py + row;
+ span.array->x[count] = px + col;
+ span.array->y[count] = py + row;
count++;
}
if (mask == 1U) {
if (count + width >= MAX_WIDTH || row + 1 == height) {
/* flush the span */
- span->end = count;
+ span.end = count;
if (ctx->Visual.rgbMode)
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
else
- _mesa_write_index_span(ctx, span);
- span->end = 0;
+ _mesa_write_index_span(ctx, &span);
+ span.end = 0;
count = 0;
}
}
* fragments, initializing the mask array to indicate which fragmens to
* draw or skip.
*/
-
void
_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLint row, col;
- struct sw_span *span = swrast->span;
+ struct sw_span span;
ASSERT(ctx->RenderMode == GL_RENDER);
ASSERT(bitmap);
_swrast_validate_derived( ctx );
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK);
- /*span->arrayMask |= SPAN_MASK;*/ /* we'll init span->mask[] */
- span->x = px;
- span->y = py;
- /*span->end = width;*/
+
+ /*span.arrayMask |= SPAN_MASK;*/ /* we'll init span.mask[] */
+ span.x = px;
+ span.y = py;
+ /*span.end = width;*/
if (ctx->Visual.rgbMode) {
- span->interpMask |= SPAN_RGBA;
- span->red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF);
- span->green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF);
- span->blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF);
- span->alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF);
- span->redStep = span->greenStep = span->blueStep = span->alphaStep = 0;
+ span.interpMask |= SPAN_RGBA;
+ span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF);
+ span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF);
+ span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF);
+ span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF);
+ span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0;
}
else {
- span->interpMask |= SPAN_INDEX;
- span->index = ChanToFixed(ctx->Current.RasterIndex);
- span->indexStep = 0;
+ span.interpMask |= SPAN_INDEX;
+ span.index = ChanToFixed(ctx->Current.RasterIndex);
+ span.indexStep = 0;
}
if (ctx->Depth.Test)
- _mesa_span_default_z(ctx, span);
+ _mesa_span_default_z(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
- for (row=0; row<height; row++, span->y++) {
+ for (row=0; row<height; row++, span.y++) {
const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack,
bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
/* Lsb first */
GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
for (col=0; col<width; col++) {
- span->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
+ span.array->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
if (mask == 128U) {
src++;
mask = 1U;
}
if (ctx->Visual.rgbMode)
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
else
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
/* get ready for next row */
if (mask != 1)
/* Msb first */
GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
for (col=0; col<width; col++) {
- span->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
+ span.array->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
if (mask == 1U) {
src++;
mask = 128U;
}
if (ctx->Visual.rgbMode)
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
else
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
/* get ready for next row */
if (mask != 128)
-/* $Id: s_blend.c,v 1.23 2002/06/30 15:57:45 brianp Exp $ */
+/* $Id: s_blend.c,v 1.24 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (span->arrayMask & SPAN_XY) {
/* array of x/y pixel coords */
(*swrast->Driver.ReadRGBAPixels)( ctx, span->end,
- span->xArray, span->yArray,
- framebuffer, span->mask );
+ span->array->x, span->array->y,
+ framebuffer, span->array->mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
- _mesa_read_alpha_pixels( ctx, span->end, span->xArray, span->yArray,
- framebuffer, span->mask );
+ _mesa_read_alpha_pixels( ctx, span->end,
+ span->array->x, span->array->y,
+ framebuffer, span->array->mask );
}
}
else {
span->x, span->y, framebuffer );
}
- SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->mask, rgba,
+ SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->array->mask, rgba,
(const GLchan (*)[4]) framebuffer );
}
-/* $Id: s_context.c,v 1.36 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: s_context.c,v 1.37 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
swrast->TextureSample[i] = _swrast_validate_texture_sample;
- swrast->span = (struct sw_span *) MALLOC(sizeof(struct sw_span));
- if (!swrast->span) {
- FREE(swrast);
- return GL_FALSE;
+ swrast->span_data = MALLOC_STRUCT(span_arrays);
+ if (!swrast->span_data) {
+ FREE(swrast);
+ return GL_FALSE;
}
assert(ctx->Const.MaxTextureUnits > 0);
swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureUnits *
MAX_WIDTH * 4 * sizeof(GLchan));
if (!swrast->TexelBuffer) {
- FREE(swrast->span);
+ FREE(swrast->span_data);
FREE(swrast);
return GL_FALSE;
}
_mesa_debug(ctx, "_swrast_DestroyContext\n");
}
- FREE( swrast->span );
+ FREE( swrast->span_data );
FREE( swrast->TexelBuffer );
FREE( swrast );
-/* $Id: s_context.h,v 1.18 2002/05/02 00:59:20 brianp Exp $ */
+/* $Id: s_context.h,v 1.19 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
swrast_tri_func SpecTriangle;
/*@}*/
- struct sw_span *span;
+ /**
+ * Typically, we'll allocate a sw_span structure as a local variable
+ * and set its 'array' pointer to point to this object. The reason is
+ * this object is big and causes problems when allocated on the stack
+ * on some systems.
+ */
+ struct span_arrays *span_data;
/** Internal hooks, kept uptodate by the same mechanism as above.
*/
-/* $Id: s_copypix.c,v 1.39 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: s_copypix.c,v 1.40 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
const GLuint transferOps = ctx->_ImageTransferState;
GLfloat *dest, *tmpImage, *convImage;
- struct sw_span *span = swrast->span;
+ struct sw_span span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
if (ctx->Depth.Test)
- _mesa_span_default_z(ctx, span);
+ _mesa_span_default_z(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0
GLint g = (GLint) (src[i * 4 + GCOMP] * CHAN_MAXF);
GLint b = (GLint) (src[i * 4 + BCOMP] * CHAN_MAXF);
GLint a = (GLint) (src[i * 4 + ACOMP] * CHAN_MAXF);
- span->color.rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
- span->color.rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
- span->color.rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
- span->color.rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
+ span.array->rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
+ span.array->rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
+ span.array->rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
+ span.array->rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
}
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
- span->end = width;
- _swrast_pixel_texture(ctx, span);
+ span.end = width;
+ _swrast_pixel_texture(ctx, &span);
}
/* write row to framebuffer */
dy = desty + row;
if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
(*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
- (const GLchan (*)[4])span->color.rgba, NULL );
+ (const GLchan (*)[4])span.array->rgba, NULL );
}
else if (zoom) {
- span->x = destx;
- span->y = dy;
- span->end = width;
- _mesa_write_zoomed_rgba_span(ctx, span,
- (CONST GLchan (*)[4])span->color.rgba,
+ span.x = destx;
+ span.y = dy;
+ span.end = width;
+ _mesa_write_zoomed_rgba_span(ctx, &span,
+ (CONST GLchan (*)[4])span.array->rgba,
desty);
}
else {
- span->x = destx;
- span->y = dy;
- span->end = width;
- _mesa_write_rgba_span(ctx, span);
+ span.x = destx;
+ span.y = dy;
+ span.end = width;
+ _mesa_write_rgba_span(ctx, &span);
}
}
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
GLint overlapping;
const GLuint transferOps = ctx->_ImageTransferState;
- struct sw_span *span = swrast->span;
+ struct sw_span span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
if (ctx->Depth.Test)
- _mesa_span_default_z(ctx, span);
+ _mesa_span_default_z(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0
&& !zoom
/* Get source pixels */
if (overlapping) {
/* get from buffered image */
- MEMCPY(span->color.rgba, p, width * sizeof(GLchan) * 4);
+ MEMCPY(span.array->rgba, p, width * sizeof(GLchan) * 4);
p += width * 4;
}
else {
if (changeBuffer)
_swrast_use_read_buffer(ctx);
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy,
- span->color.rgba );
+ span.array->rgba );
if (changeBuffer)
_swrast_use_draw_buffer(ctx);
}
/* convert chan to float */
for (k = 0; k < width; k++) {
- rgbaFloat[k][RCOMP] = (GLfloat) span->color.rgba[k][RCOMP] * scale;
- rgbaFloat[k][GCOMP] = (GLfloat) span->color.rgba[k][GCOMP] * scale;
- rgbaFloat[k][BCOMP] = (GLfloat) span->color.rgba[k][BCOMP] * scale;
- rgbaFloat[k][ACOMP] = (GLfloat) span->color.rgba[k][ACOMP] * scale;
+ rgbaFloat[k][RCOMP] = (GLfloat) span.array->rgba[k][RCOMP] * scale;
+ rgbaFloat[k][GCOMP] = (GLfloat) span.array->rgba[k][GCOMP] * scale;
+ rgbaFloat[k][BCOMP] = (GLfloat) span.array->rgba[k][BCOMP] * scale;
+ rgbaFloat[k][ACOMP] = (GLfloat) span.array->rgba[k][ACOMP] * scale;
}
/* scale & bias */
if (transferOps & IMAGE_SCALE_BIAS_BIT) {
GLint g = (GLint) (rgbaFloat[k][GCOMP] * CHAN_MAXF);
GLint b = (GLint) (rgbaFloat[k][BCOMP] * CHAN_MAXF);
GLint a = (GLint) (rgbaFloat[k][ACOMP] * CHAN_MAXF);
- span->color.rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
- span->color.rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
- span->color.rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
- span->color.rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
+ span.array->rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
+ span.array->rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
+ span.array->rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
+ span.array->rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
}
UNDEFARRAY(rgbaFloat); /* mac 32k limitation */
}
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
- span->end = width;
- _swrast_pixel_texture(ctx, span);
+ span.end = width;
+ _swrast_pixel_texture(ctx, &span);
}
if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
(*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
- (const GLchan (*)[4])span->color.rgba, NULL );
+ (const GLchan (*)[4])span.array->rgba, NULL );
}
else if (zoom) {
- span->x = destx;
- span->y = dy;
- span->end = width;
- _mesa_write_zoomed_rgba_span(ctx, span,
- (CONST GLchan (*)[4]) span->color.rgba,
+ span.x = destx;
+ span.y = dy;
+ span.end = width;
+ _mesa_write_zoomed_rgba_span(ctx, &span,
+ (CONST GLchan (*)[4]) span.array->rgba,
desty);
}
else {
- span->x = destx;
- span->y = dy;
- span->end = width;
- _mesa_write_rgba_span(ctx, span);
+ span.x = destx;
+ span.y = dy;
+ span.end = width;
+ _mesa_write_rgba_span(ctx, &span);
}
}
GLint srcx, GLint srcy, GLint width, GLint height,
GLint destx, GLint desty )
{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint *tmpImage,*p;
GLint sy, dy, stepy;
GLint j;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset;
GLint overlapping;
- struct sw_span *span = swrast->span;
+ struct sw_span span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX);
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
if (ctx->Depth.Test)
- _mesa_span_default_z(ctx, span);
+ _mesa_span_default_z(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
/* If read and draw buffer are different we must do buffer switching */
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer
for (j = 0; j < height; j++, sy += stepy, dy += stepy) {
if (overlapping) {
- MEMCPY(span->color.index, p, width * sizeof(GLuint));
+ MEMCPY(span.array->index, p, width * sizeof(GLuint));
p += width;
}
else {
if (changeBuffer)
_swrast_use_read_buffer(ctx);
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy,
- span->color.index );
+ span.array->index );
if (changeBuffer)
_swrast_use_draw_buffer(ctx);
}
if (shift_or_offset) {
- _mesa_shift_and_offset_ci( ctx, width, span->color.index );
+ _mesa_shift_and_offset_ci( ctx, width, span.array->index );
}
if (ctx->Pixel.MapColorFlag) {
- _mesa_map_ci( ctx, width, span->color.index );
+ _mesa_map_ci( ctx, width, span.array->index );
}
- span->x = destx;
- span->y = dy;
- span->end = width;
+ span.x = destx;
+ span.y = dy;
+ span.end = width;
if (zoom)
- _mesa_write_zoomed_index_span(ctx, span, desty);
+ _mesa_write_zoomed_index_span(ctx, &span, desty);
else
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
}
if (overlapping)
GLint i, j;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
GLint overlapping;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
- _mesa_span_default_color(ctx, span);
+ _mesa_span_default_color(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
if (overlapping) {
GLint ssy = sy;
for (i = 0; i < width; i++) {
GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
- span->zArray[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax);
+ span.array->z[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax);
}
- span->x = destx;
- span->y = dy;
- span->end = width;
+ span.x = destx;
+ span.y = dy;
+ span.end = width;
if (ctx->Visual.rgbMode) {
if (zoom)
- _mesa_write_zoomed_rgba_span( ctx, span,
- (const GLchan (*)[4])span->color.rgba,
+ _mesa_write_zoomed_rgba_span( ctx, &span,
+ (const GLchan (*)[4])span.array->rgba,
desty );
else
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
}
else {
if (zoom)
- _mesa_write_zoomed_index_span( ctx, span, desty );
+ _mesa_write_zoomed_index_span( ctx, &span, desty );
else
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
}
}
-/* $Id: s_depth.c,v 1.22 2002/04/19 00:38:27 brianp Exp $ */
+/* $Id: s_depth.c,v 1.23 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLdepth zbuffer[MAX_WIDTH];
GLuint passed;
(*swrast->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer);
- passed = depth_test_span32(ctx, n, zbuffer, span->zArray, span->mask);
+ passed = depth_test_span32(ctx, n, zbuffer, span->array->z,
+ span->array->mask);
ASSERT(swrast->Driver.WriteDepthSpan);
- (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, span->mask);
+ (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer,
+ span->array->mask);
if (passed < n)
span->writeAll = GL_FALSE;
return passed;
/* software depth buffer */
if (ctx->Visual.depthBits <= 16) {
GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, x, y);
- passed = depth_test_span16(ctx, n, zptr, span->zArray, span->mask);
+ passed = depth_test_span16(ctx, n, zptr, span->array->z, span->array->mask);
}
else {
GLuint *zptr = (GLuint *) Z_ADDRESS32(ctx, x, y);
- passed = depth_test_span32(ctx, n, zptr, span->zArray, span->mask);
+ passed = depth_test_span32(ctx, n, zptr, span->array->z, span->array->mask);
}
#if 1
if (passed < span->end) {
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLuint n = span->end;
- const GLint *x = span->xArray;
- const GLint *y = span->yArray;
- const GLdepth *z = span->zArray;
- GLubyte *mask = span->mask;
+ const GLint *x = span->array->x;
+ const GLint *y = span->array->y;
+ const GLdepth *z = span->array->z;
+ GLubyte *mask = span->array->mask;
if (swrast->Driver.ReadDepthPixels) {
/* read depth values from hardware Z buffer */
-/* $Id: s_drawpix.c,v 1.35 2002/06/15 03:03:11 brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.36 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
- struct sw_span *span = swrast->span;
+ struct sw_span span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
}
if (ctx->Depth.Test)
- _mesa_span_default_z(ctx, span);
+ _mesa_span_default_z(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0
&& ctx->Texture._EnabledUnits == 0
/* with zooming */
GLint row;
for (row=0; row<drawHeight; row++) {
- span->x = destX;
- span->y = destY;
- span->end = drawWidth;
- _mesa_write_zoomed_rgba_span(ctx, span,
+ span.x = destX;
+ span.y = destY;
+ span.end = drawWidth;
+ _mesa_write_zoomed_rgba_span(ctx, &span,
(CONST GLchan (*)[4]) src, zoomY0);
src += rowLength * 4;
destY++;
/* with zooming */
GLint row;
for (row=0; row<drawHeight; row++) {
- span->x = destX;
- span->y = destY;
- span->end = drawWidth;
- _mesa_write_zoomed_rgb_span(ctx, span,
+ span.x = destX;
+ span.y = destY;
+ span.end = drawWidth;
+ _mesa_write_zoomed_rgb_span(ctx, &span,
(CONST GLchan (*)[3]) src, zoomY0);
src += rowLength * 3;
destY++;
for (row=0; row<drawHeight; row++) {
GLint i;
for (i=0;i<drawWidth;i++) {
- span->color.rgb[i][0] = src[i];
- span->color.rgb[i][1] = src[i];
- span->color.rgb[i][2] = src[i];
+ span.array->rgb[i][0] = src[i];
+ span.array->rgb[i][1] = src[i];
+ span.array->rgb[i][2] = src[i];
}
(*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[3]) span->color.rgb, NULL);
+ (CONST GLchan (*)[3]) span.array->rgb, NULL);
src += rowLength;
destY++;
}
for (row=0; row<drawHeight; row++) {
GLint i;
for (i=0;i<drawWidth;i++) {
- span->color.rgb[i][0] = src[i];
- span->color.rgb[i][1] = src[i];
- span->color.rgb[i][2] = src[i];
+ span.array->rgb[i][0] = src[i];
+ span.array->rgb[i][1] = src[i];
+ span.array->rgb[i][2] = src[i];
}
destY--;
(*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[3]) span->color.rgb, NULL);
+ (CONST GLchan (*)[3]) span.array->rgb, NULL);
src += rowLength;
}
}
for (row=0; row<drawHeight; row++) {
GLint i;
for (i=0;i<drawWidth;i++) {
- span->color.rgb[i][0] = src[i];
- span->color.rgb[i][1] = src[i];
- span->color.rgb[i][2] = src[i];
+ span.array->rgb[i][0] = src[i];
+ span.array->rgb[i][1] = src[i];
+ span.array->rgb[i][2] = src[i];
}
- span->x = destX;
- span->y = destY;
- span->end = drawWidth;
- _mesa_write_zoomed_rgb_span(ctx, span,
- (CONST GLchan (*)[3]) span->color.rgb, zoomY0);
+ span.x = destX;
+ span.y = destY;
+ span.end = drawWidth;
+ _mesa_write_zoomed_rgb_span(ctx, &span,
+ (CONST GLchan (*)[3]) span.array->rgb, zoomY0);
src += rowLength;
destY++;
}
GLint i;
GLchan *ptr = src;
for (i=0;i<drawWidth;i++) {
- span->color.rgba[i][0] = *ptr;
- span->color.rgba[i][1] = *ptr;
- span->color.rgba[i][2] = *ptr++;
- span->color.rgba[i][3] = *ptr++;
+ span.array->rgba[i][0] = *ptr;
+ span.array->rgba[i][1] = *ptr;
+ span.array->rgba[i][2] = *ptr++;
+ span.array->rgba[i][3] = *ptr++;
}
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[4]) span->color.rgba, NULL);
+ (CONST GLchan (*)[4]) span.array->rgba, NULL);
src += rowLength*2;
destY++;
}
GLint i;
GLchan *ptr = src;
for (i=0;i<drawWidth;i++) {
- span->color.rgba[i][0] = *ptr;
- span->color.rgba[i][1] = *ptr;
- span->color.rgba[i][2] = *ptr++;
- span->color.rgba[i][3] = *ptr++;
+ span.array->rgba[i][0] = *ptr;
+ span.array->rgba[i][1] = *ptr;
+ span.array->rgba[i][2] = *ptr++;
+ span.array->rgba[i][3] = *ptr++;
}
destY--;
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[4]) span->color.rgba, NULL);
+ (CONST GLchan (*)[4]) span.array->rgba, NULL);
src += rowLength*2;
}
}
GLchan *ptr = src;
GLint i;
for (i=0;i<drawWidth;i++) {
- span->color.rgba[i][0] = *ptr;
- span->color.rgba[i][1] = *ptr;
- span->color.rgba[i][2] = *ptr++;
- span->color.rgba[i][3] = *ptr++;
+ span.array->rgba[i][0] = *ptr;
+ span.array->rgba[i][1] = *ptr;
+ span.array->rgba[i][2] = *ptr++;
+ span.array->rgba[i][3] = *ptr++;
}
- span->x = destX;
- span->y = destY;
- span->end = drawWidth;
- _mesa_write_zoomed_rgba_span(ctx, span,
- (CONST GLchan (*)[4]) span->color.rgba, zoomY0);
+ span.x = destX;
+ span.y = destY;
+ span.end = drawWidth;
+ _mesa_write_zoomed_rgba_span(ctx, &span,
+ (CONST GLchan (*)[4]) span.array->rgba, zoomY0);
src += rowLength*2;
destY++;
}
GLint row;
for (row=0; row<drawHeight; row++) {
ASSERT(drawWidth < MAX_WIDTH);
- _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span->color.rgba);
+ _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba);
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (const GLchan (*)[4]) span->color.rgba, NULL);
+ (const GLchan (*)[4]) span.array->rgba, NULL);
src += rowLength;
destY++;
}
GLint row;
for (row=0; row<drawHeight; row++) {
ASSERT(drawWidth < MAX_WIDTH);
- _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span->color.rgba);
+ _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba);
destY--;
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[4]) span->color.rgba, NULL);
+ (CONST GLchan (*)[4]) span.array->rgba, NULL);
src += rowLength;
}
return GL_TRUE;
GLint row;
for (row=0; row<drawHeight; row++) {
ASSERT(drawWidth < MAX_WIDTH);
- _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span->color.rgba);
- span->x = destX;
- span->y = destY;
- span->end = drawWidth;
- _mesa_write_zoomed_rgba_span(ctx, span,
- (CONST GLchan (*)[4]) span->color.rgba, zoomY0);
+ _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba);
+ span.x = destX;
+ span.y = destY;
+ span.end = drawWidth;
+ _mesa_write_zoomed_rgba_span(ctx, &span,
+ (CONST GLchan (*)[4]) span.array->rgba, zoomY0);
src += rowLength;
destY++;
}
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y;
GLint row, drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_INDEX);
if (ctx->Depth.Test)
- _mesa_span_default_z(ctx, span);
+ _mesa_span_default_z(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
/*
* General solution
const GLvoid *source = _mesa_image_address(&ctx->Unpack,
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
_mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT,
- span->color.index,
+ span.array->index,
type, source, &ctx->Unpack,
ctx->_ImageTransferState);
- span->x = x;
- span->y = y;
- span->end = drawWidth;
+ span.x = x;
+ span.y = y;
+ span.end = drawWidth;
if (zoom)
- _mesa_write_zoomed_index_span(ctx, span, desty);
+ _mesa_write_zoomed_index_span(ctx, &span, desty);
else
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
}
}
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y;
GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_Z);
return;
}
- _mesa_span_default_color(ctx, span);
+ _mesa_span_default_color(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
if (ctx->Texture._ReallyEnabled)
- _mesa_span_default_texcoords(ctx, span);
+ _mesa_span_default_texcoords(ctx, &span);
if (type==GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16
&& !bias_or_scale && !zoom && ctx->Visual.rgbMode) {
/* Special case: directly write 16-bit depth values */
GLint row;
- span->x = x;
- span->y = y;
- span->end = drawWidth;
- for (row = 0; row < height; row++, span->y++) {
+ span.x = x;
+ span.y = y;
+ span.end = drawWidth;
+ for (row = 0; row < height; row++, span.y++) {
const GLushort *zptr = (const GLushort *)
_mesa_image_address(&ctx->Unpack, pixels, width, height,
GL_DEPTH_COMPONENT, type, 0, row, 0);
GLint i;
for (i = 0; i < drawWidth; i++)
- span->zArray[i] = zptr[i];
- _mesa_write_rgba_span(ctx, span);
+ span.array->z[i] = zptr[i];
+ _mesa_write_rgba_span(ctx, &span);
}
}
else if (type==GL_UNSIGNED_INT && ctx->Visual.depthBits == 32
&& !bias_or_scale && !zoom && ctx->Visual.rgbMode) {
/* Special case: directly write 32-bit depth values */
GLint row;
- span->x = x;
- span->y = y;
- span->end = drawWidth;
- for (row = 0; row < height; row++, span->y++) {
+ span.x = x;
+ span.y = y;
+ span.end = drawWidth;
+ for (row = 0; row < height; row++, span.y++) {
const GLuint *zptr = (const GLuint *)
_mesa_image_address(&ctx->Unpack, pixels, width, height,
GL_DEPTH_COMPONENT, type, 0, row, 0);
- MEMCPY(span->zArray, zptr, drawWidth * sizeof(GLdepth));
- _mesa_write_rgba_span(ctx, span);
+ MEMCPY(span.array->z, zptr, drawWidth * sizeof(GLdepth));
+ _mesa_write_rgba_span(ctx, &span);
}
}
else {
/* General case */
GLint row;
- span->x = x;
- span->y = y;
- span->end = drawWidth;
- for (row = 0; row < height; row++, span->y++) {
+ span.x = x;
+ span.y = y;
+ span.end = drawWidth;
+ for (row = 0; row < height; row++, span.y++) {
GLfloat fspan[MAX_WIDTH];
const GLvoid *src = _mesa_image_address(&ctx->Unpack,
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
const GLfloat zs = ctx->DepthMaxF;
GLint i;
for (i = 0; i < drawWidth; i++) {
- span->zArray[i] = (GLdepth) (fspan[i] * zs + 0.5F);
+ span.array->z[i] = (GLdepth) (fspan[i] * zs + 0.5F);
}
}
if (ctx->Visual.rgbMode) {
- if (zoom)
- _mesa_write_zoomed_rgba_span(ctx, span,
- (const GLchan (*)[4]) span->color.rgba, desty);
+ if (zoom) {
+ abort();
+ _mesa_write_zoomed_rgba_span(ctx, &span,
+ (const GLchan (*)[4]) span.array->rgba, desty);
+ }
else
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
}
else {
+ abort();
if (zoom)
- _mesa_write_zoomed_index_span(ctx, span, desty);
+ _mesa_write_zoomed_index_span(ctx, &span, desty);
else
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
}
}
}
GLboolean quickDraw;
GLfloat *convImage = NULL;
GLuint transferOps = ctx->_ImageTransferState;
- struct sw_span *span = swrast->span;
+ struct sw_span span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
return;
if (ctx->Depth.Test)
- _mesa_span_default_z(ctx, span);
+ _mesa_span_default_z(ctx, &span);
if (ctx->Fog.Enabled)
- _mesa_span_default_fog(ctx, span);
+ _mesa_span_default_fog(ctx, &span);
if (ctx->Texture._ReallyEnabled)
- _mesa_span_default_texcoords(ctx, span);
+ _mesa_span_default_texcoords(ctx, &span);
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
&& x + width <= (GLint) ctx->DrawBuffer->Width
GLint row;
if (width > MAX_WIDTH)
width = MAX_WIDTH;
+
for (row = 0; row < height; row++, y++) {
const GLvoid *source = _mesa_image_address(unpack,
pixels, width, height, format, type, 0, row, 0);
+
_mesa_unpack_chan_color_span(ctx, width, GL_RGBA,
- (GLchan *) span->color.rgba,
+ (GLchan *) span.array->rgba,
format, type, source, unpack,
transferOps);
continue;
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
- span->end = width;
- _swrast_pixel_texture(ctx, span);
+ span.end = width;
+ _swrast_pixel_texture(ctx, &span);
}
if (quickDraw) {
(*swrast->Driver.WriteRGBASpan)(ctx, width, x, y,
- (CONST GLchan (*)[4]) span->color.rgba, NULL);
+ (CONST GLchan (*)[4]) span.array->rgba, NULL);
}
else if (zoom) {
- span->x = x;
- span->y = y;
- span->end = width;
- _mesa_write_zoomed_rgba_span(ctx, span,
- (CONST GLchan (*)[4]) span->color.rgba, desty);
+ span.x = x;
+ span.y = y;
+ span.end = width;
+ _mesa_write_zoomed_rgba_span(ctx, &span,
+ (CONST GLchan (*)[4]) span.array->rgba, desty);
}
else {
- span->x = x;
- span->y = y;
- span->end = width;
- _mesa_write_rgba_span(ctx, span);
+ span.x = x;
+ span.y = y;
+ span.end = width;
+ _mesa_write_rgba_span(ctx, &span);
}
}
}
-/* $Id: s_fog.c,v 1.22 2002/02/17 17:30:58 brianp Exp $ */
+/* $Id: s_fog.c,v 1.23 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
for (i=0;i<n;i++) {
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
GLfloat eyez = (ndcz - p14) / p10;
+ GLfloat f;
if (eyez < 0.0)
eyez = -eyez;
- fogFact[i] = (fogEnd - eyez) * fogScale;
+ f = (fogEnd - eyez) * fogScale;
+ fogFact[i] = CLAMP(f, 0.0F, 1.0F);
}
}
else {
for (i=0;i<n;i++) {
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
GLfloat eyez = p14 / (ndcz + p10);
+ GLfloat f;
if (eyez < 0.0)
eyez = -eyez;
- fogFact[i] = (fogEnd - eyez) * fogScale;
+ f = (fogEnd - eyez) * fogScale;
+ fogFact[i] = CLAMP(f, 0.0F, 1.0F);
}
}
}
/**
* Apply fog to a span of RGBA pixels.
- * The fog factors are either in the span->fogArray or stored as base/step.
+ * The fog factors are either in the span->array->fog or stored as base/step.
* These are fog _factors_, not fog coords. Fog coords were converted to
* fog factors per vertex.
*/
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLuint n = span->end;
- GLchan (*rgba)[4] = (GLchan (*)[4]) span->color.rgba;
+ GLchan (*rgba)[4] = (GLchan (*)[4]) span->array->rgba;
GLchan rFog, gFog, bFog;
ASSERT(ctx->Fog.Enabled);
/* compute fog factor from each fragment's Z value */
if ((span->interpMask & SPAN_Z) && (span->arrayMask & SPAN_Z) == 0)
_mesa_span_interpolate_z(ctx, span);
- compute_fog_factors_from_z(ctx, n, span->zArray, span->fogArray);
+ compute_fog_factors_from_z(ctx, n, span->array->z, span->array->fog);
span->arrayMask |= SPAN_FOG;
}
if (span->arrayMask & SPAN_FOG) {
+ /* use fog array in span */
GLuint i;
for (i = 0; i < n; i++) {
- const GLfloat fog = span->fogArray[i];
+ const GLfloat fog = span->array->fog[i];
const GLfloat oneMinusFog = 1.0F - fog;
rgba[i][RCOMP] = (GLchan) (fog * rgba[i][RCOMP] + oneMinusFog * rFog);
rgba[i][GCOMP] = (GLchan) (fog * rgba[i][GCOMP] + oneMinusFog * gFog);
}
}
else {
+ /* interpolate fog factors */
GLfloat fog = span->fog, dFog = span->fogStep;
GLuint i;
for (i = 0; i < n; i++) {
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLuint n = span->end;
- GLuint *index = span->color.index;
+ GLuint *index = span->array->index;
ASSERT(ctx->Fog.Enabled);
ASSERT(span->arrayMask & SPAN_INDEX);
/* compute fog factor from each fragment's Z value */
if ((span->interpMask & SPAN_Z) && (span->arrayMask & SPAN_Z) == 0)
_mesa_span_interpolate_z(ctx, span);
- compute_fog_factors_from_z(ctx, n, span->zArray, span->fogArray);
+ compute_fog_factors_from_z(ctx, n, span->array->z, span->array->fog);
span->arrayMask |= SPAN_FOG;
}
const GLuint idx = (GLuint) ctx->Fog.Index;
GLuint i;
for (i = 0; i < n; i++) {
- const GLfloat f = CLAMP(span->fogArray[i], 0.0F, 1.0F);
+ const GLfloat f = CLAMP(span->array->fog[i], 0.0F, 1.0F);
index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx);
}
}
-/* $Id: s_lines.c,v 1.30 2002/06/15 03:03:11 brianp Exp $ */
+/* $Id: s_lines.c,v 1.31 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
start = width / 2 - 1;
if (xMajor) {
+ GLint *y = span->array->y;
GLuint i;
GLint w;
for (w = 0; w < width; w++) {
if (w == 0) {
for (i = 0; i < span->end; i++)
- span->yArray[i] -= start;
+ y[i] -= start;
}
else {
for (i = 0; i < span->end; i++)
- span->yArray[i]++;
+ y[i]++;
}
if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE)
_mesa_write_texture_span(ctx, span);
}
}
else {
+ GLint *x = span->array->x;
GLuint i;
GLint w;
for (w = 0; w < width; w++) {
if (w == 0) {
for (i = 0; i < span->end; i++)
- span->xArray[i] -= start;
+ x[i] -= start;
}
else {
for (i = 0; i < span->end; i++)
- span->xArray[i]++;
+ x[i]++;
}
if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE)
_mesa_write_texture_span(ctx, span);
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ GLint *x, *y;
+ struct sw_span span;
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
ASSERT(!ctx->Line.StippleFlag);
ASSERT(ctx->Line.Width == 1.0F);
INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX, SPAN_XY);
- span->index = IntToFixed(vert1->index);
- span->indexStep = 0;
+ span.index = IntToFixed(vert1->index);
+ span.indexStep = 0;
+ x = span.array->x;
+ y = span.array->y;
#define INTERP_XY 1
-#define PLOT(X,Y) \
- { \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->end++; \
+#define PLOT(X,Y) \
+ { \
+ x[span.end] = X; \
+ y[span.end] = Y; \
+ span.end++; \
}
#include "s_linetemp.h"
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
}
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
+ GLint *x, *y;
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
ASSERT(!ctx->Line.StippleFlag);
ASSERT(ctx->Line.Width == 1.0F);
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA, SPAN_XY);
- span->red = ChanToFixed(vert1->color[0]);
- span->green = ChanToFixed(vert1->color[1]);
- span->blue = ChanToFixed(vert1->color[2]);
- span->alpha = ChanToFixed(vert1->color[3]);
- span->redStep = 0;
- span->greenStep = 0;
- span->blueStep = 0;
- span->alphaStep = 0;
+ span.red = ChanToFixed(vert1->color[0]);
+ span.green = ChanToFixed(vert1->color[1]);
+ span.blue = ChanToFixed(vert1->color[2]);
+ span.alpha = ChanToFixed(vert1->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
+ x = span.array->x;
+ y = span.array->y;
#define INTERP_XY 1
-#define PLOT(X,Y) \
- { \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->end++; \
+#define PLOT(X,Y) \
+ { \
+ x[span.end] = X; \
+ y[span.end] = Y; \
+ span.end++; \
}
#include "s_linetemp.h"
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
}
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
+ GLint *x, *y;
+ GLuint *index;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
ASSERT(!ctx->Line.StippleFlag);
ASSERT(ctx->Line.Width == 1.0F);
INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_INDEX);
+ x = span.array->x;
+ y = span.array->y;
+ index = span.array->index;
#define INTERP_XY 1
#define INTERP_INDEX 1
-#define PLOT(X,Y) \
- { \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->color.index[span->end] = I; \
- span->end++; \
+#define PLOT(X,Y) \
+ { \
+ x[span.end] = X; \
+ y[span.end] = Y; \
+ index[span.end] = I; \
+ span.end++; \
}
#include "s_linetemp.h"
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
}
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
+ GLint *x, *y;
+ GLchan (*rgba)[4];
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
ASSERT(!ctx->Line.StippleFlag);
ASSERT(ctx->Line.Width == 1.0F);
INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_RGBA);
+ x = span.array->x;
+ y = span.array->y;
+ rgba = span.array->rgba;
#define INTERP_XY 1
#define INTERP_RGB 1
#define INTERP_ALPHA 1
-#define PLOT(X,Y) \
- { \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->color.rgba[span->end][RCOMP] = FixedToInt(r0); \
- span->color.rgba[span->end][GCOMP] = FixedToInt(g0); \
- span->color.rgba[span->end][BCOMP] = FixedToInt(b0); \
- span->color.rgba[span->end][ACOMP] = FixedToInt(a0); \
- span->end++; \
+#define PLOT(X,Y) \
+ { \
+ x[span.end] = X; \
+ y[span.end] = Y; \
+ rgba[span.end][RCOMP] = FixedToInt(r0); \
+ rgba[span.end][GCOMP] = FixedToInt(g0); \
+ rgba[span.end][BCOMP] = FixedToInt(b0); \
+ rgba[span.end][ACOMP] = FixedToInt(a0); \
+ span.end++; \
}
#include "s_linetemp.h"
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
}
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
+ GLint *x, *y;
+ GLdepth *z;
+ GLfloat *fog;
+ GLuint *index;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
INIT_SPAN(span, GL_LINE, 0, 0,
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX);
+ x = span.array->x;
+ y = span.array->y;
+ z = span.array->z;
+ fog = span.array->fog;
+ index = span.array->index;
#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
#define INTERP_INDEX 1
-#define PLOT(X,Y) \
- { \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->zArray[span->end] = Z; \
- span->fogArray[span->end] = fog0; \
- span->color.index[span->end] = I; \
- span->end++; \
+#define PLOT(X,Y) \
+ { \
+ x[span.end] = X; \
+ y[span.end] = Y; \
+ z[span.end] = Z; \
+ fog[span.end] = fog0; \
+ index[span.end] = I; \
+ span.end++; \
}
#include "s_linetemp.h"
if (ctx->Line.StippleFlag) {
- span->arrayMask |= SPAN_MASK;
- compute_stipple_mask(ctx, span->end, span->mask);
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.array->mask);
}
if (ctx->Line.Width > 1.0) {
- draw_wide_line(ctx, span, xMajor);
+ draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
}
}
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
+ GLint *x, *y;
+ GLdepth *z;
+ GLfloat *fog;
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX,
SPAN_XY | SPAN_Z | SPAN_FOG);
- span->index = IntToFixed(vert1->index);
- span->indexStep = 0;
+ span.index = IntToFixed(vert1->index);
+ span.indexStep = 0;
+ x = span.array->x;
+ y = span.array->y;
+ z = span.array->z;
+ fog = span.array->fog;
#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
-#define PLOT(X,Y) \
- { \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->zArray[span->end] = Z; \
- span->fogArray[span->end] = fog0; \
- span->end++; \
+#define PLOT(X,Y) \
+ { \
+ x[span.end] = X; \
+ y[span.end] = Y; \
+ z[span.end] = Z; \
+ fog[span.end] = fog0; \
+ span.end++; \
}
#include "s_linetemp.h"
if (ctx->Line.StippleFlag) {
- span->arrayMask |= SPAN_MASK;
- compute_stipple_mask(ctx, span->end, span->mask);
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.array->mask);
}
if (ctx->Line.Width > 1.0) {
- draw_wide_line(ctx, span, xMajor);
+ draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
}
}
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
+ GLint *x, *y;
+ GLdepth *z;
+ GLchan (*rgba)[4];
+ GLfloat *fog;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
INIT_SPAN(span, GL_LINE, 0, 0,
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA);
+ x = span.array->x;
+ y = span.array->y;
+ z = span.array->z;
+ rgba = span.array->rgba;
+ fog = span.array->fog;
#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_FOG 1
#define INTERP_RGB 1
#define INTERP_ALPHA 1
-#define PLOT(X,Y) \
- { \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->zArray[span->end] = Z; \
- span->color.rgba[span->end][RCOMP] = FixedToInt(r0); \
- span->color.rgba[span->end][GCOMP] = FixedToInt(g0); \
- span->color.rgba[span->end][BCOMP] = FixedToInt(b0); \
- span->color.rgba[span->end][ACOMP] = FixedToInt(a0); \
- span->fogArray[span->end] = fog0; \
- span->end++; \
+#define PLOT(X,Y) \
+ { \
+ x[span.end] = X; \
+ y[span.end] = Y; \
+ z[span.end] = Z; \
+ rgba[span.end][RCOMP] = FixedToInt(r0); \
+ rgba[span.end][GCOMP] = FixedToInt(g0); \
+ rgba[span.end][BCOMP] = FixedToInt(b0); \
+ rgba[span.end][ACOMP] = FixedToInt(a0); \
+ fog[span.end] = fog0; \
+ span.end++; \
}
#include "s_linetemp.h"
if (ctx->Line.StippleFlag) {
- span->arrayMask |= SPAN_MASK;
- compute_stipple_mask(ctx, span->end, span->mask);
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.array->mask);
}
if (ctx->Line.Width > 1.0) {
- draw_wide_line(ctx, span, xMajor);
+ draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
}
}
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
+ GLint *x, *y;
+ GLdepth *z;
+ GLfloat *fog;
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA,
SPAN_XY | SPAN_Z | SPAN_FOG);
- span->red = ChanToFixed(vert1->color[0]);
- span->green = ChanToFixed(vert1->color[1]);
- span->blue = ChanToFixed(vert1->color[2]);
- span->alpha = ChanToFixed(vert1->color[3]);
- span->redStep = 0;
- span->greenStep = 0;
- span->blueStep = 0;
- span->alphaStep = 0;
+ span.red = ChanToFixed(vert1->color[0]);
+ span.green = ChanToFixed(vert1->color[1]);
+ span.blue = ChanToFixed(vert1->color[2]);
+ span.alpha = ChanToFixed(vert1->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
+ x = span.array->x;
+ y = span.array->y;
+ z = span.array->z;
+ fog = span.array->fog;
#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
-#define PLOT(X,Y) \
- { \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->zArray[span->end] = Z; \
- span->fogArray[span->end] = fog0; \
- span->end++; \
+#define PLOT(X,Y) \
+ { \
+ x[span.end] = X; \
+ y[span.end] = Y; \
+ z[span.end] = Z; \
+ fog[span.end] = fog0; \
+ span.end++; \
}
#include "s_linetemp.h"
if (ctx->Line.StippleFlag) {
- span->arrayMask |= SPAN_MASK;
- compute_stipple_mask(ctx, span->end, span->mask);
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.array->mask);
}
if (ctx->Line.Width > 1.0) {
- draw_wide_line(ctx, span, xMajor);
+ draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
}
}
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC,
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA);
- span->red = ChanToFixed(vert1->color[0]);
- span->green = ChanToFixed(vert1->color[1]);
- span->blue = ChanToFixed(vert1->color[2]);
- span->alpha = ChanToFixed(vert1->color[3]);
- span->redStep = 0;
- span->greenStep = 0;
- span->blueStep = 0;
- span->alphaStep = 0;
- span->specRed = ChanToFixed(vert1->specular[0]);
- span->specGreen = ChanToFixed(vert1->specular[1]);
- span->specBlue = ChanToFixed(vert1->specular[2]);
- span->specRedStep = 0;
- span->specGreenStep = 0;
- span->specBlueStep = 0;
+ span.red = ChanToFixed(vert1->color[0]);
+ span.green = ChanToFixed(vert1->color[1]);
+ span.blue = ChanToFixed(vert1->color[2]);
+ span.alpha = ChanToFixed(vert1->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
+ span.specRed = ChanToFixed(vert1->specular[0]);
+ span.specGreen = ChanToFixed(vert1->specular[1]);
+ span.specBlue = ChanToFixed(vert1->specular[2]);
+ span.specRedStep = 0;
+ span.specGreenStep = 0;
+ span.specBlueStep = 0;
#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_TEX 1
#define PLOT(X,Y) \
{ \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->zArray[span->end] = Z; \
- span->fogArray[span->end] = fog0; \
- span->texcoords[0][span->end][0] = fragTexcoord[0]; \
- span->texcoords[0][span->end][1] = fragTexcoord[1]; \
- span->texcoords[0][span->end][2] = fragTexcoord[2]; \
- span->lambda[0][span->end] = 0.0; \
- span->end++; \
+ span.array->x[span.end] = X; \
+ span.array->y[span.end] = Y; \
+ span.array->z[span.end] = Z; \
+ span.array->fog[span.end] = fog0; \
+ span.array->texcoords[0][span.end][0] = fragTexcoord[0]; \
+ span.array->texcoords[0][span.end][1] = fragTexcoord[1]; \
+ span.array->texcoords[0][span.end][2] = fragTexcoord[2]; \
+ span.array->lambda[0][span.end] = 0.0; \
+ span.end++; \
}
#include "s_linetemp.h"
if (ctx->Line.StippleFlag) {
- span->arrayMask |= SPAN_MASK;
- compute_stipple_mask(ctx, span->end, span->mask);
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.array->mask);
}
if (ctx->Line.Width > 1.0) {
- draw_wide_line(ctx, span, xMajor);
+ draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
}
}
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
#define INTERP_TEX 1
#define PLOT(X,Y) \
{ \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->zArray[span->end] = Z; \
- span->fogArray[span->end] = fog0; \
- span->color.rgba[span->end][RCOMP] = FixedToInt(r0); \
- span->color.rgba[span->end][GCOMP] = FixedToInt(g0); \
- span->color.rgba[span->end][BCOMP] = FixedToInt(b0); \
- span->color.rgba[span->end][ACOMP] = FixedToInt(a0); \
- span->texcoords[0][span->end][0] = fragTexcoord[0]; \
- span->texcoords[0][span->end][1] = fragTexcoord[1]; \
- span->texcoords[0][span->end][2] = fragTexcoord[2]; \
- span->lambda[0][span->end] = 0.0; \
- span->end++; \
+ span.array->x[span.end] = X; \
+ span.array->y[span.end] = Y; \
+ span.array->z[span.end] = Z; \
+ span.array->fog[span.end] = fog0; \
+ span.array->rgba[span.end][RCOMP] = FixedToInt(r0); \
+ span.array->rgba[span.end][GCOMP] = FixedToInt(g0); \
+ span.array->rgba[span.end][BCOMP] = FixedToInt(b0); \
+ span.array->rgba[span.end][ACOMP] = FixedToInt(a0); \
+ span.array->texcoords[0][span.end][0] = fragTexcoord[0]; \
+ span.array->texcoords[0][span.end][1] = fragTexcoord[1]; \
+ span.array->texcoords[0][span.end][2] = fragTexcoord[2]; \
+ span.array->lambda[0][span.end] = 0.0; \
+ span.end++; \
}
#include "s_linetemp.h"
if (ctx->Line.StippleFlag) {
- span->arrayMask |= SPAN_MASK;
- compute_stipple_mask(ctx, span->end, span->mask);
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.array->mask);
}
if (ctx->Line.Width > 1.0) {
- draw_wide_line(ctx, span, xMajor);
+ draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
}
}
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
GLuint u;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
#define INTERP_MULTITEX 1
#define PLOT(X,Y) \
{ \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->zArray[span->end] = Z; \
- span->fogArray[span->end] = fog0; \
- span->color.rgba[span->end][RCOMP] = FixedToInt(r0); \
- span->color.rgba[span->end][GCOMP] = FixedToInt(g0); \
- span->color.rgba[span->end][BCOMP] = FixedToInt(b0); \
- span->color.rgba[span->end][ACOMP] = FixedToInt(a0); \
- span->specArray[span->end][RCOMP] = FixedToInt(sr0); \
- span->specArray[span->end][GCOMP] = FixedToInt(sb0); \
- span->specArray[span->end][BCOMP] = FixedToInt(sb0); \
+ span.array->x[span.end] = X; \
+ span.array->y[span.end] = Y; \
+ span.array->z[span.end] = Z; \
+ span.array->fog[span.end] = fog0; \
+ span.array->rgba[span.end][RCOMP] = FixedToInt(r0); \
+ span.array->rgba[span.end][GCOMP] = FixedToInt(g0); \
+ span.array->rgba[span.end][BCOMP] = FixedToInt(b0); \
+ span.array->rgba[span.end][ACOMP] = FixedToInt(a0); \
+ span.array->spec[span.end][RCOMP] = FixedToInt(sr0); \
+ span.array->spec[span.end][GCOMP] = FixedToInt(sg0); \
+ span.array->spec[span.end][BCOMP] = FixedToInt(sb0); \
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
if (ctx->Texture.Unit[u]._ReallyEnabled) { \
- span->texcoords[u][span->end][0] = fragTexcoord[u][0]; \
- span->texcoords[u][span->end][1] = fragTexcoord[u][1]; \
- span->texcoords[u][span->end][2] = fragTexcoord[u][2]; \
- span->lambda[u][span->end] = 0.0; \
+ span.array->texcoords[u][span.end][0] = fragTexcoord[u][0]; \
+ span.array->texcoords[u][span.end][1] = fragTexcoord[u][1]; \
+ span.array->texcoords[u][span.end][2] = fragTexcoord[u][2]; \
+ span.array->lambda[u][span.end] = 0.0; \
} \
} \
- span->end++; \
+ span.end++; \
}
#include "s_linetemp.h"
if (ctx->Line.StippleFlag) {
- span->arrayMask |= SPAN_MASK;
- compute_stipple_mask(ctx, span->end, span->mask);
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.array->mask);
}
if (ctx->Line.Width > 1.0) {
- draw_wide_line(ctx, span, xMajor);
+ draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
}
}
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
GLuint u;
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC,
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA);
- span->red = ChanToFixed(vert1->color[0]);
- span->green = ChanToFixed(vert1->color[1]);
- span->blue = ChanToFixed(vert1->color[2]);
- span->alpha = ChanToFixed(vert1->color[3]);
- span->redStep = 0;
- span->greenStep = 0;
- span->blueStep = 0;
- span->alphaStep = 0;
- span->specRed = ChanToFixed(vert1->specular[0]);
- span->specGreen = ChanToFixed(vert1->specular[1]);
- span->specBlue = ChanToFixed(vert1->specular[2]);
- span->specRedStep = 0;
- span->specGreenStep = 0;
- span->specBlueStep = 0;
+ span.red = ChanToFixed(vert1->color[0]);
+ span.green = ChanToFixed(vert1->color[1]);
+ span.blue = ChanToFixed(vert1->color[2]);
+ span.alpha = ChanToFixed(vert1->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
+ span.specRed = ChanToFixed(vert1->specular[0]);
+ span.specGreen = ChanToFixed(vert1->specular[1]);
+ span.specBlue = ChanToFixed(vert1->specular[2]);
+ span.specRedStep = 0;
+ span.specGreenStep = 0;
+ span.specBlueStep = 0;
#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_MULTITEX 1
#define PLOT(X,Y) \
{ \
- span->xArray[span->end] = X; \
- span->yArray[span->end] = Y; \
- span->zArray[span->end] = Z; \
- span->fogArray[span->end] = fog0; \
+ span.array->x[span.end] = X; \
+ span.array->y[span.end] = Y; \
+ span.array->z[span.end] = Z; \
+ span.array->fog[span.end] = fog0; \
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
if (ctx->Texture.Unit[u]._ReallyEnabled) { \
- span->texcoords[u][span->end][0] = fragTexcoord[u][0]; \
- span->texcoords[u][span->end][1] = fragTexcoord[u][1]; \
- span->texcoords[u][span->end][2] = fragTexcoord[u][2]; \
- span->lambda[u][span->end] = 0.0; \
+ span.array->texcoords[u][span.end][0] = fragTexcoord[u][0]; \
+ span.array->texcoords[u][span.end][1] = fragTexcoord[u][1]; \
+ span.array->texcoords[u][span.end][2] = fragTexcoord[u][2]; \
+ span.array->lambda[u][span.end] = 0.0; \
} \
} \
- span->end++; \
+ span.end++; \
}
#include "s_linetemp.h"
if (ctx->Line.StippleFlag) {
- span->arrayMask |= SPAN_MASK;
- compute_stipple_mask(ctx, span->end, span->mask);
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.array->mask);
}
if (ctx->Line.Width > 1.0) {
- draw_wide_line(ctx, span, xMajor);
+ draw_wide_line(ctx, &span, xMajor);
}
else {
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
}
}
-/* $Id: s_logic.c,v 1.10 2002/02/02 21:40:33 brianp Exp $ */
+/* $Id: s_logic.c,v 1.11 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* Read dest values from frame buffer */
if (span->arrayMask & SPAN_XY) {
- (*swrast->Driver.ReadCI32Pixels)( ctx, span->end, span->xArray,
- span->yArray, dest, span->mask );
+ (*swrast->Driver.ReadCI32Pixels)( ctx, span->end,
+ span->array->x, span->array->y,
+ dest, span->array->mask );
}
else {
(*swrast->Driver.ReadCI32Span)( ctx, span->end, span->x, span->y, dest );
}
- index_logicop( ctx, span->end, index, dest, span->mask );
+ index_logicop( ctx, span->end, index, dest, span->array->mask );
}
if (span->arrayMask & SPAN_XY) {
(*swrast->Driver.ReadRGBAPixels)(ctx, span->end,
- span->xArray, span->yArray,
- dest, span->mask);
+ span->array->x, span->array->y,
+ dest, span->array->mask);
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
- _mesa_read_alpha_pixels(ctx, span->end, span->xArray, span->yArray,
- dest, span->mask);
+ _mesa_read_alpha_pixels(ctx, span->end,
+ span->array->x, span->array->y,
+ dest, span->array->mask);
}
}
else {
}
if (sizeof(GLchan) * 4 == sizeof(GLuint)) {
- rgba_logicop_ui(ctx, span->end, span->mask,
+ rgba_logicop_ui(ctx, span->end, span->array->mask,
(GLuint *) rgba, (const GLuint *) dest);
}
else {
- rgba_logicop_chan(ctx, 4 * span->end, span->mask,
+ rgba_logicop_chan(ctx, 4 * span->end, span->array->mask,
(GLchan *) rgba, (const GLchan *) dest);
}
}
-/* $Id: s_masking.c,v 1.7 2002/02/02 21:40:33 brianp Exp $ */
+/* $Id: s_masking.c,v 1.8 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT(span->arrayMask & SPAN_RGBA);
if (span->arrayMask & SPAN_XY) {
- (*swrast->Driver.ReadRGBAPixels)(ctx, n, span->xArray, span->yArray,
- dest, span->mask);
+ (*swrast->Driver.ReadRGBAPixels)(ctx, n, span->array->x, span->array->y,
+ dest, span->array->mask);
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
- _mesa_read_alpha_pixels(ctx, n, span->xArray, span->yArray,
- dest, span->mask );
+ _mesa_read_alpha_pixels(ctx, n, span->array->x, span->array->y,
+ dest, span->array->mask);
}
}
else {
if (span->arrayMask & SPAN_XY) {
- (*swrast->Driver.ReadCI32Pixels)(ctx, span->end, span->xArray,
- span->yArray, fbindexes, span->mask);
+ (*swrast->Driver.ReadCI32Pixels)(ctx, span->end, span->array->x,
+ span->array->y, fbindexes,
+ span->array->mask);
for (i = 0; i < span->end; i++) {
index[i] = (index[i] & msrc) | (fbindexes[i] & mdest);
-/* $Id: s_pixeltex.c,v 1.9 2002/05/02 00:59:20 brianp Exp $ */
+/* $Id: s_pixeltex.c,v 1.10 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* convert colors into texture coordinates */
pixeltexgen( ctx, span->end,
- (const GLchan (*)[4]) span->color.rgba,
- span->texcoords[0] );
+ (const GLchan (*)[4]) span->array->rgba,
+ span->array->texcoords[0] );
/* copy the new texture units for all enabled units */
for (unit = 1; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- MEMCPY( span->texcoords[unit], span->texcoords[0],
+ MEMCPY( span->array->texcoords[unit], span->array->texcoords[0],
span->end * 4 * sizeof(GLfloat) );
}
}
-/* $Id: s_pointtemp.h,v 1.17 2002/06/15 03:03:11 brianp Exp $ */
+/* $Id: s_pointtemp.h,v 1.18 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLchan alpha = vert->color[3];
#endif
- struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+ struct sw_span span;
/* Cull primitives with malformed coordinates.
*/
}
INIT_SPAN(span, GL_POINT, 0, SPAN_FOG, SPAN_XY | SPAN_Z);
- span->fog = vert->fog;
- span->fogStep = 0.0;
+ span.fog = vert->fog;
+ span.fogStep = 0.0;
#if (FLAGS & RGBA)
#if (FLAGS & SMOOTH)
/* because we need per-fragment alpha values */
- span->arrayMask |= SPAN_RGBA;
+ span.arrayMask |= SPAN_RGBA;
#else
/* same RGBA for all fragments */
- span->interpMask |= SPAN_RGBA;
- span->red = ChanToFixed(vert->color[0]);
- span->green = ChanToFixed(vert->color[1]);
- span->blue = ChanToFixed(vert->color[2]);
- span->alpha = ChanToFixed(vert->color[3]);
- span->redStep = span->greenStep = span->blueStep = span->alphaStep = 0;
+ span.interpMask |= SPAN_RGBA;
+ span.red = ChanToFixed(vert->color[0]);
+ span.green = ChanToFixed(vert->color[1]);
+ span.blue = ChanToFixed(vert->color[2]);
+ span.alpha = ChanToFixed(vert->color[3]);
+ span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0;
#endif /*SMOOTH*/
#endif /*RGBA*/
#if FLAGS & SPECULAR
- span->interpMask |= SPAN_SPEC;
- span->specRed = ChanToFixed(vert->specular[0]);
- span->specGreen = ChanToFixed(vert->specular[1]);
- span->specBlue = ChanToFixed(vert->specular[2]);
- span->specRedStep = span->specGreenStep = span->specBlueStep = 0;
+ span.interpMask |= SPAN_SPEC;
+ span.specRed = ChanToFixed(vert->specular[0]);
+ span.specGreen = ChanToFixed(vert->specular[1]);
+ span.specBlue = ChanToFixed(vert->specular[2]);
+ span.specRedStep = span.specGreenStep = span.specBlueStep = 0;
#endif
#if FLAGS & INDEX
- span->interpMask |= SPAN_INDEX;
- span->index = IntToFixed(vert->index);
- span->indexStep = 0;
+ span.interpMask |= SPAN_INDEX;
+ span.index = IntToFixed(vert->index);
+ span.indexStep = 0;
#endif
#if FLAGS & TEXTURE
/* but not used for sprite mode */
- span->interpMask |= SPAN_TEXTURE;
+ span.interpMask |= SPAN_TEXTURE;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
const GLfloat q = vert->texcoord[u][3];
const GLfloat invQ = (q == 0.0 || q == 1.0) ? 1.0 : (1.0 / q);
- span->tex[u][0] = vert->texcoord[u][0] * invQ;
- span->tex[u][1] = vert->texcoord[u][1] * invQ;
- span->tex[u][2] = vert->texcoord[u][2] * invQ;
- span->tex[u][3] = q;
- span->texStepX[u][0] = span->texStepY[u][0] = 0.0;
- span->texStepX[u][1] = span->texStepY[u][1] = 0.0;
- span->texStepX[u][2] = span->texStepY[u][2] = 0.0;
- span->texStepX[u][3] = span->texStepY[u][3] = 0.0;
+ span.tex[u][0] = vert->texcoord[u][0] * invQ;
+ span.tex[u][1] = vert->texcoord[u][1] * invQ;
+ span.tex[u][2] = vert->texcoord[u][2] * invQ;
+ span.tex[u][3] = q;
+ span.texStepX[u][0] = span.texStepY[u][0] = 0.0;
+ span.texStepX[u][1] = span.texStepY[u][1] = 0.0;
+ span.texStepX[u][2] = span.texStepY[u][2] = 0.0;
+ span.texStepX[u][3] = span.texStepY[u][3] = 0.0;
}
}
#endif
#if FLAGS & SMOOTH
- span->arrayMask |= SPAN_COVERAGE;
+ span.arrayMask |= SPAN_COVERAGE;
#endif
#if FLAGS & SPRITE
- span->arrayMask |= SPAN_TEXTURE;
+ span.arrayMask |= SPAN_TEXTURE;
#endif
#if FLAGS & ATTENUATE
if (dist2 < rmax2) {
if (dist2 >= rmin2) {
/* compute partial coverage */
- span->coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
+ span.array->coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
#if FLAGS & INDEX
- span->coverage[count] *= 15.0; /* coverage in [0,15] */
+ span.array->coverage[count] *= 15.0; /* coverage in [0,15] */
#endif
}
else {
/* full coverage */
- span->coverage[count] = 1.0F;
+ span.array->coverage[count] = 1.0F;
}
- span->xArray[count] = x;
- span->yArray[count] = y;
- span->zArray[count] = z;
+ span.array->x[count] = x;
+ span.array->y[count] = y;
+ span.array->z[count] = z;
#if FLAGS & RGBA
- span->color.rgba[count][RCOMP] = red;
- span->color.rgba[count][GCOMP] = green;
- span->color.rgba[count][BCOMP] = blue;
+ span.array->rgba[count][RCOMP] = red;
+ span.array->rgba[count][GCOMP] = green;
+ span.array->rgba[count][BCOMP] = blue;
#if FLAGS & ATTENUATE
- span->color.rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
+ span.array->rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
#else
- span->color.rgba[count][ACOMP] = alpha;
+ span.array->rgba[count][ACOMP] = alpha;
#endif /*ATTENUATE*/
#endif /*RGBA*/
count++;
} /*if*/
#else /*SMOOTH*/
/* not smooth (square points) */
- span->xArray[count] = x;
- span->yArray[count] = y;
- span->zArray[count] = z;
+ span.array->x[count] = x;
+ span.array->y[count] = y;
+ span.array->z[count] = z;
#if FLAGS & SPRITE
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
if (ctx->Point.CoordReplace[u]) {
GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size;
GLfloat t = 0.5F - (y + 0.5F - vert->win[1]) / size;
- span->texcoords[u][count][0] = s;
- span->texcoords[u][count][1] = t;
- span->texcoords[u][count][3] = 1.0F;
+ span.array->texcoords[u][count][0] = s;
+ span.array->texcoords[u][count][1] = t;
+ span.array->texcoords[u][count][3] = 1.0F;
if (ctx->Point.SpriteRMode == GL_ZERO)
- span->texcoords[u][count][2] = 0.0F;
+ span.array->texcoords[u][count][2] = 0.0F;
else if (ctx->Point.SpriteRMode == GL_S)
- span->texcoords[u][count][2] = vert->texcoord[u][0];
+ span.array->texcoords[u][count][2] = vert->texcoord[u][0];
else /* GL_R */
- span->texcoords[u][count][2] = vert->texcoord[u][2];
+ span.array->texcoords[u][count][2] = vert->texcoord[u][2];
}
else {
- COPY_4V(span->texcoords[u][count], vert->texcoord[u]);
+ COPY_4V(span.array->texcoords[u][count], vert->texcoord[u]);
}
}
}
#endif /*SMOOTH*/
} /*for x*/
} /*for y*/
- span->end = count;
+ span.end = count;
}
#else /* LARGE | ATTENUATE | SMOOTH | SPRITE */
{
/* size == 1 */
- span->xArray[0] = (GLint) vert->win[0];
- span->yArray[0] = (GLint) vert->win[1];
- span->zArray[0] = (GLint) vert->win[2];
- span->end = 1;
+ span.array->x[0] = (GLint) vert->win[0];
+ span.array->y[0] = (GLint) vert->win[1];
+ span.array->z[0] = (GLint) vert->win[2];
+ span.end = 1;
}
#endif /* LARGE || ATTENUATE || SMOOTH */
- ASSERT(span->end > 0);
+ ASSERT(span.end > 0);
#if FLAGS & (TEXTURE | SPRITE)
if (ctx->Texture._EnabledUnits)
- _mesa_write_texture_span(ctx, span);
+ _mesa_write_texture_span(ctx, &span);
else
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
#elif FLAGS & RGBA
- _mesa_write_rgba_span(ctx, span);
+ _mesa_write_rgba_span(ctx, &span);
#else
- _mesa_write_index_span(ctx, span);
+ _mesa_write_index_span(ctx, &span);
#endif
}
-/* $Id: s_span.c,v 1.45 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: s_span.c,v 1.46 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLint db = span->blueStep;
const GLint da = span->alphaStep;
const GLuint n = span->end;
- GLchan (*rgba)[4] = span->color.rgba;
+ GLchan (*rgba)[4] = span->array->rgba;
GLuint i;
ASSERT((span->interpMask & SPAN_RGBA) &&
color[BCOMP] = FixedToChan(b);
color[ACOMP] = FixedToChan(a);
for (i = 0; i < n; i++) {
- COPY_CHAN4(span->color.rgba[i], color);
+ COPY_CHAN4(span->array->rgba[i], color);
}
}
else {
GLfixed index = span->index;
const GLint indexStep = span->indexStep;
const GLuint n = span->end;
- GLuint *indexes = span->color.index;
+ GLuint *indexes = span->array->index;
GLuint i;
ASSERT((span->interpMask & SPAN_INDEX) &&
!(span->arrayMask & SPAN_INDEX));
}
-/* Fill in the span.specArray array from the interpolation values */
+/* Fill in the span.->array->spec array from the interpolation values */
static void
interpolate_specular(GLcontext *ctx, struct sw_span *span)
{
const GLchan b = FixedToChan(span->specBlue);
GLuint i;
for (i = 0; i < span->end; i++) {
- span->specArray[i][RCOMP] = r;
- span->specArray[i][GCOMP] = g;
- span->specArray[i][BCOMP] = b;
+ span->array->spec[i][RCOMP] = r;
+ span->array->spec[i][GCOMP] = g;
+ span->array->spec[i][BCOMP] = b;
}
}
else {
#endif
GLuint i;
for (i = 0; i < span->end; i++) {
- span->specArray[i][RCOMP] = FixedToChan(r);
- span->specArray[i][GCOMP] = FixedToChan(g);
- span->specArray[i][BCOMP] = FixedToChan(b);
+ span->array->spec[i][RCOMP] = FixedToChan(r);
+ span->array->spec[i][GCOMP] = FixedToChan(g);
+ span->array->spec[i][BCOMP] = FixedToChan(b);
r += span->specRedStep;
g += span->specGreenStep;
b += span->specBlueStep;
if (ctx->Visual.depthBits <= 16) {
GLfixed zval = span->z;
- for (i = 0; i < n; i++) {
- span->zArray[i] = FixedToInt(zval);
+ GLdepth *z = span->array->z;
+ for (i = 0; i < n; i++) {
+ z[i] = FixedToInt(zval);
zval += span->zStep;
}
}
else {
/* Deep Z buffer, no fixed->int shift */
GLfixed zval = span->z;
+ GLdepth *z = span->array->z;
for (i = 0; i < n; i++) {
- span->zArray[i] = zval;
+ z[i] = zval;
zval += span->zStep;
}
}
const struct gl_texture_image *img = obj->Image[obj->BaseLevel];
GLboolean needLambda = (obj->MinFilter != obj->MagFilter);
if (needLambda) {
+ GLfloat (*texcoord)[4] = span->array->texcoords[u];
+ GLfloat *lambda = span->array->lambda[u];
const GLfloat texW = (GLfloat) img->WidthScale;
const GLfloat texH = (GLfloat) img->HeightScale;
const GLfloat dsdx = span->texStepX[u][0];
GLuint i;
for (i = 0; i < span->end; i++) {
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
- span->texcoords[u][i][0] = s * invQ;
- span->texcoords[u][i][1] = t * invQ;
- span->texcoords[u][i][2] = r * invQ;
- span->lambda[u][i] = compute_lambda(dsdx, dsdy, dtdx, dtdy,
- dqdx, dqdy, texW, texH,
- s, t, q, invQ);
+ texcoord[i][0] = s * invQ;
+ texcoord[i][1] = t * invQ;
+ texcoord[i][2] = r * invQ;
+ lambda[i] = compute_lambda(dsdx, dsdy, dtdx, dtdy,
+ dqdx, dqdy, texW, texH,
+ s, t, q, invQ);
s += dsdx;
t += dtdx;
r += drdx;
span->arrayMask |= SPAN_LAMBDA;
}
else {
+ GLfloat (*texcoord)[4] = span->array->texcoords[u];
+ GLfloat *lambda = span->array->lambda[u];
const GLfloat dsdx = span->texStepX[u][0];
const GLfloat dtdx = span->texStepX[u][1];
const GLfloat drdx = span->texStepX[u][2];
/* Ortho projection or polygon's parallel to window X axis */
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
for (i = 0; i < span->end; i++) {
- span->texcoords[u][i][0] = s * invQ;
- span->texcoords[u][i][1] = t * invQ;
- span->texcoords[u][i][2] = r * invQ;
- span->lambda[u][i] = 0.0;
+ texcoord[i][0] = s * invQ;
+ texcoord[i][1] = t * invQ;
+ texcoord[i][2] = r * invQ;
+ lambda[i] = 0.0;
s += dsdx;
t += dtdx;
r += drdx;
else {
for (i = 0; i < span->end; i++) {
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
- span->texcoords[u][i][0] = s * invQ;
- span->texcoords[u][i][1] = t * invQ;
- span->texcoords[u][i][2] = r * invQ;
- span->lambda[u][i] = 0.0;
+ texcoord[i][0] = s * invQ;
+ texcoord[i][1] = t * invQ;
+ texcoord[i][2] = r * invQ;
+ lambda[i] = 0.0;
s += dsdx;
t += dtdx;
r += drdx;
span->arrayMask |= SPAN_TEXTURE;
if (needLambda) {
/* just texture unit 0, with lambda */
+ GLfloat (*texcoord)[4] = span->array->texcoords[0];
+ GLfloat *lambda = span->array->lambda[0];
const GLfloat texW = (GLfloat) img->WidthScale;
const GLfloat texH = (GLfloat) img->HeightScale;
const GLfloat dsdx = span->texStepX[0][0];
GLuint i;
for (i = 0; i < span->end; i++) {
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
- span->lambda[0][i] = compute_lambda(dsdx, dsdy, dtdx, dtdy,
- dqdx, dqdy, texW, texH,
- s, t, q, invQ);
- span->texcoords[0][i][0] = s * invQ;
- span->texcoords[0][i][1] = t * invQ;
- span->texcoords[0][i][2] = r * invQ;
+ lambda[i] = compute_lambda(dsdx, dsdy, dtdx, dtdy,
+ dqdx, dqdy, texW, texH,
+ s, t, q, invQ);
+ texcoord[i][0] = s * invQ;
+ texcoord[i][1] = t * invQ;
+ texcoord[i][2] = r * invQ;
s += dsdx;
t += dtdx;
r += drdx;
}
else {
/* just texture 0, without lambda */
+ GLfloat (*texcoord)[4] = span->array->texcoords[0];
const GLfloat dsdx = span->texStepX[0][0];
const GLfloat dtdx = span->texStepX[0][1];
const GLfloat drdx = span->texStepX[0][2];
/* Ortho projection or polygon's parallel to window X axis */
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
for (i = 0; i < span->end; i++) {
- span->texcoords[0][i][0] = s * invQ;
- span->texcoords[0][i][1] = t * invQ;
- span->texcoords[0][i][2] = r * invQ;
+ texcoord[i][0] = s * invQ;
+ texcoord[i][1] = t * invQ;
+ texcoord[i][2] = r * invQ;
s += dsdx;
t += dtdx;
r += drdx;
else {
for (i = 0; i < span->end; i++) {
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
- span->texcoords[0][i][0] = s * invQ;
- span->texcoords[0][i][1] = t * invQ;
- span->texcoords[0][i][2] = r * invQ;
+ texcoord[i][0] = s * invQ;
+ texcoord[i][1] = t * invQ;
+ texcoord[i][2] = r * invQ;
s += dsdx;
t += dtdx;
r += drdx;
{
const GLuint highbit = 0x80000000;
const GLuint stipple = ctx->PolygonStipple[span->y % 32];
+ GLubyte *mask = span->array->mask;
GLuint i, m;
ASSERT(ctx->Polygon.StippleFlag);
for (i = 0; i < span->end; i++) {
if ((m & stipple) == 0) {
- span->mask[i] = 0;
+ mask[i] = 0;
}
m = m >> 1;
if (m == 0) {
if (span->arrayMask & SPAN_XY) {
/* arrays of x/y pixel coords */
- const GLint *x = span->xArray;
- const GLint *y = span->yArray;
+ const GLint *x = span->array->x;
+ const GLint *y = span->array->y;
const GLint n = span->end;
- GLubyte *mask = span->mask;
+ GLubyte *mask = span->array->mask;
GLint i;
if (span->arrayMask & SPAN_MASK) {
/* note: using & intead of && to reduce branches */
if (x < xmin) {
ASSERT(x + n > xmin);
span->writeAll = GL_FALSE;
- BZERO(span->mask, (xmin - x) * sizeof(GLubyte));
+ BZERO(span->array->mask, (xmin - x) * sizeof(GLubyte));
}
/* Clip to right */
(*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
/* make copy of incoming indexes */
- MEMCPY( indexTmp, span->color.index, span->end * sizeof(GLuint) );
+ MEMCPY( indexTmp, span->array->index, span->end * sizeof(GLuint) );
if (ctx->Color.IndexLogicOpEnabled) {
_mesa_logicop_ci_span(ctx, span, indexTmp);
if (span->arrayMask & SPAN_XY) {
/* array of pixel coords */
(*swrast->Driver.WriteCI32Pixels)(ctx, span->end,
- span->xArray, span->yArray,
- indexTmp, span->mask);
+ span->array->x, span->array->y,
+ indexTmp, span->array->mask);
}
else {
/* horizontal run of pixels */
(*swrast->Driver.WriteCI32Span)(ctx, span->end, span->x, span->y,
- indexTmp, span->mask);
+ indexTmp, span->array->mask);
}
}
}
}
/* make copy of incoming colors */
- MEMCPY( rgbaTmp, span->color.rgba, 4 * span->end * sizeof(GLchan) );
+ MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) );
if (ctx->Color.ColorLogicOpEnabled) {
_mesa_logicop_rgba_span(ctx, span, rgbaTmp);
if (span->arrayMask & SPAN_XY) {
/* array of pixel coords */
(*swrast->Driver.WriteRGBAPixels)(ctx, span->end,
- span->xArray, span->yArray,
+ span->array->x, span->array->y,
(const GLchan (*)[4]) rgbaTmp,
- span->mask);
+ span->array->mask);
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_pixels(ctx, span->end,
- span->xArray, span->yArray,
+ span->array->x, span->array->y,
(const GLchan (*)[4]) rgbaTmp,
- span->mask);
+ span->array->mask);
}
}
else {
/* horizontal run of pixels */
(*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y,
(const GLchan (*)[4]) rgbaTmp,
- span->mask);
+ span->array->mask);
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span(ctx, span->end, span->x, span->y,
(const GLchan (*)[4]) rgbaTmp,
- span->mask);
+ span->array->mask);
}
}
}
span->writeAll = GL_FALSE;
}
else {
- MEMSET(span->mask, 1, span->end);
+ MEMSET(span->array->mask, 1, span->end);
span->writeAll = GL_TRUE;
}
if (span->arrayMask & SPAN_XY) {
GLuint i;
for (i = 0; i < span->end; i++) {
- if (span->mask[i]) {
- assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
- assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
- assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
- assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+ if (span->array->mask[i]) {
+ assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin);
+ assert(span->array->x[i] < ctx->DrawBuffer->_Xmax);
+ assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin);
+ assert(span->array->y[i] < ctx->DrawBuffer->_Ymax);
}
}
}
/* Antialias coverage application */
if (span->arrayMask & SPAN_COVERAGE) {
GLuint i;
- GLuint *index = span->color.index;
+ GLuint *index = span->array->index;
+ GLfloat *coverage = span->array->coverage;
for (i = 0; i < span->end; i++) {
- ASSERT(span->coverage[i] < 16);
- index[i] = (index[i] & ~0xf) | ((GLuint) (span->coverage[i]));
+ ASSERT(coverage[i] < 16);
+ index[i] = (index[i] & ~0xf) | ((GLuint) coverage[i]);
}
}
else {
/* normal situation: draw to exactly one buffer */
if (ctx->Color.IndexLogicOpEnabled) {
- _mesa_logicop_ci_span(ctx, span, span->color.index);
+ _mesa_logicop_ci_span(ctx, span, span->array->index);
}
if (ctx->Color.IndexMask != 0xffffffff) {
- _mesa_mask_index_span(ctx, span, span->color.index);
+ _mesa_mask_index_span(ctx, span, span->array->index);
}
/* write pixels */
if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) {
/* all pixels have same color index */
(*swrast->Driver.WriteMonoCIPixels)(ctx, span->end,
- span->xArray, span->yArray,
+ span->array->x, span->array->y,
FixedToInt(span->index),
- span->mask);
+ span->array->mask);
}
else {
- (*swrast->Driver.WriteCI32Pixels)(ctx, span->end, span->xArray,
- span->yArray, span->color.index,
- span->mask );
+ (*swrast->Driver.WriteCI32Pixels)(ctx, span->end, span->array->x,
+ span->array->y, span->array->index,
+ span->array->mask );
}
}
else {
/* all pixels have same color index */
(*swrast->Driver.WriteMonoCISpan)(ctx, span->end, span->x, span->y,
FixedToInt(span->index),
- span->mask);
+ span->array->mask);
}
else {
(*swrast->Driver.WriteCI32Span)(ctx, span->end, span->x, span->y,
- span->color.index, span->mask);
+ span->array->index,
+ span->array->mask);
}
}
}
ASSERT((span->interpMask | span->arrayMask) & SPAN_Z);
#endif
- /*
- printf("%s() interp 0x%x array 0x%x p=0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask, span->primitive);
- */
-
if (span->arrayMask & SPAN_MASK) {
/* mask was initialized by caller, probably glBitmap */
span->writeAll = GL_FALSE;
}
else {
- MEMSET(span->mask, 1, span->end);
+ MEMSET(span->array->mask, 1, span->end);
span->writeAll = GL_TRUE;
}
if (span->arrayMask & SPAN_XY) {
GLuint i;
for (i = 0; i < span->end; i++) {
- if (span->mask[i]) {
- assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
- assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
- assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
- assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+ if (span->array->mask[i]) {
+ assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin);
+ assert(span->array->x[i] < ctx->DrawBuffer->_Xmax);
+ assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin);
+ assert(span->array->y[i] < ctx->DrawBuffer->_Ymax);
}
}
}
/* Antialias coverage application */
if (span->arrayMask & SPAN_COVERAGE) {
- GLchan (*rgba)[4] = span->color.rgba;
+ GLchan (*rgba)[4] = span->array->rgba;
+ GLfloat *coverage = span->array->coverage;
GLuint i;
for (i = 0; i < span->end; i++) {
- rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * span->coverage[i]);
+ rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]);
}
monoColor = GL_FALSE;
}
else {
/* normal: write to exactly one buffer */
if (ctx->Color.ColorLogicOpEnabled) {
- _mesa_logicop_rgba_span(ctx, span, span->color.rgba);
+ _mesa_logicop_rgba_span(ctx, span, span->array->rgba);
monoColor = GL_FALSE;
}
else if (ctx->Color.BlendEnabled) {
- _mesa_blend_span(ctx, span, span->color.rgba);
+ _mesa_blend_span(ctx, span, span->array->rgba);
monoColor = GL_FALSE;
}
/* Color component masking */
if (colorMask != 0xffffffff) {
- _mesa_mask_rgba_span(ctx, span, span->color.rgba);
+ _mesa_mask_rgba_span(ctx, span, span->array->rgba);
monoColor = GL_FALSE;
}
if (span->arrayMask & SPAN_XY) {
/* array of pixel coords */
/* XXX test for mono color */
- (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->xArray,
- span->yArray, (const GLchan (*)[4]) span->color.rgba, span->mask);
+ (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x,
+ span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask);
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_pixels(ctx, span->end,
- span->xArray, span->yArray,
- (const GLchan (*)[4]) span->color.rgba,
- span->mask);
+ span->array->x, span->array->y,
+ (const GLchan (*)[4]) span->array->rgba,
+ span->array->mask);
}
}
else {
color[BCOMP] = FixedToChan(span->blue);
color[ACOMP] = FixedToChan(span->alpha);
(*swrast->Driver.WriteMonoRGBASpan)(ctx, span->end, span->x,
- span->y, color, span->mask);
+ span->y, color, span->array->mask);
/* XXX software alpha buffer writes! */
}
else {
/* each pixel is a different color */
(*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y,
- (const GLchan (*)[4]) span->color.rgba,
- span->writeAll ? ((const GLubyte *) NULL) : span->mask);
+ (const GLchan (*)[4]) span->array->rgba,
+ span->writeAll ? ((const GLubyte *) NULL) : span->array->mask);
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span(ctx, span->end, span->x, span->y,
- (const GLchan (*)[4]) span->color.rgba,
- span->writeAll ? ((const GLubyte *) NULL) : span->mask);
+ (const GLchan (*)[4]) span->array->rgba,
+ span->writeAll ? ((const GLubyte *) NULL) : span->array->mask);
}
}
}
span->writeAll = GL_FALSE;
}
else {
- MEMSET(span->mask, 1, span->end);
+ MEMSET(span->array->mask, 1, span->end);
span->writeAll = GL_TRUE;
}
if (span->arrayMask & SPAN_XY) {
GLuint i;
for (i = 0; i < span->end; i++) {
- if (span->mask[i]) {
- assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
- assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
- assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
- assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+ if (span->array->mask[i]) {
+ assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin);
+ assert(span->array->x[i] < ctx->DrawBuffer->_Xmax);
+ assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin);
+ assert(span->array->y[i] < ctx->DrawBuffer->_Ymax);
}
}
}
interpolate_specular(ctx, span);
}
ASSERT(span->arrayMask & SPAN_SPEC);
- add_colors( span->end, span->color.rgba, span->specArray );
+ add_colors( span->end, span->array->rgba, span->array->spec );
}
/* Fog */
/* Antialias coverage application */
if (span->arrayMask & SPAN_COVERAGE) {
- GLchan (*rgba)[4] = span->color.rgba;
+ GLchan (*rgba)[4] = span->array->rgba;
+ GLfloat *coverage = span->array->coverage;
GLuint i;
for (i = 0; i < span->end; i++) {
- rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * span->coverage[i]);
+ rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]);
}
}
else {
/* normal: write to exactly one buffer */
if (ctx->Color.ColorLogicOpEnabled) {
- _mesa_logicop_rgba_span(ctx, span, span->color.rgba);
+ _mesa_logicop_rgba_span(ctx, span, span->array->rgba);
}
else if (ctx->Color.BlendEnabled) {
- _mesa_blend_span(ctx, span, span->color.rgba);
+ _mesa_blend_span(ctx, span, span->array->rgba);
}
if (colorMask != 0xffffffff) {
- _mesa_mask_rgba_span(ctx, span, span->color.rgba);
+ _mesa_mask_rgba_span(ctx, span, span->array->rgba);
}
if (span->arrayMask & SPAN_XY) {
/* array of pixel coords */
- (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->xArray,
- span->yArray, (const GLchan (*)[4]) span->color.rgba, span->mask);
+ (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x,
+ span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask);
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_pixels(ctx, span->end,
- span->xArray, span->yArray,
- (const GLchan (*)[4]) span->color.rgba,
- span->mask);
+ span->array->x, span->array->y,
+ (const GLchan (*)[4]) span->array->rgba,
+ span->array->mask);
}
}
else {
/* horizontal run of pixels */
(*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y,
- (const GLchan (*)[4]) span->color.rgba,
- span->writeAll ? NULL : span->mask);
+ (const GLchan (*)[4]) span->array->rgba,
+ span->writeAll ? NULL : span->array->mask);
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span(ctx, span->end, span->x, span->y,
- (const GLchan (*)[4]) span->color.rgba,
- span->writeAll ? NULL : span->mask);
+ (const GLchan (*)[4]) span->array->rgba,
+ span->writeAll ? NULL : span->array->mask);
}
}
}
-/* $Id: s_stencil.c,v 1.24 2002/04/20 17:54:55 brianp Exp $ */
+/* $Id: s_stencil.c,v 1.25 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLuint n = span->end;
const GLint x = span->x;
const GLint y = span->y;
- GLubyte *mask = span->mask;
+ GLubyte *mask = span->array->mask;
ASSERT((span->arrayMask & SPAN_XY) == 0);
ASSERT(ctx->Stencil.Enabled);
stencil_and_ztest_pixels( GLcontext *ctx, struct sw_span *span )
{
const GLuint n = span->end;
- const GLint *x = span->xArray;
- const GLint *y = span->yArray;
- GLubyte *mask = span->mask;
+ const GLint *x = span->array->x;
+ const GLint *y = span->array->y;
+ GLubyte *mask = span->array->mask;
SWcontext *swrast = SWRAST_CONTEXT(ctx);
ASSERT(span->arrayMask & SPAN_XY);
-/* $Id: s_texture.c,v 1.64 2002/06/26 14:56:20 brianp Exp $ */
+/* $Id: s_texture.c,v 1.65 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR)
*/
if (swrast->_AnyTextureCombine)
- MEMCPY(primary_rgba, span->color.rgba, 4 * span->end * sizeof(GLchan));
+ MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan));
/*
* Must do all texture sampling before combining in order to
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
const struct gl_texture_object *curObj = texUnit->_Current;
- GLfloat *lambda = span->lambda[unit];
+ GLfloat *lambda = span->array->lambda[unit];
GLchan (*texels)[4] = (GLchan (*)[4])
(swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan)));
/* Sample the texture (span->end fragments) */
swrast->TextureSample[unit]( ctx, unit, texUnit->_Current,
- span->end, span->texcoords[unit],
+ span->end, span->array->texcoords[unit],
lambda, texels );
}
}
texture_combine( ctx, unit, span->end,
(CONST GLchan (*)[4]) primary_rgba,
swrast->TexelBuffer,
- span->color.rgba );
+ span->array->rgba );
}
else if (texUnit->EnvMode == GL_COMBINE4_NV) {
/* GL_NV_texture_env_combine4 */
texture_combine4( ctx, unit, span->end,
(CONST GLchan (*)[4]) primary_rgba,
swrast->TexelBuffer,
- span->color.rgba );
+ span->array->rgba );
}
else {
/* conventional texture blend */
(span->end * 4 * sizeof(GLchan)));
texture_apply( ctx, texUnit, span->end,
(CONST GLchan (*)[4]) primary_rgba, texels,
- span->color.rgba );
+ span->array->rgba );
}
}
}
-/* $Id: s_triangle.c,v 1.60 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.61 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "s_triangle.h"
-
+/*
+ * Just used for feedback mode.
+ */
GLboolean _mesa_cull_triangle( GLcontext *ctx,
const SWvertex *v0,
const SWvertex *v1,
#define INTERP_FOG 1
#define SETUP_CODE \
- span->interpMask |= SPAN_INDEX; \
- span->index = IntToFixed(v2->index); \
- span->indexStep = 0;
+ span.interpMask |= SPAN_INDEX; \
+ span.index = IntToFixed(v2->index); \
+ span.indexStep = 0;
-#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, span);
+#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span);
#include "s_tritemp.h"
}
#define INTERP_FOG 1
#define INTERP_INDEX 1
-#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, span);
+#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span);
#include "s_tritemp.h"
}
#define SETUP_CODE \
ASSERT(ctx->Texture._EnabledUnits == 0); \
ASSERT(ctx->Light.ShadeModel==GL_FLAT); \
- span->interpMask |= SPAN_RGBA; \
- span->red = ChanToFixed(v2->color[0]); \
- span->green = ChanToFixed(v2->color[1]); \
- span->blue = ChanToFixed(v2->color[2]); \
- span->alpha = ChanToFixed(v2->color[3]); \
- span->redStep = 0; \
- span->greenStep = 0; \
- span->blueStep = 0; \
- span->alphaStep = 0;
-
-#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, span);
+ span.interpMask |= SPAN_RGBA; \
+ span.red = ChanToFixed(v2->color[0]); \
+ span.green = ChanToFixed(v2->color[1]); \
+ span.blue = ChanToFixed(v2->color[2]); \
+ span.alpha = ChanToFixed(v2->color[3]); \
+ span.redStep = 0; \
+ span.greenStep = 0; \
+ span.blueStep = 0; \
+ span.alphaStep = 0;
+
+#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span);
#include "s_tritemp.h"
}
ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \
}
-#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, span);
+#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span);
#include "s_tritemp.h"
#define RENDER_SPAN( span ) \
GLuint i; \
- span->intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
- span->intTex[1] -= FIXED_HALF; \
- for (i = 0; i < span->end; i++) { \
- GLint s = FixedToInt(span->intTex[0]) & smask; \
- GLint t = FixedToInt(span->intTex[1]) & tmask; \
+ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
+ span.intTex[1] -= FIXED_HALF; \
+ for (i = 0; i < span.end; i++) { \
+ GLint s = FixedToInt(span.intTex[0]) & smask; \
+ GLint t = FixedToInt(span.intTex[1]) & tmask; \
GLint pos = (t << twidth_log2) + s; \
pos = pos + pos + pos; /* multiply by 3 */ \
- span->color.rgb[i][RCOMP] = texture[pos]; \
- span->color.rgb[i][GCOMP] = texture[pos+1]; \
- span->color.rgb[i][BCOMP] = texture[pos+2]; \
- span->intTex[0] += span->intTexStep[0]; \
- span->intTex[1] += span->intTexStep[1]; \
+ span.array->rgb[i][RCOMP] = texture[pos]; \
+ span.array->rgb[i][GCOMP] = texture[pos+1]; \
+ span.array->rgb[i][BCOMP] = texture[pos+2]; \
+ span.intTex[0] += span.intTexStep[0]; \
+ span.intTex[1] += span.intTexStep[1]; \
} \
- (*swrast->Driver.WriteRGBSpan)(ctx, span->end, span->x, span->y, \
- (CONST GLchan (*)[3]) span->color.rgb,\
+ (*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y, \
+ (CONST GLchan (*)[3]) span.array->rgb,\
NULL );
#include "s_tritemp.h"
#define RENDER_SPAN( span ) \
GLuint i; \
- span->intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
- span->intTex[1] -= FIXED_HALF; \
- for (i = 0; i < span->end; i++) { \
- const GLdepth z = FixedToDepth(span->z); \
+ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
+ span.intTex[1] -= FIXED_HALF; \
+ for (i = 0; i < span.end; i++) { \
+ const GLdepth z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
- GLint s = FixedToInt(span->intTex[0]) & smask; \
- GLint t = FixedToInt(span->intTex[1]) & tmask; \
+ GLint s = FixedToInt(span.intTex[0]) & smask; \
+ GLint t = FixedToInt(span.intTex[1]) & tmask; \
GLint pos = (t << twidth_log2) + s; \
pos = pos + pos + pos; /* multiply by 3 */ \
- span->color.rgb[i][RCOMP] = texture[pos]; \
- span->color.rgb[i][GCOMP] = texture[pos+1]; \
- span->color.rgb[i][BCOMP] = texture[pos+2]; \
+ span.array->rgb[i][RCOMP] = texture[pos]; \
+ span.array->rgb[i][GCOMP] = texture[pos+1]; \
+ span.array->rgb[i][BCOMP] = texture[pos+2]; \
zRow[i] = z; \
- span->mask[i] = 1; \
+ span.array->mask[i] = 1; \
} \
else { \
- span->mask[i] = 0; \
+ span.array->mask[i] = 0; \
} \
- span->intTex[0] += span->intTexStep[0]; \
- span->intTex[1] += span->intTexStep[1]; \
- span->z += span->zStep; \
+ span.intTex[0] += span.intTexStep[0]; \
+ span.intTex[1] += span.intTexStep[1]; \
+ span.z += span.zStep; \
} \
- (*swrast->Driver.WriteRGBSpan)(ctx, span->end, span->x, span->y, \
- (CONST GLchan (*)[3]) span->color.rgb,\
- span->mask );
+ (*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y, \
+ (CONST GLchan (*)[3]) span.array->rgb,\
+ span.array->mask );
#include "s_tritemp.h"
}
GLuint i;
- GLchan *dest = span->color.rgba[0];
+ GLchan *dest = span->array->rgba[0];
span->intTex[0] -= FIXED_HALF;
span->intTex[1] -= FIXED_HALF;
info.format = obj->Image[b]->Format; \
info.filter = obj->MinFilter; \
info.envmode = unit->EnvMode; \
- span->arrayMask |= SPAN_RGBA; \
+ span.arrayMask |= SPAN_RGBA; \
\
if (info.envmode == GL_BLEND) { \
/* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \
} \
info.tsize = obj->Image[b]->Height * info.tbytesline;
-#define RENDER_SPAN( span ) affine_span(ctx, span, &info);
+#define RENDER_SPAN( span ) affine_span(ctx, &span, &info);
#include "s_tritemp.h"
GLuint i;
GLfloat tex_coord[3], tex_step[3];
- GLchan *dest = span->color.rgba[0];
+ GLchan *dest = span->array->rgba[0];
tex_coord[0] = span->tex[0][0] * (info->smask + 1);
tex_step[0] = span->texStepX[0][0] * (info->smask + 1);
ASSERT(span->arrayMask & SPAN_RGBA);
_mesa_write_rgba_span(ctx, span);
-
#undef SPAN_NEAREST
#undef SPAN_LINEAR
}
info.tsize = obj->Image[b]->Height * info.tbytesline;
#define RENDER_SPAN( span ) \
- span->interpMask &= ~SPAN_RGBA; \
- span->arrayMask |= SPAN_RGBA; \
- fast_persp_span(ctx, span, &info);
+ span.interpMask &= ~SPAN_RGBA; \
+ span.arrayMask |= SPAN_RGBA; \
+ fast_persp_span(ctx, &span, &info);
#include "s_tritemp.h"
#define INTERP_ALPHA 1
#define INTERP_TEX 1
-#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, span);
+#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span);
#include "s_tritemp.h"
}
#define INTERP_SPEC 1
#define INTERP_MULTITEX 1
-#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, span);
+#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span);
#include "s_tritemp.h"
#define RENDER_SPAN( span ) \
GLuint i; \
- for (i = 0; i < span->end; i++) { \
- GLdepth z = FixedToDepth(span->z); \
+ for (i = 0; i < span.end; i++) { \
+ GLdepth z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
ctx->OcclusionResult = GL_TRUE; \
return; \
} \
- span->z += span->zStep; \
+ span.z += span.zStep; \
}
#include "s_tritemp.h"
-/* $Id: s_zoom.c,v 1.16 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_zoom.c,v 1.17 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLuint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
GLchan rgbaSave[MAX_WIDTH][4];
GLuint indexSave[MAX_WIDTH];
- struct sw_span zoomed;
const GLchan (*rgba)[4] = (const GLchan (*)[4]) src;
const GLchan (*rgb)[3] = (const GLchan (*)[3]) src;
const GLuint *indexes = (const GLuint *) src;
+ struct sw_span zoomed;
+ struct span_arrays zoomed_arrays; /* this is big! */
/* no pixel arrays! */
ASSERT((span->arrayMask & SPAN_XY) == 0);
ASSERT(span->primitive == GL_BITMAP);
- INIT_SPAN((&zoomed), GL_BITMAP, 0, 0, 0);
+ INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0);
+ zoomed.array = &zoomed_arrays;
+
if (format == GL_RGBA || format == GL_RGB) {
zoomed.z = span->z;
zoomed.zStep = span->z;
/* common case */
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) {
i = span->end - (j + skipCol) - 1;
- COPY_CHAN4(zoomed.color.rgba[j], rgba[i]);
+ COPY_CHAN4(zoomed.array->rgba[j], rgba[i]);
}
}
else {
i = (GLint) ((j + skipCol) * xscale);
if (i < 0)
i = span->end + i - 1;
- COPY_CHAN4(zoomed.color.rgba[j], rgba[i]);
+ COPY_CHAN4(zoomed.array->rgba[j], rgba[i]);
}
}
}
/* common case */
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) {
i = span->end - (j + skipCol) - 1;
- zoomed.color.rgba[j][0] = rgb[i][0];
- zoomed.color.rgba[j][1] = rgb[i][1];
- zoomed.color.rgba[j][2] = rgb[i][2];
- zoomed.color.rgba[j][3] = CHAN_MAX;
+ zoomed.array->rgba[j][0] = rgb[i][0];
+ zoomed.array->rgba[j][1] = rgb[i][1];
+ zoomed.array->rgba[j][2] = rgb[i][2];
+ zoomed.array->rgba[j][3] = CHAN_MAX;
}
}
else {
i = (GLint) ((j + skipCol) * xscale);
if (i < 0)
i = span->end + i - 1;
- zoomed.color.rgba[j][0] = rgb[i][0];
- zoomed.color.rgba[j][1] = rgb[i][1];
- zoomed.color.rgba[j][2] = rgb[i][2];
- zoomed.color.rgba[j][3] = CHAN_MAX;
+ zoomed.array->rgba[j][0] = rgb[i][0];
+ zoomed.array->rgba[j][1] = rgb[i][1];
+ zoomed.array->rgba[j][2] = rgb[i][2];
+ zoomed.array->rgba[j][3] = CHAN_MAX;
}
}
}
/* common case */
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) {
i = span->end - (j + skipCol) - 1;
- zoomed.color.index[j] = indexes[i];
+ zoomed.array->index[j] = indexes[i];
}
}
else {
i = (GLint) ((j + skipCol) * xscale);
if (i < 0)
i = span->end + i - 1;
- zoomed.color.index[j] = indexes[i];
+ zoomed.array->index[j] = indexes[i];
}
}
}
* going to call _mesa_write_zoomed_span() more than once.
*/
if (r1 - r0 > 1) {
- MEMCPY(rgbaSave, zoomed.color.rgba, zoomed.end * 4 * sizeof(GLchan));
+ MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * 4 * sizeof(GLchan));
}
for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) {
_mesa_write_rgba_span(ctx, &zoomed);
if (r1 - r0 > 1) {
/* restore the colors */
- MEMCPY(zoomed.color.rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan));
+ MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan));
}
}
}
else if (format == GL_COLOR_INDEX) {
if (r1 - r0 > 1) {
- MEMCPY(indexSave, zoomed.color.index, zoomed.end * sizeof(GLuint));
+ MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint));
}
for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) {
_mesa_write_index_span(ctx, &zoomed);
if (r1 - r0 > 1) {
/* restore the colors */
- MEMCPY(zoomed.color.index, indexSave, zoomed.end * sizeof(GLuint));
+ MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint));
}
}
}
_mesa_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span,
GLint y0 )
{
- zoom_span(ctx, span, (const GLvoid *) span->color.index, y0, GL_COLOR_INDEX);
+ zoom_span(ctx, span, (const GLvoid *) span->array->index, y0, GL_COLOR_INDEX);
}
-/* $Id: swrast.h,v 1.25 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: swrast.h,v 1.26 2002/08/07 00:45:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define SPAN_MASK 0x800 /* arrayMask only */
+struct span_arrays {
+ /**
+ * Arrays of fragment values. These will either be computed from the
+ * x/xStep values above or filled in by glDraw/CopyPixels, etc.
+ */
+ GLchan rgb[MAX_WIDTH][3];
+ GLchan rgba[MAX_WIDTH][4];
+ GLuint index[MAX_WIDTH];
+ GLchan spec[MAX_WIDTH][4]; /* specular color */
+ GLint x[MAX_WIDTH]; /**< X/Y used for point/line rendering only */
+ GLint y[MAX_WIDTH]; /**< X/Y used for point/line rendering only */
+ GLdepth z[MAX_WIDTH];
+ GLfloat fog[MAX_WIDTH];
+ GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4];
+ GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH];
+ GLfloat coverage[MAX_WIDTH];
+
+ /** This mask indicates if fragment is alive or culled */
+ GLubyte mask[MAX_WIDTH];
+};
+
+
struct sw_span {
GLint x, y;
/**
* This bitmask (of SPAN_* flags) indicates which of the fragment arrays
- * are relevant.
+ * in the span_arrays struct are relevant.
*/
GLuint arrayMask;
/**
- * Arrays of fragment values. These will either be computed from the
- * x/xStep values above or filled in by glDraw/CopyPixels, etc.
+ * We store the arrays of fragment values in a separate struct so
+ * that we can allocate sw_span structs on the stack without using
+ * a lot of memory. The span_arrays struct is about 400KB while the
+ * sw_span struct is only about 512 bytes.
*/
- union {
- GLchan rgb[MAX_WIDTH][3];
- GLchan rgba[MAX_WIDTH][4];
- GLuint index[MAX_WIDTH];
- } color;
- GLchan specArray[MAX_WIDTH][4];
- GLint xArray[MAX_WIDTH]; /**< X/Y used for point/line rendering only */
- GLint yArray[MAX_WIDTH]; /**< X/Y used for point/line rendering only */
- GLdepth zArray[MAX_WIDTH];
- GLfloat fogArray[MAX_WIDTH];
- GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4];
- GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH];
- GLfloat coverage[MAX_WIDTH];
-
- /** This mask indicates if fragment is alive or culled */
- GLubyte mask[MAX_WIDTH];
+ struct span_arrays *array;
};
-#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \
-do { \
- S->primitive = (PRIMITIVE); \
- S->interpMask = (INTERP_MASK); \
- S->arrayMask = (ARRAY_MASK); \
- S->start = 0; \
- S->end = (END); \
+#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \
+do { \
+ (S).primitive = (PRIMITIVE); \
+ (S).interpMask = (INTERP_MASK); \
+ (S).arrayMask = (ARRAY_MASK); \
+ (S).start = 0; \
+ (S).end = (END); \
+ (S).array = SWRAST_CONTEXT(ctx)->span_data; \
} while (0)