summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>2017-09-15 10:05:03 +0200
committerJuan A. Suarez Romero <jasuarez@igalia.com>2017-09-28 13:54:56 +0000
commite16c31f3fe7ec389a34330e9554386d59355e028 (patch)
treeb25f1caac9efedd774c04557a107b8577308229e
parentdbf33a12e143a6a66149e7f90cc1fa22f1b14cf8 (diff)
anv: fix viewport transformation for z component
In Vulkan, for 'z' (depth) component, the scale and translate values for the viewport transformation are: pz = maxDepth - minDepth oz = minDepth zf = pz × zd + oz Being zd, the third component in vertex's normalized device coordinates. Fixes: dEQP-VK.draw.inverted_depth_ranges.* Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Cc: mesa-stable@lists.freedesktop.org (cherry picked from commit d2cd9deeb8db5941e99b149fa637f711198ca741)
-rw-r--r--src/intel/vulkan/gen8_cmd_buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c
index a209d701619..fb420d85168 100644
--- a/src/intel/vulkan/gen8_cmd_buffer.c
+++ b/src/intel/vulkan/gen8_cmd_buffer.c
@@ -49,10 +49,10 @@ gen8_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer)
struct GENX(SF_CLIP_VIEWPORT) sf_clip_viewport = {
.ViewportMatrixElementm00 = vp->width / 2,
.ViewportMatrixElementm11 = vp->height / 2,
- .ViewportMatrixElementm22 = 1.0,
+ .ViewportMatrixElementm22 = vp->maxDepth - vp->minDepth,
.ViewportMatrixElementm30 = vp->x + vp->width / 2,
.ViewportMatrixElementm31 = vp->y + vp->height / 2,
- .ViewportMatrixElementm32 = 0.0,
+ .ViewportMatrixElementm32 = vp->minDepth,
.XMinClipGuardband = -1.0f,
.XMaxClipGuardband = 1.0f,
.YMinClipGuardband = -1.0f,