summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-11-07 14:40:38 -0700
committerBrian <[email protected]>2007-11-07 14:40:38 -0700
commit187b631b6b3c504fa334e33f4b1af433b6232bac (patch)
treec396b044323a4499046f62c46286029ac603b1c6 /src/mesa/state_tracker
parent7e884c6f86621ca07ed31fc7ee3f4d891f0873da (diff)
Float->uint conversion for PIPE_FORMAT_U_Z32 resulted in overflow in depth_value(). Special-case it.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 2c79e2890d1..cb7e43fb8e9 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -86,7 +86,11 @@ depth_value(GLuint pipeFormat, GLfloat value)
val = (GLuint) (value * 0xffffff);
break;
case PIPE_FORMAT_U_Z32:
- val = (GLuint) (value * 0xffffffff);
+ /* special-case to avoid overflow */
+ if (value == 1.0)
+ val = 0xffffffff;
+ else
+ val = (GLuint) (value * 0xffffffff);
break;
case PIPE_FORMAT_S8_Z24:
/*case PIPE_FORMAT_Z24_S8:*/