Mesa (master): i965g: calculate depth min/max

Keith Whitwell keithw at kemper.freedesktop.org
Thu Dec 24 04:53:58 PST 2009


Module: Mesa
Branch: master
Commit: 9546c3dbd2bdf85654d7ef0e90837f641bd801e4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9546c3dbd2bdf85654d7ef0e90837f641bd801e4

Author: Keith Whitwell <keithw at vmware.com>
Date:   Tue Dec 22 10:14:59 2009 +0000

i965g: calculate depth min/max

Previously hard-wired to 0..1

---

 src/gallium/drivers/i965/brw_pipe_fb.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/i965/brw_pipe_fb.c b/src/gallium/drivers/i965/brw_pipe_fb.c
index 6b03094..5d4e502 100644
--- a/src/gallium/drivers/i965/brw_pipe_fb.c
+++ b/src/gallium/drivers/i965/brw_pipe_fb.c
@@ -3,6 +3,7 @@
 #include "pipe/p_state.h"
 
 #include "brw_context.h"
+#include "brw_debug.h"
 
 /**
  * called from intelDrawBuffer()
@@ -51,8 +52,14 @@ static void brw_set_viewport_state( struct pipe_context *pipe,
    struct brw_context *brw = brw_context(pipe);
 
    brw->curr.viewport = *viewport;
-   brw->curr.ccv.min_depth = 0.0;         /* XXX: near */
-   brw->curr.ccv.max_depth = 1.0;         /* XXX: far */
+   brw->curr.ccv.min_depth = viewport->scale[2] * -1.0 + viewport->translate[2];
+   brw->curr.ccv.max_depth = viewport->scale[2] *  1.0 + viewport->translate[2];
+
+   if (0)
+      debug_printf("%s depth range %f .. %f\n",
+                   __FUNCTION__,
+                   brw->curr.ccv.min_depth,
+                   brw->curr.ccv.max_depth);
 
    brw->state.dirty.mesa |= PIPE_NEW_VIEWPORT;
 }



More information about the mesa-commit mailing list