From b06fda89ca282e644096f74b031d7fb5dea15b0c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 8 Jun 2018 14:07:44 +1000 Subject: [PATCH] tessellation: handle reading from outputs. (v2) Tessellation shaders can read back from outputs, so handle this. v2: fix clip dist output reading (fixes: generated_tests/spec/arb_tessellation_shader/execution/tes-input/tes-input-gl_ClipDistance.shader_test) Tested-by: Elie Tournier Reviewed-by: Elie Tournier Tested-by: Jakob Bornecrantz --- src/vrend_shader.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 5dc17ab..b29afed 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -2261,8 +2261,22 @@ get_source_info(struct dump_ctx *ctx, sinfo->override_no_wm[i] = ctx->inputs[j].override_no_wm; break; } - } - else if (src->Register.File == TGSI_FILE_TEMPORARY) { + } else if (src->Register.File == TGSI_FILE_OUTPUT) { + for (uint32_t j = 0; j < ctx->num_outputs; j++) { + if (ctx->outputs[j].first == src->Register.Index) { + enum vrend_type_qualifier srcstypeprefix = stypeprefix; + if (stype == TGSI_TYPE_UNSIGNED && ctx->outputs[j].is_int) + srcstypeprefix = TYPE_CONVERSION_NONE; + if (ctx->outputs[j].glsl_gl_block) { + if (ctx->outputs[j].name == TGSI_SEMANTIC_CLIPDIST) { + snprintf(srcs[i], 255, "clip_dist_temp[%d]", ctx->outputs[j].sid); + } + } else { + snprintf(srcs[i], 255, "%s(%s%s%s%s)", get_string(srcstypeprefix), prefix, ctx->outputs[j].glsl_name, arrayname, ctx->outputs[j].is_int ? "" : swizzle); + } + } + } + } else if (src->Register.File == TGSI_FILE_TEMPORARY) { struct vrend_temp_range *range = find_temp_range(ctx, src->Register.Index); if (!range) return FALSE;