Mesa (main): mesa/st: Lower user clip planes for tess eval too

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 24 17:57:17 UTC 2022


Module: Mesa
Branch: main
Commit: 0b6caed85cebae4aefa7fa13950e93a14051720d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b6caed85cebae4aefa7fa13950e93a14051720d

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Sat Jan 22 14:35:16 2022 -0800

mesa/st: Lower user clip planes for tess eval too

The logic in st_atom_shader.c leads me to believe this was supposed
to work, but was incomplete to actually finish it. This fixes
compatibility tess tests on d3d12.

Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14662>

---

 src/mesa/state_tracker/st_atom_shader.c | 3 ++-
 src/mesa/state_tracker/st_context.c     | 2 +-
 src/mesa/state_tracker/st_program.c     | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 4e94e2c6df9..303eef249f3 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -296,7 +296,8 @@ st_update_common_program(struct st_context *st, struct gl_program *prog,
                           VARYING_SLOT_BFC1));
 
       if (st->lower_ucp && st_user_clip_planes_enabled(st->ctx) &&
-          pipe_shader == PIPE_SHADER_GEOMETRY)
+          (pipe_shader == PIPE_SHADER_GEOMETRY ||
+             !st->ctx->GeometryProgram._Current))
          key.lower_ucp = st->ctx->Transform.ClipPlanesEnabled;
 
       if (st->lower_point_size) {
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 8d4ec1d143f..c70551a815f 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -439,7 +439,7 @@ st_init_driver_flags(struct st_context *st)
 
    f->NewClipPlaneEnable = ST_NEW_RASTERIZER;
    if (st->lower_ucp)
-      f->NewClipPlaneEnable |= ST_NEW_VS_STATE | ST_NEW_GS_STATE;
+      f->NewClipPlaneEnable |= ST_NEW_VS_STATE | ST_NEW_GS_STATE | ST_NEW_TES_STATE;
 
    if (st->emulate_gl_clamp)
       f->NewSamplersWithClamp = ST_NEW_SAMPLERS |
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 00303febcd3..46a623b2e0d 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -741,7 +741,8 @@ lower_ucp(struct st_context *st,
          _mesa_add_state_reference(params, clipplane_state[i]);
       }
 
-      if (nir->info.stage == MESA_SHADER_VERTEX) {
+      if (nir->info.stage == MESA_SHADER_VERTEX ||
+          nir->info.stage == MESA_SHADER_TESS_EVAL) {
          NIR_PASS_V(nir, nir_lower_clip_vs, ucp_enables,
                     true, can_compact, clipplane_state);
       } else if (nir->info.stage == MESA_SHADER_GEOMETRY) {



More information about the mesa-commit mailing list