From: Brian Paul Date: Tue, 20 Sep 2005 04:34:29 +0000 (+0000) Subject: Change zLeft and zval to GLuint. Seems to fix 32-bit Z computation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7265556b9aa0367e9b5031e7cb15ed2a5d73866d;p=mesa.git Change zLeft and zval to GLuint. Seems to fix 32-bit Z computation --- diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index a9f6684a72b..50463f4c61a 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -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; diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index fe19a3363f9..d32a86bb88f 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -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