From 58af0a5385e108e53f766578c9e14af4bb8fc189 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 18 Feb 2017 15:26:42 +0100 Subject: [PATCH] tgsi/scan: add basic info about tessellation OUT and IN uses MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit not all of them will be used immediately Reviewed-by: Nicolai Hähnle --- src/gallium/auxiliary/tgsi/tgsi_scan.c | 26 ++++++++++++++++++++++++++ src/gallium/auxiliary/tgsi/tgsi_scan.h | 8 ++++++++ 2 files changed, 34 insertions(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index a9aa36be46c..7d5496c9603 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -199,6 +199,28 @@ scan_src_operand(struct tgsi_shader_info *info, } } + if (info->processor == PIPE_SHADER_TESS_CTRL && + src->Register.File == TGSI_FILE_OUTPUT) { + unsigned input; + + if (src->Register.Indirect && src->Indirect.ArrayID) + input = info->output_array_first[src->Indirect.ArrayID]; + else + input = src->Register.Index; + + switch (info->output_semantic_name[input]) { + case TGSI_SEMANTIC_PATCH: + info->reads_perpatch_outputs = true; + break; + case TGSI_SEMANTIC_TESSINNER: + case TGSI_SEMANTIC_TESSOUTER: + info->reads_tessfactor_outputs = true; + break; + default: + info->reads_pervertex_outputs = true; + } + } + /* check for indirect register reads */ if (src->Register.Indirect) { info->indirect_files |= (1 << src->Register.File); @@ -539,6 +561,10 @@ scan_declaration(struct tgsi_shader_info *info, case TGSI_SEMANTIC_SAMPLEMASK: info->reads_samplemask = TRUE; break; + case TGSI_SEMANTIC_TESSINNER: + case TGSI_SEMANTIC_TESSOUTER: + info->reads_tess_factors = true; + break; } break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index 4add2f7a7e3..e3c24e950ed 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -84,11 +84,19 @@ struct tgsi_shader_info uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */ + /** + * If a tessellation control shader reads outputs, this describes which ones. + */ + boolean reads_pervertex_outputs; + boolean reads_perpatch_outputs; + boolean reads_tessfactor_outputs; + ubyte colors_read; /**< which color components are read by the FS */ ubyte colors_written; boolean reads_position; /**< does fragment shader read position? */ boolean reads_z; /**< does fragment shader read depth? */ boolean reads_samplemask; /**< does fragment shader read sample mask? */ + boolean reads_tess_factors; /**< If TES reads TESSINNER or TESSOUTER */ boolean writes_z; /**< does fragment shader write Z value? */ boolean writes_stencil; /**< does fragment shader write stencil value? */ boolean writes_samplemask; /**< does fragment shader write sample mask? */ -- 2.30.2