From 7265556b9aa0367e9b5031e7cb15ed2a5d73866d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 20 Sep 2005 04:34:29 +0000 Subject: Change zLeft and zval to GLuint. Seems to fix 32-bit Z computation --- src/mesa/swrast/s_span.c | 2 +- src/mesa/swrast/s_tritemp.h | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index a9f6684a72..50463f4c61 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 fe19a3363f..d32a86bb88 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 -- cgit v1.2.3