diff options
author | Ilia Mirkin <imirkin@alum.mit.edu> | 2014-05-17 22:48:58 -0400 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2014-05-23 09:51:26 -0700 |
commit | 6be7789e116b5cc351da0a8e6f37ab88bcce069a (patch) | |
tree | ee72cb13d391cf15aedd68cc0e0d311bfc78cebd /src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | |
parent | d6a4c3c29c789857eb60016a61f5db0716e463ef (diff) |
nv50,nvc0: fix 3d blits with mipmap levels
Make sure to normalize the z coordinates as well as the x/y ones when
there are mipmaps present. Fixes 3d mipmap generation, which now uses
the blit path.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
(cherry picked from commit 28360fcad75a6917db6af42fb17b81572850ec0d)
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0/nvc0_surface.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c index acadb2cc4f1..e15806eb1ef 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c @@ -896,6 +896,11 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info) y0 *= (float)(1 << nv50_miptree(src)->ms_y); y1 *= (float)(1 << nv50_miptree(src)->ms_y); + dz = (float)info->src.box.depth / (float)info->dst.box.depth; + z = (float)info->src.box.z; + if (nv50_miptree(src)->layout_3d) + z += 0.5f * dz; + if (src->last_level > 0) { /* If there are mip maps, GPU always assumes normalized coordinates. */ const unsigned l = info->src.level; @@ -905,13 +910,12 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info) x1 /= fh; y0 /= fv; y1 /= fv; + if (nv50_miptree(src)->layout_3d) { + z /= u_minify(src->depth0, l); + dz /= u_minify(src->depth0, l); + } } - dz = (float)info->src.box.depth / (float)info->dst.box.depth; - z = (float)info->src.box.z; - if (nv50_miptree(src)->layout_3d) - z += 0.5f * dz; - IMMED_NVC0(push, NVC0_3D(VIEWPORT_TRANSFORM_EN), 0); IMMED_NVC0(push, NVC0_3D(VIEW_VOLUME_CLIP_CTRL), 0x2 | NVC0_3D_VIEW_VOLUME_CLIP_CTRL_DEPTH_RANGE_0_1); |