[Mesa-dev] [PATCH 1/2] tgsi: move tgsi_processor_to_shader_stage() to a header
Brian Paul
brianp at vmware.com
Thu Mar 15 14:00:14 UTC 2018
On 03/15/2018 07:12 AM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> This way we can utilise it with later patches.
>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> A fair bit of polish can be applied here - name, unsigned -> enum etc.
> I've opted to keep it as-is since it's been in the current shape for a
> while.
> ---
> src/gallium/auxiliary/nir/tgsi_to_nir.c | 16 +---------------
> src/gallium/auxiliary/tgsi/tgsi_from_mesa.h | 15 +++++++++++++++
> 2 files changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
> index f8df4c10137..bbbf101157f 100644
> --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
> +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
> @@ -34,6 +34,7 @@
> #include "tgsi/tgsi_dump.h"
> #include "tgsi/tgsi_info.h"
> #include "tgsi/tgsi_scan.h"
> +#include "tgsi/tgsi_from_mesa.h"
>
> #define SWIZ(X, Y, Z, W) (unsigned[4]){ \
> TGSI_SWIZZLE_##X, \
> @@ -1887,21 +1888,6 @@ ttn_add_output_stores(struct ttn_compile *c)
> }
> }
>
> -static gl_shader_stage
> -tgsi_processor_to_shader_stage(unsigned processor)
> -{
> - switch (processor) {
> - case PIPE_SHADER_FRAGMENT: return MESA_SHADER_FRAGMENT;
> - case PIPE_SHADER_VERTEX: return MESA_SHADER_VERTEX;
> - case PIPE_SHADER_GEOMETRY: return MESA_SHADER_GEOMETRY;
> - case PIPE_SHADER_TESS_CTRL: return MESA_SHADER_TESS_CTRL;
> - case PIPE_SHADER_TESS_EVAL: return MESA_SHADER_TESS_EVAL;
> - case PIPE_SHADER_COMPUTE: return MESA_SHADER_COMPUTE;
> - default:
> - unreachable("invalid TGSI processor");
> - }
> -}
> -
> struct nir_shader *
> tgsi_to_nir(const void *tgsi_tokens,
> const nir_shader_compiler_options *options)
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h b/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
> index bfaa48d7fa3..b4d540baabc 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
> @@ -68,4 +68,19 @@ pipe_shader_type_from_mesa(gl_shader_stage stage)
> }
> }
>
> +static inline gl_shader_stage
> +tgsi_processor_to_shader_stage(unsigned processor)
> +{
> + switch (processor) {
> + case PIPE_SHADER_FRAGMENT: return MESA_SHADER_FRAGMENT;
> + case PIPE_SHADER_VERTEX: return MESA_SHADER_VERTEX;
> + case PIPE_SHADER_GEOMETRY: return MESA_SHADER_GEOMETRY;
> + case PIPE_SHADER_TESS_CTRL: return MESA_SHADER_TESS_CTRL;
> + case PIPE_SHADER_TESS_EVAL: return MESA_SHADER_TESS_EVAL;
> + case PIPE_SHADER_COMPUTE: return MESA_SHADER_COMPUTE;
> + default:
> + unreachable("invalid TGSI processor");
> + }
> +}
> +
> #endif /* TGSI_FROM_MESA_H */
>
I could have sworn we already had a PIPE_SHADER_x -> MESA_SHADER_x
conversion function in src/mesa/state_tracker/, but I can't find it.
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list