[Mesa-dev] [PATCH 3/3] tgsi/ureg: handle redundant declarations in ureg_DECL_system_value
Brian Paul
brianp at vmware.com
Fri Jan 8 06:51:42 PST 2016
For the series, Reviewed-by: Brian Paul <brianp at vmware.com>
On 01/07/2016 06:12 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> index 9642723..5b78542 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> @@ -322,7 +322,14 @@ ureg_DECL_system_value(struct ureg_program *ureg,
> unsigned semantic_name,
> unsigned semantic_index)
> {
> - unsigned i = 0;
> + unsigned i;
> +
> + for (i = 0; i < ureg->nr_system_values; i++) {
> + if (ureg->system_value[i].semantic_name == semantic_name &&
> + ureg->system_value[i].semantic_index == semantic_index) {
> + goto out;
> + }
> + }
>
> if (ureg->nr_system_values < UREG_MAX_SYSTEM_VALUE) {
> ureg->system_value[ureg->nr_system_values].semantic_name = semantic_name;
> @@ -333,6 +340,7 @@ ureg_DECL_system_value(struct ureg_program *ureg,
> set_bad(ureg);
> }
>
> +out:
> return ureg_src_register(TGSI_FILE_SYSTEM_VALUE, i);
> }
>
>
More information about the mesa-dev
mailing list