draw/gs: add clipvertex support for compatibility
Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12374>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user