Mesa (master): panfrost: Implement depth range clipping
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 21 17:46:21 UTC 2019
Module: Mesa
Branch: master
Commit: d4542f8cb5fc999e21fd3ab56f5b446116d8fdef
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4542f8cb5fc999e21fd3ab56f5b446116d8fdef
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Fri Aug 16 10:25:34 2019 -0700
panfrost: Implement depth range clipping
This should fix glDepthRangef issues. Eventually, something similar
should allow implementing the depth bounds test.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/gallium/drivers/panfrost/pan_context.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index f9e03ab4fbd..e8ca6a66377 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1209,9 +1209,6 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
.clip_miny = -INFINITY,
.clip_maxx = INFINITY,
.clip_maxy = INFINITY,
-
- .clip_minz = 0.0,
- .clip_maxz = 1.0,
};
/* Always scissor to the viewport by default. */
@@ -1221,6 +1218,9 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
float vp_miny = (int) (vp->translate[1] - fabsf(vp->scale[1]));
float vp_maxy = (int) (vp->translate[1] + fabsf(vp->scale[1]));
+ float minz = (vp->translate[2] - fabsf(vp->scale[2]));
+ float maxz = (vp->translate[2] + fabsf(vp->scale[2]));
+
/* Apply the scissor test */
unsigned minx, miny, maxx, maxy;
@@ -1253,6 +1253,12 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
maxx = temp;
}
+ if (minz > maxz) {
+ float temp = minz;
+ minz = maxz;
+ maxz = temp;
+ }
+
/* Clamp to the framebuffer size as a last check */
minx = MIN2(ctx->pipe_framebuffer.width, minx);
@@ -1276,6 +1282,9 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
view.viewport0[1] = miny;
view.viewport1[1] = MALI_POSITIVE(maxy);
+ view.clip_minz = minz;
+ view.clip_maxz = maxz;
+
ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.viewport =
panfrost_upload_transient(ctx,
&view,
More information about the mesa-commit
mailing list