Mesa (main): gallium: add PIPE_CAP_CULL_DISTANCE_NOCOMBINE
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Feb 8 14:42:11 UTC 2022
Module: Mesa
Branch: main
Commit: 7e9481eaacf54f850ee413c7872c41644f4d94e6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e9481eaacf54f850ee413c7872c41644f4d94e6
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri Feb 4 11:15:08 2022 -0500
gallium: add PIPE_CAP_CULL_DISTANCE_NOCOMBINE
for drivers where separate cull distance variables are required, this
lets them avoid having to write yet another pass to undo gallium's mangling
of shader info
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14878>
---
docs/gallium/screen.rst | 3 +++
src/gallium/auxiliary/util/u_screen.c | 1 +
src/gallium/include/pipe/p_defines.h | 1 +
src/mesa/state_tracker/st_glsl_to_nir.cpp | 3 ++-
4 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst
index 39a85c808d9..b0d7b5e73d1 100644
--- a/docs/gallium/screen.rst
+++ b/docs/gallium/screen.rst
@@ -374,6 +374,9 @@ The integer capabilities:
and accesses to unbound resources.
* ``PIPE_CAP_CULL_DISTANCE``: Whether the driver supports the arb_cull_distance
extension and thus implements proper support for culling planes.
+* ``PIPE_CAP_CULL_DISTANCE_NOCOMBINE``: Whether the driver wants to skip
+ running the `nir_lower_clip_cull_distance_arrays` pass in order to get
+ VARYING_SLOT_CULL_DIST0 slot variables.
* ``PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES``: Whether primitive restart is
supported for patch primitives.
* ``PIPE_CAP_TGSI_VOTE``: Whether the ``VOTE_*`` ops can be used in shaders.
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index 71458bccf03..ac59e9bd05e 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -275,6 +275,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
case PIPE_CAP_CULL_DISTANCE:
+ case PIPE_CAP_CULL_DISTANCE_NOCOMBINE:
case PIPE_CAP_TGSI_VOTE:
case PIPE_CAP_MAX_WINDOW_RECTANGLES: /* Enables EXT_window_rectangles */
case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index f3671e9fe00..014c5ba9a00 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -875,6 +875,7 @@ enum pipe_cap
PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT,
PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR,
PIPE_CAP_CULL_DISTANCE,
+ PIPE_CAP_CULL_DISTANCE_NOCOMBINE,
PIPE_CAP_TGSI_VOTE,
PIPE_CAP_MAX_WINDOW_RECTANGLES,
PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED,
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index cd52f34fec7..6b27e61b10e 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -768,7 +768,8 @@ st_link_nir(struct gl_context *ctx,
NIR_PASS_V(nir, nir_lower_system_values);
NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
- NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
+ if (!st->screen->get_param(st->screen, PIPE_CAP_CULL_DISTANCE_NOCOMBINE))
+ NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
st_shader_gather_info(nir, shader->Program);
if (shader->Stage == MESA_SHADER_VERTEX) {
More information about the mesa-commit
mailing list