nv50,nvc0: fix depth range when halfz is enabled

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97231
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5c1ccd8053)
This commit is contained in:
Ilia Mirkin 2016-08-12 21:40:52 -04:00 committed by Emil Velikov
parent 32c009b116
commit 07df4bf0c8
2 changed files with 14 additions and 4 deletions

View file

@ -1,5 +1,6 @@
#include "util/u_format.h"
#include "util/u_viewport.h"
#include "nv50/nv50_context.h"
@ -265,8 +266,12 @@ nv50_validate_viewport(struct nv50_context *nv50)
PUSH_DATAf(push, vpt->scale[1]);
PUSH_DATAf(push, vpt->scale[2]);
zmin = vpt->translate[2] - fabsf(vpt->scale[2]);
zmax = vpt->translate[2] + fabsf(vpt->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(vpt, nv50->rast->pipe.clip_halfz, &zmin, &zmax);
#ifdef NV50_SCISSORS_CLIPPING
BEGIN_NV04(push, NV50_3D(DEPTH_RANGE_NEAR(i)), 2);

View file

@ -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);