Merge commit 'origin/mesa_7_7_branch'
[mesa.git] / src / mesa / drivers / glide / fxdrv.h
index c246444d1c35466e1030fe51a3f947e2f4a1b99a..bee10de2f49088f35ac6af025cb9ce3e3e96fbfa 100644 (file)
 #include <signal.h>
 #endif
 
-#include "context.h"
-#include "imports.h"
-#include "macros.h"
-#include "matrix.h"
-#include "mtypes.h"
+#include "main/context.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/matrix.h"
+#include "main/mtypes.h"
 
 #include "GL/fxmesa.h"
 #include "fxglidew.h"
@@ -60,6 +60,8 @@
 #include "math/m_vector.h"
 
 
+#define COPY_FLOAT(dst, src)    (dst) = (src)
+
 /* Define some shorter names for these things.
  */
 #define XCOORD   GR_VERTEX_X_OFFSET
@@ -447,12 +449,12 @@ struct tfxMesaContext
 
    tfxUnitsState unitsState;
    tfxUnitsState restoreUnitsState;    /* saved during multipass */
-
+   GLboolean multipass;                        /* true when drawing intermediate pass */
 
    GLuint new_state;
    GLuint new_gl_state;
 
-   /* Texture Memory Manager Data 
+   /* Texture Memory Manager Data
     */
    GLuint texBindNumber;
    GLint tmuSrc;
@@ -483,7 +485,7 @@ struct tfxMesaContext
    GLenum render_primitive;
    GLenum raster_primitive;
 
-   /* Current rasterization functions 
+   /* Current rasterization functions
     */
    fx_point_func draw_point;
    fx_line_func draw_line;
@@ -556,7 +558,7 @@ extern void fxAllocVB(GLcontext * ctx);
 extern void fxFreeVB(GLcontext * ctx);
 extern void fxPrintSetupFlags(char *msg, GLuint flags );
 extern void fxCheckTexSizes( GLcontext *ctx );
-extern void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
+extern void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint end,
                             GLuint newinputs );
 extern void fxChooseVertexState( GLcontext *ctx );
 
@@ -642,9 +644,9 @@ extern void fxDDBlendFuncSeparate(GLcontext *, GLenum, GLenum, GLenum, GLenum);
 extern void fxDDBlendEquationSeparate(GLcontext *, GLenum, GLenum);
 extern void fxDDDepthMask(GLcontext *, GLboolean);
 extern void fxDDDepthFunc(GLcontext *, GLenum);
-extern void fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
-extern void fxDDStencilMask (GLcontext *ctx, GLuint mask);
-extern void fxDDStencilOp (GLcontext *ctx, GLenum sfail, GLenum zfail, GLenum zpass);
+extern void fxDDStencilFuncSeparate (GLcontext *ctx, GLenum face, GLenum func, GLint ref, GLuint mask);
+extern void fxDDStencilMaskSeparate (GLcontext *ctx, GLenum face, GLuint mask);
+extern void fxDDStencilOpSeparate (GLcontext *ctx, GLenum face, GLenum sfail, GLenum zfail, GLenum zpass);
 
 extern void fxDDInitExtensions(GLcontext * ctx);
 
@@ -674,18 +676,18 @@ extern void fxDDColorMask(GLcontext * ctx,
                          GLboolean r, GLboolean g, GLboolean b, GLboolean a);
 
 extern void fxDDWriteDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
-                              const GLdepth depth[], const GLubyte mask[]);
+                              const GLuint depth[], const GLubyte mask[]);
 
 extern void fxDDReadDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
-                             GLdepth depth[]);
+                             GLuint depth[]);
 
 extern void fxDDWriteDepthPixels(GLcontext * ctx, GLuint n,
                                 const GLint x[], const GLint y[],
-                                const GLdepth depth[], const GLubyte mask[]);
+                                const GLuint depth[], const GLubyte mask[]);
 
 extern void fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
                                const GLint x[], const GLint y[],
-                               GLdepth depth[]);
+                               GLuint depth[]);
 
 extern void fxDDShadeModel(GLcontext * ctx, GLenum mode);
 
@@ -715,6 +717,7 @@ void fxSetupBlend (GLcontext *ctx);
 void fxSetupDepthTest (GLcontext *ctx);
 void fxSetupTexture (GLcontext *ctx);
 void fxSetupStencil (GLcontext *ctx);
+void fxSetupStencilFace (GLcontext *ctx, GLint face);
 
 /* Flags for software fallback cases */
 #define FX_FALLBACK_TEXTURE_MAP                0x0001
@@ -731,6 +734,28 @@ void fxSetupStencil (GLcontext *ctx);
 
 extern GLuint fx_check_IsInHardware(GLcontext *ctx);
 
+/***
+ *** CNORM: clamp float to [0,1] and map to float in [0,255]
+ ***/
+#if defined(USE_IEEE) && !defined(DEBUG)
+#define IEEE_0996 0x3f7f0000   /* 0.996 or so */
+#define CNORM(N, F)                            \
+        do {                                   \
+           fi_type __tmp;                      \
+           __tmp.f = (F);                      \
+           if (__tmp.i < 0)                    \
+              N = 0;                           \
+           else if (__tmp.i >= IEEE_0996)      \
+              N = 255.0f;                      \
+           else {                              \
+              N = (F) * 255.0f;                        \
+           }                                   \
+        } while (0)
+#else
+#define CNORM(n, f) \
+       n = (CLAMP((f), 0.0F, 1.0F) * 255.0F)
+#endif
+
 /* run-time debugging */
 #ifndef FX_DEBUG
 #define FX_DEBUG 0