OSDN Git Service

Change zLeft and zval to GLuint. Seems to fix 32-bit Z computation
authorBrian Paul <brian.paul@tungstengraphics.com>
Tue, 20 Sep 2005 04:34:29 +0000 (04:34 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Tue, 20 Sep 2005 04:34:29 +0000 (04:34 +0000)
src/mesa/swrast/s_span.c
src/mesa/swrast/s_tritemp.h

index a9f6684..50463f4 100644 (file)
@@ -321,7 +321,7 @@ _swrast_span_interpolate_z( const GLcontext *ctx, struct sw_span *span )
    }
    else {
       /* Deep Z buffer, no fixed->int shift */
-      GLfixed zval = span->z;
+      GLuint zval = span->z;
       GLdepth *z = span->array->z;
       for (i = 0; i < n; i++) {
          z[i] = zval;
index fe19a33..d32a86b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.1
+ * Version:  6.5
  *
- * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -693,7 +693,8 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
          DEPTH_TYPE *zRow = NULL;
          GLint dZRowOuter = 0, dZRowInner;  /* offset in bytes */
 #  endif
-         GLfixed zLeft = 0, fdzOuter = 0, fdzInner;
+         GLuint zLeft = 0;
+         GLfixed fdzOuter = 0, fdzInner;
 #endif
 #ifdef INTERP_W
          GLfloat wLeft = 0, dwOuter = 0, dwInner;
@@ -841,7 +842,8 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
                   GLfloat z0 = vLower->win[2];
                   if (depthBits <= 16) {
                      /* interpolate fixed-pt values */
-                     GLfloat tmp = (z0 * FIXED_SCALE + span.dzdx * adjx + span.dzdy * adjy) + FIXED_HALF;
+                     GLfloat tmp = (z0 * FIXED_SCALE + span.dzdx * adjx
+                                    + span.dzdy * adjy) + FIXED_HALF;
                      if (tmp < MAX_GLUINT / 2)
                         zLeft = (GLfixed) tmp;
                      else
@@ -849,8 +851,9 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
                      fdzOuter = SignedFloatToFixed(span.dzdy + dxOuter * span.dzdx);
                   }
                   else {
-                     /* interpolate depth values exactly */
-                     zLeft = (GLint) (z0 + span.dzdx * FixedToFloat(adjx) + span.dzdy * FixedToFloat(adjy));
+                     /* interpolate depth values w/out scaling */
+                     zLeft = (GLuint) (z0 + span.dzdx * FixedToFloat(adjx)
+                                       + span.dzdy * FixedToFloat(adjy));
                      fdzOuter = (GLint) (span.dzdy + dxOuter * span.dzdx);
                   }
 #  ifdef DEPTH_TYPE