Mesa (main): draw/tess: add clipvertex support for compatibility

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 16 19:56:44 UTC 2021


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Sun Aug 15 06:21:51 2021 +1000

draw/tess: add clipvertex support for compatibility

Reviewed-by: Emma Anholt <emma at anholt.net>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12374>

---

 src/gallium/auxiliary/draw/draw_context.c | 2 +-
 src/gallium/auxiliary/draw/draw_private.h | 1 +
 src/gallium/auxiliary/draw/draw_tess.c    | 9 +++++++++
 src/gallium/auxiliary/draw/draw_tess.h    | 1 +
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 52f6bffc941..7a94168894b 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -1005,7 +1005,7 @@ draw_current_shader_clipvertex_output(const struct draw_context *draw)
    if (draw->gs.geometry_shader)
       return draw->gs.clipvertex_output;
    if (draw->tes.tess_eval_shader)
-      return draw->tes.position_output;
+      return draw->tes.clipvertex_output;
    return draw->vs.clipvertex_output;
 }
 
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 7e4a39031b4..ffdc8b987a0 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -360,6 +360,7 @@ struct draw_context
    struct {
       struct draw_tess_eval_shader *tess_eval_shader;
       uint position_output;
+      uint clipvertex_output;
 
       /** Fields for TGSI interpreter / execution */
       struct {
diff --git a/src/gallium/auxiliary/draw/draw_tess.c b/src/gallium/auxiliary/draw/draw_tess.c
index 6488273318f..ec0cb23a4ad 100644
--- a/src/gallium/auxiliary/draw/draw_tess.c
+++ b/src/gallium/auxiliary/draw/draw_tess.c
@@ -558,18 +558,26 @@ draw_create_tess_eval_shader(struct draw_context *draw,
    tes->vector_length = 4;
 
    tes->position_output = -1;
+   bool found_clipvertex = false;
    for (unsigned i = 0; i < tes->info.num_outputs; i++) {
       if (tes->info.output_semantic_name[i] == TGSI_SEMANTIC_POSITION &&
           tes->info.output_semantic_index[i] == 0)
          tes->position_output = i;
       if (tes->info.output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX)
          tes->viewport_index_output = i;
+      if (tes->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPVERTEX &&
+          tes->info.output_semantic_index[i] == 0) {
+         found_clipvertex = true;
+         tes->clipvertex_output = i;
+      }
       if (tes->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
          debug_assert(tes->info.output_semantic_index[i] <
                       PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
          tes->ccdistance_output[tes->info.output_semantic_index[i]] = i;
       }
    }
+   if (!found_clipvertex)
+      tes->clipvertex_output = tes->position_output;
 
 #ifdef DRAW_LLVM_AVAILABLE
    if (use_llvm) {
@@ -595,6 +603,7 @@ void draw_bind_tess_eval_shader(struct draw_context *draw,
    if (dtes) {
       draw->tes.tess_eval_shader = dtes;
       draw->tes.position_output = dtes->position_output;
+      draw->tes.clipvertex_output = dtes->clipvertex_output;
    } else {
       draw->tes.tess_eval_shader = NULL;
    }
diff --git a/src/gallium/auxiliary/draw/draw_tess.h b/src/gallium/auxiliary/draw/draw_tess.h
index e21663d826c..3cca2aee9ec 100644
--- a/src/gallium/auxiliary/draw/draw_tess.h
+++ b/src/gallium/auxiliary/draw/draw_tess.h
@@ -84,6 +84,7 @@ struct draw_tess_eval_shader {
 
    unsigned position_output;
    unsigned viewport_index_output;
+   unsigned clipvertex_output;
    unsigned ccdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
    unsigned vector_length;
 



More information about the mesa-commit mailing list