From b2e92c45ce30f1aa039cf1ca72c4869992c77ae3 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 25 Jul 2019 10:44:39 +0200 Subject: [PATCH] gallium: Make PIPE_CAP_DEPTH_CLIP_DISABLE a tri-state value and use it MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use value "2" to signal that lowering is needed and supported and enable it accordingly. v2: - Note in CAP description that this lowering currently requires TGSI - use "true" instead of GL_TRUE (both Erik) Signed-off-by: Gert Wollny Reviewed-by: Reviewed-by: Marek Olšák --- src/gallium/docs/source/screen.rst | 4 +++- src/mesa/state_tracker/st_context.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 12de59a..065eb8f 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -67,7 +67,9 @@ The integer capabilities: * ``PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER``: Whether the TGSI property FS_COORD_PIXEL_CENTER with value INTEGER is supported. * ``PIPE_CAP_DEPTH_CLIP_DISABLE``: Whether the driver is capable of disabling - depth clipping (through pipe_rasterizer_state) + depth clipping (=1) (through pipe_rasterizer_state) or supports lowering + depth_clamp in the client shader code (=2), for this the driver must + currently use TGSI. * ``PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE``: Whether the driver is capable of disabling depth clipping (through pipe_rasterizer_state) separately for the near and far plane. If not, depth_clip_near and depth_clip_far will be diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 00e7725..eeceaf9 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -699,6 +699,9 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, } } + if (screen->get_param(screen, PIPE_CAP_DEPTH_CLIP_DISABLE) == 2) + st->clamp_frag_depth_in_shader = true; + /* called after _mesa_create_context/_mesa_init_point, fix default user * settable max point size up */ -- 2.7.4