s/BlendEquatioRGB/BlendEquationRGB/
[mesa.git] / src / mesa / swrast / s_context.h
index 2be1545c8f33c09edeb947afcf33416dba1534a5..6dc8b13b0e7b5de3f72c549177db97b7d22a6646 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id: s_context.h,v 1.24 2003/02/23 04:10:54 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
  * Version:  5.1
 #include "swrast.h"
 
 
-/**
- * \struct sw_span
- * \brief Contains data for either a horizontal line or a set of
- * pixels that are passed through a pipeline of functions before being
- * drawn.
- *
- * The sw_span structure describes the colors, Z, fogcoord, texcoords,
- * etc for either a horizontal run or a set of independent pixels.  We
- * can either specify a base/step to indicate interpolated values, or
- * fill in arrays of values.  The interpMask and arrayMask bitfields
- * indicate which are active.
- *
- * With this structure it's easy to hand-off span rasterization to
- * subroutines instead of doing it all inline in the triangle functions
- * like we used to do.
- * It also cleans up the local variable namespace a great deal.
- *
- * It would be interesting to experiment with multiprocessor rasterization
- * with this structure.  The triangle rasterizer could simply emit a
- * stream of these structures which would be consumed by one or more
- * span-processing threads which could run in parallel.
- */
-
-
 /**
  * \defgroup SpanFlags SPAN_XXX-flags
  * Bitmasks to indicate which span_arrays need to be computed
@@ -111,6 +85,28 @@ struct span_arrays {
 };
 
 
+/**
+ * \struct sw_span
+ * \brief Contains data for either a horizontal line or a set of
+ * pixels that are passed through a pipeline of functions before being
+ * drawn.
+ *
+ * The sw_span structure describes the colors, Z, fogcoord, texcoords,
+ * etc for either a horizontal run or an array of independent pixels.
+ * We can either specify a base/step to indicate interpolated values, or
+ * fill in arrays of values.  The interpMask and arrayMask bitfields
+ * indicate which are active.
+ *
+ * With this structure it's easy to hand-off span rasterization to
+ * subroutines instead of doing it all inline in the triangle functions
+ * like we used to do.
+ * It also cleans up the local variable namespace a great deal.
+ *
+ * It would be interesting to experiment with multiprocessor rasterization
+ * with this structure.  The triangle rasterizer could simply emit a
+ * stream of these structures which would be consumed by one or more
+ * span-processing threads which could run in parallel.
+ */
 struct sw_span {
    GLint x, y;
 
@@ -133,6 +129,9 @@ struct sw_span {
     */
    GLuint interpMask;
 
+   /* For horizontal spans, step is the partial derivative wrt X.
+    * For lines, step is the delta from one fragment to the next.
+    */
 #if CHAN_TYPE == GL_FLOAT
    GLfloat red, redStep;
    GLfloat green, greenStep;
@@ -141,7 +140,7 @@ struct sw_span {
    GLfloat specRed, specRedStep;
    GLfloat specGreen, specGreenStep;
    GLfloat specBlue, specBlueStep;
-#else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED SHORT */
+#else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT */
    GLfixed red, redStep;
    GLfixed green, greenStep;
    GLfixed blue, blueStep;
@@ -158,6 +157,18 @@ struct sw_span {
    GLfloat texStepY[MAX_TEXTURE_COORD_UNITS][4];
    GLfixed intTex[2], intTexStep[2];  /* s, t only */
 
+   /* partial derivatives wrt X and Y. */
+   GLfloat dzdx, dzdy;
+   GLfloat w, dwdx, dwdy;
+   GLfloat drdx, drdy;
+   GLfloat dgdx, dgdy;
+   GLfloat dbdx, dbdy;
+   GLfloat dadx, dady;
+   GLfloat dsrdx, dsrdy;
+   GLfloat dsgdx, dsgdy;
+   GLfloat dsbdx, dsbdy;
+   GLfloat dfogdx, dfogdy;
+
    /**
     * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates
     * which of the fragment arrays in the span_arrays struct are relevant.
@@ -191,14 +202,9 @@ typedef void (*texture_sample_func)(GLcontext *ctx, GLuint texUnit,
                                     GLuint n, const GLfloat texcoords[][4],
                                     const GLfloat lambda[], GLchan rgba[][4]);
 
-#ifdef USE_MMX_ASM
 typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n,
                                     const GLubyte mask[],
                                     GLchan src[][4], CONST GLchan dst[][4] );
-#else
-typedef void (*blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[],
-                            GLchan src[][4], CONST GLchan dst[][4] );
-#endif
 
 typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *);
 
@@ -227,6 +233,7 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
                                         /**< buffer or no buffers. */
 #define OCCLUSION_BIT           0x800   /**< GL_HP_occlusion_test enabled */
 #define TEXTURE_BIT            0x1000  /**< Texturing really enabled */
+#define FRAGPROG_BIT            0x2000  /**< Fragment program enabled */
 /*@}*/
 
 #define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS|  \
@@ -234,6 +241,7 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
                                _NEW_COLOR|     \
                                _NEW_DEPTH|     \
                                _NEW_FOG|       \
+                                _NEW_PROGRAM|   \
                                _NEW_STENCIL|   \
                                _NEW_TEXTURE|   \
                                _NEW_VIEWPORT|  \
@@ -261,7 +269,7 @@ typedef struct
     */
    GLuint _RasterMask;
    GLfloat _MinMagThresh[MAX_TEXTURE_IMAGE_UNITS];
-   GLfloat _backface_sign;
+   GLfloat _BackfaceSign;
    GLboolean _PreferPixelFog;
    GLboolean _AnyTextureCombine;