[Mesa-dev] [PATCH 01/14] ac: migrate unique index info shader info

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Feb 26 10:23:21 UTC 2018



On 02/21/2018 02:35 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This just moves this function to an inline so the shader_info
> pass can use it.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>   src/amd/common/ac_nir_to_llvm.c | 22 ----------------------
>   src/amd/common/ac_shader_info.h | 25 +++++++++++++++++++++++++
>   2 files changed, 25 insertions(+), 22 deletions(-)
> 
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 351e6fa9efc..c21a78b1335 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -148,28 +148,6 @@ static unsigned radeon_llvm_reg_index_soa(unsigned index, unsigned chan)
>   	return (index * 4) + chan;
>   }
>   
> -static unsigned shader_io_get_unique_index(gl_varying_slot slot)
> -{
> -	/* handle patch indices separate */
> -	if (slot == VARYING_SLOT_TESS_LEVEL_OUTER)
> -		return 0;
> -	if (slot == VARYING_SLOT_TESS_LEVEL_INNER)
> -		return 1;
> -	if (slot >= VARYING_SLOT_PATCH0 && slot <= VARYING_SLOT_TESS_MAX)
> -		return 2 + (slot - VARYING_SLOT_PATCH0);
> -
> -	if (slot == VARYING_SLOT_POS)
> -		return 0;
> -	if (slot == VARYING_SLOT_PSIZ)
> -		return 1;
> -	if (slot == VARYING_SLOT_CLIP_DIST0)
> -		return 2;
> -	/* 3 is reserved for clip dist as well */
> -	if (slot >= VARYING_SLOT_VAR0 && slot <= VARYING_SLOT_VAR31)
> -		return 4 + (slot - VARYING_SLOT_VAR0);
> -	unreachable("illegal slot in get unique index\n");
> -}
> -
>   static void set_llvm_calling_convention(LLVMValueRef func,
>                                           gl_shader_stage stage)
>   {
> diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
> index 7f87582930c..9574380877a 100644
> --- a/src/amd/common/ac_shader_info.h
> +++ b/src/amd/common/ac_shader_info.h
> @@ -25,6 +25,7 @@
>   #define AC_SHADER_INFO_H
>   
>   #include "compiler/shader_enums.h"
> +#include "util/macros.h"
>   
>   struct nir_shader;
>   struct ac_nir_compiler_options;
> @@ -66,4 +67,28 @@ ac_nir_shader_info_pass(const struct nir_shader *nir,
>   			const struct ac_nir_compiler_options *options,
>   			struct ac_shader_info *info);
>   
> +
> +static __inline__ unsigned shader_io_get_unique_index(gl_varying_slot slot)

Why not only "inline"?

> +{
> +	/* handle patch indices separate */
> +	if (slot == VARYING_SLOT_TESS_LEVEL_OUTER)
> +		return 0;
> +	if (slot == VARYING_SLOT_TESS_LEVEL_INNER)
> +		return 1;
> +	if (slot >= VARYING_SLOT_PATCH0 && slot <= VARYING_SLOT_TESS_MAX)
> +		return 2 + (slot - VARYING_SLOT_PATCH0);
> +
> +	if (slot == VARYING_SLOT_POS)
> +		return 0;
> +	if (slot == VARYING_SLOT_PSIZ)
> +		return 1;
> +	if (slot == VARYING_SLOT_CLIP_DIST0)
> +		return 2;
> +	/* 3 is reserved for clip dist as well */
> +	if (slot >= VARYING_SLOT_VAR0 && slot <= VARYING_SLOT_VAR31)
> +		return 4 + (slot - VARYING_SLOT_VAR0);
> +	unreachable("illegal slot in get unique index\n");
> +}
> +
> +
>   #endif
> 


More information about the mesa-dev mailing list