Mesa (master): intel: Set DepthRange in the metaops using RasterPos[2].

Eric Anholt anholt at kemper.freedesktop.org
Tue Jul 14 22:17:55 UTC 2009


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jul 14 14:30:12 2009 -0700

intel: Set DepthRange in the metaops using RasterPos[2].

RasterPos[2] is already sent through the window transform, which includes
DepthRange handling.  So make DepthRange for the metaops a noop.

Fixes a failure in oglconform depthrange.c

---

 src/mesa/drivers/dri/intel/intel_pixel_bitmap.c |    4 ++++
 src/mesa/drivers/dri/intel/intel_pixel_draw.c   |    6 +++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 0e8ec92..ebba6aa 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -42,6 +42,7 @@
 #include "main/varray.h"
 #include "main/attrib.h"
 #include "main/enable.h"
+#include "main/viewport.h"
 #include "shader/arbprogram.h"
 #include "glapi/dispatch.h"
 #include "swrast/swrast.h"
@@ -484,6 +485,9 @@ intel_texture_bitmap(GLcontext * ctx,
    /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */
    dst_z = -1.0 + 2.0 * ctx->Current.RasterPos[2];
 
+   /* RasterPos[2] already takes into account the DepthRange mapping. */
+   _mesa_DepthRange(0.0, 1.0);
+
    vertices[0][0] = dst_x;
    vertices[0][1] = dst_y;
    vertices[0][2] = dst_z;
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index ddcc661..dfc9e15 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -45,6 +45,7 @@
 #include "main/depth.h"
 #include "main/hash.h"
 #include "main/blend.h"
+#include "main/viewport.h"
 #include "glapi/dispatch.h"
 #include "swrast/swrast.h"
 
@@ -128,7 +129,7 @@ intel_texture_drawpixels(GLcontext * ctx,
    }
 
    _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT |
-		    GL_CURRENT_BIT);
+		    GL_CURRENT_BIT | GL_VIEWPORT_BIT);
    _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
 
    /* XXX: pixel store stuff */
@@ -154,6 +155,9 @@ intel_texture_drawpixels(GLcontext * ctx,
    /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */
    z = -1.0 + 2.0 * ctx->Current.RasterPos[2];
 
+   /* RasterPos[2] already takes into account the DepthRange mapping. */
+   _mesa_DepthRange(0.0, 1.0);
+
    /* Create the vertex buffer based on the current raster pos.  The x and y
     * we're handed are ctx->Current.RasterPos[0,1] rounded to integers.
     * We also apply the depth.  However, the W component is already multiplied




More information about the mesa-commit mailing list