mesa/main: use call_once instead of open-coding
[mesa.git] / src / mesa / swrast / s_tritemp.h
index 0948e7d749902c595919e51021f061be3461bff7..4dc42a80a729a16594a89c1fb810870a731f6f51 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.0
  *
  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /*
  * SUB_PIXEL_BITS.
  */
 
+#include "util/u_math.h"
+
+#ifndef MAX_GLUINT
+#define MAX_GLUINT     0xffffffffu
+#endif
+
 
 /*
  * Some code we unfortunately need to prevent negative interpolated colors.
@@ -151,7 +157,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
 #endif
 
    /*
-   printf("%s()\n", __FUNCTION__);
+   printf("%s()\n", __func__);
    printf("  %g, %g, %g\n",
           v0->attrib[VARYING_SLOT_POS][0],
           v0->attrib[VARYING_SLOT_POS][1],
@@ -234,10 +240,10 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
    {
       const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
 
-      if (IS_INF_OR_NAN(area) || area == 0.0F)
+      if (util_is_inf_or_nan(area) || area == 0.0F)
          return;
 
-      if (area * bf * swrast->_BackfaceCullSign < 0.0)
+      if (area * bf * swrast->_BackfaceCullSign < 0.0F)
          return;
 
       oneOverArea = 1.0F / area;
@@ -380,7 +386,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
 #  endif /* INTERP_ALPHA */
       }
       else {
-         ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+         assert(ctx->Light.ShadeModel == GL_FLAT);
          span.interpMask |= SPAN_FLAT;
          span.attrStepX[VARYING_SLOT_COL0][0] = span.attrStepY[VARYING_SLOT_COL0][0] = 0.0F;
          span.attrStepX[VARYING_SLOT_COL0][1] = span.attrStepY[VARYING_SLOT_COL0][1] = 0.0F;
@@ -662,7 +668,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
 #  endif
                }
                else {
-                  ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+                  assert(ctx->Light.ShadeModel == GL_FLAT);
                   rLeft = ChanToFixed(v2->color[RCOMP]);
                   gLeft = ChanToFixed(v2->color[GCOMP]);
                   bLeft = ChanToFixed(v2->color[BCOMP]);