summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-11-09 01:16:32 -0500
committerIlia Mirkin <[email protected]>2016-11-09 20:10:44 -0500
commit4af25e713113e5a50c0e03685ce7de20d3828961 (patch)
treea9e0368866531340132115598ffc229c9addd4d1 /src/gallium/drivers/swr
parentaed517f98592bd7969f893bbabdb64acf2f6623f (diff)
swr: fix support for inverted depth scales
Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Tim Rowley <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r--src/gallium/drivers/swr/swr_state.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index ede475a8e34..01cadcebbc4 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -38,6 +38,7 @@
#include "util/u_inlines.h"
#include "util/u_helpers.h"
#include "util/u_framebuffer.h"
+#include "util/u_viewport.h"
#include "swr_state.h"
#include "swr_context.h"
@@ -951,13 +952,8 @@ swr_update_derived(struct pipe_context *pipe,
vp->width = state->translate[0] + state->scale[0];
vp->y = state->translate[1] - fabs(state->scale[1]);
vp->height = state->translate[1] + fabs(state->scale[1]);
- if (rasterizer->clip_halfz == 0) {
- vp->minZ = state->translate[2] - state->scale[2];
- vp->maxZ = state->translate[2] + state->scale[2];
- } else {
- vp->minZ = state->translate[2];
- vp->maxZ = state->translate[2] + state->scale[2];
- }
+ util_viewport_zmin_zmax(state, rasterizer->clip_halfz,
+ &vp->minZ, &vp->maxZ);
vpm->m00[0] = state->scale[0];
vpm->m11[0] = state->scale[1];