[Mesa-dev] [PATCH] tgsi/scan: remember sampler view types

Brian Paul brianp at vmware.com
Fri Aug 26 14:14:32 UTC 2016


On 08/26/2016 07:48 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>   src/gallium/auxiliary/tgsi/tgsi_scan.c | 4 ++++
>   src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 +
>   2 files changed, 5 insertions(+)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
> index 0167e22..a3b0d9f 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
> @@ -490,27 +490,31 @@ scan_declaration(struct tgsi_shader_info *info,
>            if (procType == PIPE_SHADER_VERTEX) {
>               if (semName == TGSI_SEMANTIC_EDGEFLAG) {
>                  info->writes_edgeflag = TRUE;
>               }
>            }
>         } else if (file == TGSI_FILE_SAMPLER) {
>            STATIC_ASSERT(sizeof(info->samplers_declared) * 8 >= PIPE_MAX_SAMPLERS);
>            info->samplers_declared |= 1u << reg;
>         } else if (file == TGSI_FILE_SAMPLER_VIEW) {
>            unsigned target = fulldecl->SamplerView.Resource;
> +         unsigned type = fulldecl->SamplerView.ReturnTypeX;
> +
>            assert(target < TGSI_TEXTURE_UNKNOWN);
>            if (info->sampler_targets[reg] == TGSI_TEXTURE_UNKNOWN) {
>               /* Save sampler target for this sampler index */
>               info->sampler_targets[reg] = target;
> +            info->sampler_type[reg] = type;
>            } else {
>               /* if previously declared, make sure targets agree */
>               assert(info->sampler_targets[reg] == target);
> +            assert(info->sampler_type[reg] == type);
>            }
>         } else if (file == TGSI_FILE_IMAGE) {
>            if (fulldecl->Image.Resource == TGSI_TEXTURE_BUFFER)
>               info->images_buffers |= 1 << reg;
>         }
>      }
>   }
>
>
>   static void
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
> index 30d0146..0c5f2ba 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
> @@ -59,20 +59,21 @@ struct tgsi_shader_info
>      ubyte system_value_semantic_name[PIPE_MAX_SHADER_INPUTS];
>
>      ubyte processor;
>
>      uint file_mask[TGSI_FILE_COUNT];  /**< bitmask of declared registers */
>      uint file_count[TGSI_FILE_COUNT];  /**< number of declared registers */
>      int file_max[TGSI_FILE_COUNT];  /**< highest index of declared registers */
>      int const_file_max[PIPE_MAX_CONSTANT_BUFFERS];
>      unsigned samplers_declared; /**< bitmask of declared samplers */
>      ubyte sampler_targets[PIPE_MAX_SHADER_SAMPLER_VIEWS];  /**< TGSI_TEXTURE_x values */
> +   ubyte sampler_type[PIPE_MAX_SHADER_SAMPLER_VIEWS]; /**< TGSI_RETURN_TYPE_x */
>
>      ubyte input_array_first[PIPE_MAX_SHADER_INPUTS];
>      ubyte input_array_last[PIPE_MAX_SHADER_INPUTS];
>      ubyte output_array_first[PIPE_MAX_SHADER_OUTPUTS];
>      ubyte output_array_last[PIPE_MAX_SHADER_OUTPUTS];
>      unsigned array_max[TGSI_FILE_COUNT];  /**< highest index array per register file */
>
>      uint immediate_count; /**< number of immediates declared */
>      uint num_instructions;
>      uint num_memory_instructions; /**< sampler, buffer, and image instructions */
>

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list