summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/swrast.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-08-07 00:45:07 +0000
committerBrian Paul <[email protected]>2002-08-07 00:45:07 +0000
commit77df88727cb0a423dd5cb41498c2302d9df4fce7 (patch)
tree98234cef23e87e196b3628095196daed47bf6dce /src/mesa/swrast/swrast.h
parent2353e96c320d4bd26d10dc29b57df3e9f882e6d3 (diff)
struct sw_span is again allocated on the stack, but the arrays of span
data are broken out into a new struct span_arrays which is allocated per-context (to avoid huge stack allocations - a problem on Windows). This lets us use span.redStep instead of span->redStep (for example) to hopefully get slightly better performance in the triangle functions.
Diffstat (limited to 'src/mesa/swrast/swrast.h')
-rw-r--r--src/mesa/swrast/swrast.h64
1 files changed, 37 insertions, 27 deletions
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index a33e97ec017..493534c4bab 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -1,4 +1,4 @@
-/* $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
@@ -112,6 +112,28 @@ typedef struct {
#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;
@@ -158,40 +180,28 @@ struct sw_span {
/**
* 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)