s_span.h revision f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3
1e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
2e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Mesa 3-D graphics library
367074332728acba86da7630353673b458713bb8aBrian Paul * Version:  6.5
45e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen *
5e4b2356c07d31fbeeabb13b2fb47db703b473080Brian Paul * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
65e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen *
7e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
8e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * copy of this software and associated documentation files (the "Software"),
9e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * to deal in the Software without restriction, including without limitation
10e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * and/or sell copies of the Software, and to permit persons to whom the
12e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Software is furnished to do so, subject to the following conditions:
135e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen *
14e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * The above copyright notice and this permission notice shall be included
15e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * in all copies or substantial portions of the Software.
165e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen *
17e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
24e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
25e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
26e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifndef S_SPAN_H
27e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define S_SPAN_H
28e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
29e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
305e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen#include "mtypes.h"
31e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "swrast.h"
32e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
33e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
343866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian/**
35f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian * \defgroup SpanFlags
363866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * Bitflags used for interpMask and arrayMask fields below to indicate
373866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * which interpolant values and fragment arrays are in use, respectively.
383866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian */
393866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian/*@{*/
403866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_RGBA         0x001
413866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_SPEC         0x002
423866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_INDEX        0x004
433866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_Z            0x008
443866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_W            0x010
453866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_FOG          0x020
463866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_TEXTURE      0x040
473866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_INT_TEXTURE  0x080
483866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_LAMBDA       0x100
493866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_COVERAGE     0x200
503866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_FLAT         0x400  /**< flat shading? */
513866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_XY           0x800
523866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_MASK        0x1000
533866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define SPAN_VARYING     0x2000
543866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian/*@}*/
553866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
563866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
573866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#if 0
583866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian/* alternate arrangement for code below */
593866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrianstruct arrays2 {
603866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   union {
613866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian      GLubyte  sz1[MAX_WIDTH][4]; /* primary color */
623866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian      GLushort sz2[MAX_WIDTH][4];
633866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   } rgba;
643866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   union {
653866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian      GLubyte  sz1[MAX_WIDTH][4]; /* specular color and temp storage */
663866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian      GLushort sz2[MAX_WIDTH][4];
673866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   } spec;
683866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian};
693866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#endif
703866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
713866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
723866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
733866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian/**
743866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * \sw_span_arrays
753866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * \brief Arrays of fragment values.
763866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian *
773866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * These will either be computed from the span x/xStep values or
783866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * filled in by glDraw/CopyPixels, etc.
793866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * These arrays are separated out of sw_span to conserve memory.
803866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian */
81f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Briantypedef struct sw_span_arrays
82f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian{
83f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian   /** Per-fragment attributes (indexed by FRAG_ATTRIB_* tokens) */
84f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian   GLfloat attribs[FRAG_ATTRIB_MAX][MAX_WIDTH][4];
85f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian
86f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian   /** This mask indicates which fragments are alive or culled */
87f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian   GLubyte mask[MAX_WIDTH];
88f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian
893866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLenum ChanType; /**< Color channel type, GL_UNSIGNED_BYTE, GL_FLOAT */
903866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   union {
913866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian      struct {
923866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian         GLubyte rgba[MAX_WIDTH][4]; /**< primary color */
933866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian         GLubyte spec[MAX_WIDTH][4]; /**< specular color and temp storage */
943866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian      } sz1;
953866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian      struct {
963866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian         GLushort rgba[MAX_WIDTH][4];
973866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian         GLushort spec[MAX_WIDTH][4];
983866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian      } sz2;
993866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   } color;
1003866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /** XXX these are temporary fields, pointing into above color arrays */
1013866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLchan (*rgba)[4];
1023866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLchan (*spec)[4];
1033866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1043866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLint   x[MAX_WIDTH];  /**< fragment X coords */
1053866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLint   y[MAX_WIDTH];  /**< fragment Y coords */
1063866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLuint  z[MAX_WIDTH];  /**< fragment Z coords */
1073866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLuint  index[MAX_WIDTH];  /**< Color indexes */
108f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian   GLfloat lambda[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH]; /**< Texture LOD */
1093866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat coverage[MAX_WIDTH];  /**< Fragment coverage for AA/smoothing */
1103866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian} SWspanarrays;
1113866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1123866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1133866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian/**
1143866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * The SWspan structure describes the colors, Z, fogcoord, texcoords,
1153866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * etc for either a horizontal run or an array of independent pixels.
1163866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * We can either specify a base/step to indicate interpolated values, or
1173866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * fill in explicit arrays of values.  The interpMask and arrayMask bitfields
1183866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * indicate which attributes are active interpolants or arrays, respectively.
1193866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian *
1203866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * It would be interesting to experiment with multiprocessor rasterization
1213866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * with this structure.  The triangle rasterizer could simply emit a
1223866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * stream of these structures which would be consumed by one or more
1233866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian * span-processing threads which could run in parallel.
1243866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian */
125f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Briantypedef struct sw_span
126f3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3Brian{
1273866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLint x, y;
1283866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1293866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /** Only need to process pixels between start <= i < end */
1303866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /** At this time, start is always zero. */
1313866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLuint start, end;
1323866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1333866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /** This flag indicates that mask[] array is effectively filled with ones */
1343866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLboolean writeAll;
1353866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1363866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */
1373866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLenum primitive;
1383866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1393866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /** 0 = front-facing span, 1 = back-facing span (for two-sided stencil) */
1403866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLuint facing;
1413866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1423866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /**
1433866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * This bitmask (of  \link SpanFlags SPAN_* flags\endlink) indicates
1443866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * which of the x/xStep variables are relevant.
1453866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    */
1463866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLbitfield interpMask;
1473866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1483866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /* For horizontal spans, step is the partial derivative wrt X.
1493866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * For lines, step is the delta from one fragment to the next.
1503866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    */
1513866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#if CHAN_TYPE == GL_FLOAT
1523866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat red, redStep;
1533866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat green, greenStep;
1543866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat blue, blueStep;
1553866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat alpha, alphaStep;
1563866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat specRed, specRedStep;
1573866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat specGreen, specGreenStep;
1583866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat specBlue, specBlueStep;
1593866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT */
1603866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed red, redStep;
1613866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed green, greenStep;
1623866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed blue, blueStep;
1633866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed alpha, alphaStep;
1643866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed specRed, specRedStep;
1653866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed specGreen, specGreenStep;
1663866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed specBlue, specBlueStep;
1673866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#endif
1683866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed index, indexStep;
1693866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed z, zStep;    /* XXX z should probably be GLuint */
1703866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat fog, fogStep;
1713866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat tex[MAX_TEXTURE_COORD_UNITS][4];  /* s, t, r, q */
1723866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat texStepX[MAX_TEXTURE_COORD_UNITS][4];
1733866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat texStepY[MAX_TEXTURE_COORD_UNITS][4];
1743866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfixed intTex[2], intTexStep[2];  /* s, t only */
1753866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat var[MAX_VARYING][4];
1763866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat varStepX[MAX_VARYING][4];
1773866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat varStepY[MAX_VARYING][4];
1783866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1793866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /* partial derivatives wrt X and Y. */
1803866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat dzdx, dzdy;
1813866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat w, dwdx, dwdy;
1823866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat drdx, drdy;
1833866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat dgdx, dgdy;
1843866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat dbdx, dbdy;
1853866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat dadx, dady;
1863866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat dsrdx, dsrdy;
1873866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat dsgdx, dsgdy;
1883866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat dsbdx, dsbdy;
1893866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLfloat dfogdx, dfogdy;
1903866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1913866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /**
1923866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates
1933866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * which of the fragment arrays in the span_arrays struct are relevant.
1943866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    */
1953866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   GLbitfield arrayMask;
1963866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
1973866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   /**
1983866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * We store the arrays of fragment values in a separate struct so
1993866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * that we can allocate sw_span structs on the stack without using
2003866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * a lot of memory.  The span_arrays struct is about 1.4MB while the
2013866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    * sw_span struct is only about 512 bytes.
2023866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian    */
2033866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   SWspanarrays *array;
2043866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian} SWspan;
2053866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
2063866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
2073866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
2083866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK)	\
2093866558c9840f9c4fed6ac0bd2994ccc67f40f7fBriando {								\
2103866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   (S).primitive = (PRIMITIVE);					\
2113866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   (S).interpMask = (INTERP_MASK);				\
2123866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   (S).arrayMask = (ARRAY_MASK);				\
2133866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   (S).start = 0;						\
2143866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   (S).end = (END);						\
2153866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   (S).facing = 0;						\
2163866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian   (S).array = SWRAST_CONTEXT(ctx)->SpanArrays;			\
2173866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian} while (0)
2183866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
2193866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
2203866558c9840f9c4fed6ac0bd2994ccc67f40f7fBrian
2215071b0812fc73bcba92e2b6fcbad2f53f063fc32Brian Paulextern void
222cdb27e8242215271364602995d85607cfc06d441Brian Paul_swrast_span_default_z( GLcontext *ctx, SWspan *span );
223e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
2245071b0812fc73bcba92e2b6fcbad2f53f063fc32Brian Paulextern void
225cdb27e8242215271364602995d85607cfc06d441Brian Paul_swrast_span_interpolate_z( const GLcontext *ctx, SWspan *span );
226711e27fda27e4235b20a4cf73c2767c984ab2b81Brian Paul
227711e27fda27e4235b20a4cf73c2767c984ab2b81Brian Paulextern void
228cdb27e8242215271364602995d85607cfc06d441Brian Paul_swrast_span_default_fog( GLcontext *ctx, SWspan *span );
2292a182a98973edc9ecf2936b1288485bb2b3fa722Brian Paul
2302a182a98973edc9ecf2936b1288485bb2b3fa722Brian Paulextern void
231cdb27e8242215271364602995d85607cfc06d441Brian Paul_swrast_span_default_color( GLcontext *ctx, SWspan *span );
232e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
2334753d60dd070bb08d0116076bcc08025c86ce857Brian Paulextern void
234cdb27e8242215271364602995d85607cfc06d441Brian Paul_swrast_span_default_texcoords( GLcontext *ctx, SWspan *span );
23510f30eb43835c57c00783390a02d72daf4f78e26Brian Paul
236350353adcd75f94fda63c787c86961716114e0bfBrian Paulextern GLfloat
23745bc887da226403f2c41077e40ca38b6f60f1359Brian Paul_swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
238a803b0c891404dcd7c376e91f6a033cd4e42abc3Brian Paul                       GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
239a803b0c891404dcd7c376e91f6a033cd4e42abc3Brian Paul                       GLfloat s, GLfloat t, GLfloat q, GLfloat invQ);
240350353adcd75f94fda63c787c86961716114e0bfBrian Paul
24110f30eb43835c57c00783390a02d72daf4f78e26Brian Paulextern void
242cdb27e8242215271364602995d85607cfc06d441Brian Paul_swrast_write_index_span( GLcontext *ctx, SWspan *span);
243b7f5e92f1749ce4601a758f66ddc64959f11742bBrian Paul
24410f30eb43835c57c00783390a02d72daf4f78e26Brian Paul
24510f30eb43835c57c00783390a02d72daf4f78e26Brian Paulextern void
246cdb27e8242215271364602995d85607cfc06d441Brian Paul_swrast_write_rgba_span( GLcontext *ctx, SWspan *span);
247b7f5e92f1749ce4601a758f66ddc64959f11742bBrian Paul
248e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
2495071b0812fc73bcba92e2b6fcbad2f53f063fc32Brian Paulextern void
25076e778dce59aa6f290db50242df945943fc47b05Brian Paul_swrast_read_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
25176e778dce59aa6f290db50242df945943fc47b05Brian Paul                       GLuint n, GLint x, GLint y, GLenum type, GLvoid *rgba);
252e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
2535071b0812fc73bcba92e2b6fcbad2f53f063fc32Brian Paulextern void
254e4b2356c07d31fbeeabb13b2fb47db703b473080Brian Paul_swrast_read_index_span( GLcontext *ctx, struct gl_renderbuffer *rb,
255a803b0c891404dcd7c376e91f6a033cd4e42abc3Brian Paul                         GLuint n, GLint x, GLint y, GLuint indx[] );
256e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
25767074332728acba86da7630353673b458713bb8aBrian Paulextern void
25867074332728acba86da7630353673b458713bb8aBrian Paul_swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb,
25967074332728acba86da7630353673b458713bb8aBrian Paul                   GLuint count, const GLint x[], const GLint y[],
26067074332728acba86da7630353673b458713bb8aBrian Paul                   void *values, GLuint valueSize);
26167074332728acba86da7630353673b458713bb8aBrian Paul
2623fd819aef8139761ce86cb8d763de83a11c81b33Brian Paulextern void
2633fd819aef8139761ce86cb8d763de83a11c81b33Brian Paul_swrast_put_row(GLcontext *ctx, struct gl_renderbuffer *rb,
2643fd819aef8139761ce86cb8d763de83a11c81b33Brian Paul                GLuint count, GLint x, GLint y,
2653fd819aef8139761ce86cb8d763de83a11c81b33Brian Paul                const GLvoid *values, GLuint valueSize);
2663fd819aef8139761ce86cb8d763de83a11c81b33Brian Paul
267f493a04be0e004bb07f84b2e28124ed8cb6a9b38Brian Paulextern void
268f493a04be0e004bb07f84b2e28124ed8cb6a9b38Brian Paul_swrast_get_row(GLcontext *ctx, struct gl_renderbuffer *rb,
269f493a04be0e004bb07f84b2e28124ed8cb6a9b38Brian Paul                GLuint count, GLint x, GLint y,
270f493a04be0e004bb07f84b2e28124ed8cb6a9b38Brian Paul                GLvoid *values, GLuint valueSize);
271f493a04be0e004bb07f84b2e28124ed8cb6a9b38Brian Paul
272a50b7dbc3ba1db8c92b4bbb4f7f06de8d6c039c4Brian Paul
273a50b7dbc3ba1db8c92b4bbb4f7f06de8d6c039c4Brian Paulextern void *
274a50b7dbc3ba1db8c92b4bbb4f7f06de8d6c039c4Brian Paul_swrast_get_dest_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
275cdb27e8242215271364602995d85607cfc06d441Brian Paul                      SWspan *span);
276a50b7dbc3ba1db8c92b4bbb4f7f06de8d6c039c4Brian Paul
277e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
278