[Mesa-dev] [PATCH v2 02/13] tgsi/scan: fix num_inputs/num_outputs for shaders with overlapping arrays
Marek Olšák
maraeo at gmail.com
Tue Oct 11 17:52:21 UTC 2016
On Mon, Oct 10, 2016 at 10:32 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
> src/gallium/auxiliary/tgsi/tgsi_scan.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
> index c7745ce..85ab329 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
> @@ -394,26 +394,23 @@ scan_declaration(struct tgsi_shader_info *info,
> MAX2(info->const_file_max[buffer], (int)reg);
> }
> else if (file == TGSI_FILE_INPUT) {
> info->input_semantic_name[reg] = (ubyte) semName;
> info->input_semantic_index[reg] = (ubyte) semIndex;
> info->input_interpolate[reg] = (ubyte)fulldecl->Interp.Interpolate;
> info->input_interpolate_loc[reg] = (ubyte)fulldecl->Interp.Location;
> info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Interp.CylindricalWrap;
>
> /* Vertex shaders can have inputs with holes between them. */
> - if (info->processor == PIPE_SHADER_VERTEX)
> - info->num_inputs = MAX2(info->num_inputs, reg + 1);
> - else {
> - info->num_inputs++;
> + info->num_inputs = MAX2(info->num_inputs, reg + 1);
> + if (info->processor != PIPE_SHADER_VERTEX)
> assert(reg < info->num_inputs);
Is the assertion really needed? If num_inputs is at least reg+1, the
assertion is a tautology.
> - }
>
> if (semName == TGSI_SEMANTIC_PRIMID)
> info->uses_primid = TRUE;
> else if (procType == PIPE_SHADER_FRAGMENT) {
> if (semName == TGSI_SEMANTIC_POSITION)
> info->reads_position = TRUE;
> else if (semName == TGSI_SEMANTIC_FACE)
> info->uses_frontface = TRUE;
> }
> }
> @@ -449,21 +446,21 @@ scan_declaration(struct tgsi_shader_info *info,
> info->uses_frontface = TRUE;
> break;
> case TGSI_SEMANTIC_SAMPLEMASK:
> info->reads_samplemask = TRUE;
> break;
> }
> }
> else if (file == TGSI_FILE_OUTPUT) {
> info->output_semantic_name[reg] = (ubyte) semName;
> info->output_semantic_index[reg] = (ubyte) semIndex;
> - info->num_outputs++;
> + info->num_outputs = MAX2(info->num_outputs, reg + 1);
> assert(reg < info->num_outputs);
Same here.
Marek
More information about the mesa-dev
mailing list