From 5c1ccd8053412b6a42098481d2fde3d483208c33 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Fri, 12 Aug 2016 21:40:52 -0400 Subject: nv50,nvc0: fix depth range when halfz is enabled Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97231 Signed-off-by: Ilia Mirkin Cc: "11.2 12.0" --- src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers/nouveau/nvc0') diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c index 160abaed373..e69463e3c79 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c @@ -2,6 +2,7 @@ #include "util/u_format.h" #include "util/u_framebuffer.h" #include "util/u_math.h" +#include "util/u_viewport.h" #include "nvc0/nvc0_context.h" @@ -329,8 +330,12 @@ nvc0_validate_viewport(struct nvc0_context *nvc0) PUSH_DATA (push, (w << 16) | x); PUSH_DATA (push, (h << 16) | y); - zmin = vp->translate[2] - fabsf(vp->scale[2]); - zmax = vp->translate[2] + fabsf(vp->scale[2]); + /* If the halfz setting ever changes, the viewports will also get + * updated. The rast will get updated before the validate function has a + * chance to hit, so we can just use it directly without an atom + * dependency. + */ + util_viewport_zmin_zmax(vp, nvc0->rast->pipe.clip_halfz, &zmin, &zmax); BEGIN_NVC0(push, NVC0_3D(DEPTH_RANGE_NEAR(i)), 2); PUSH_DATAf(push, zmin); -- cgit v1.2.3