draw/tess: 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:
Dave Airlie 2021-08-15 06:21:51 +10:00
parent f48fed8e91
commit 1ae55f05c0
4 changed files with 12 additions and 1 deletions

View File

@ -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;
}

View File

@ -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 {

View File

@ -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;
}

View File

@ -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;