diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2022-02-04 11:15:08 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-02-08 14:03:09 +0000 |
commit | 7e9481eaacf54f850ee413c7872c41644f4d94e6 (patch) | |
tree | 31d7278fc69873da74826827f6f629a6420274d3 | |
parent | 93a90fc85d037e2c6834fb969562391310ae9cd0 (diff) |
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@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14878>
-rw-r--r-- | docs/gallium/screen.rst | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 3 |
4 files changed, 7 insertions, 1 deletions
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) { |