Mesa (main): draw/gs: 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: f48fed8e915afe29f8aca3e878550cb30c23d62d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f48fed8e915afe29f8aca3e878550cb30c23d62d
Author: Dave Airlie <airlied at redhat.com>
Date: Sun Aug 15 06:19:52 2021 +1000
draw/gs: 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_gs.c | 10 ++++++++++
src/gallium/auxiliary/draw/draw_gs.h | 1 +
src/gallium/auxiliary/draw/draw_private.h | 1 +
4 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index ab6fbbaba26..52f6bffc941 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -1003,7 +1003,7 @@ uint
draw_current_shader_clipvertex_output(const struct draw_context *draw)
{
if (draw->gs.geometry_shader)
- return draw->gs.position_output;
+ return draw->gs.clipvertex_output;
if (draw->tes.tess_eval_shader)
return draw->tes.position_output;
return draw->vs.clipvertex_output;
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index ed698e920d8..90e66b6436e 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -834,12 +834,18 @@ draw_create_geometry_shader(struct draw_context *draw,
gs->primitive_boundary = gs->max_output_vertices + 1;
gs->position_output = -1;
+ bool found_clipvertex = false;
for (i = 0; i < gs->info.num_outputs; i++) {
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_POSITION &&
gs->info.output_semantic_index[i] == 0)
gs->position_output = i;
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX)
gs->viewport_index_output = i;
+ if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPVERTEX &&
+ gs->info.output_semantic_index[i] == 0) {
+ found_clipvertex = true;
+ gs->clipvertex_output = i;
+ }
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
debug_assert(gs->info.output_semantic_index[i] <
PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
@@ -847,6 +853,9 @@ draw_create_geometry_shader(struct draw_context *draw,
}
}
+ if (!found_clipvertex)
+ gs->clipvertex_output = gs->position_output;
+
gs->machine = draw->gs.tgsi.machine;
gs->num_vertex_streams = 1;
@@ -900,6 +909,7 @@ void draw_bind_geometry_shader(struct draw_context *draw,
draw->gs.geometry_shader = dgs;
draw->gs.num_gs_outputs = dgs->info.num_outputs;
draw->gs.position_output = dgs->position_output;
+ draw->gs.clipvertex_output = dgs->clipvertex_output;
draw_geometry_shader_prepare(dgs, draw);
}
else {
diff --git a/src/gallium/auxiliary/draw/draw_gs.h b/src/gallium/auxiliary/draw/draw_gs.h
index 9449ec5094e..10969426f5b 100644
--- a/src/gallium/auxiliary/draw/draw_gs.h
+++ b/src/gallium/auxiliary/draw/draw_gs.h
@@ -75,6 +75,7 @@ struct draw_geometry_shader {
struct tgsi_shader_info info;
unsigned position_output;
unsigned viewport_index_output;
+ unsigned clipvertex_output;
unsigned ccdistance_output[PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT];
unsigned max_output_vertices;
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index d252856da51..7e4a39031b4 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -330,6 +330,7 @@ struct draw_context
struct draw_geometry_shader *geometry_shader;
uint num_gs_outputs; /**< convenience, from geometry_shader */
uint position_output;
+ uint clipvertex_output;
/** Fields for TGSI interpreter / execution */
struct {
More information about the mesa-commit
mailing list