[Mesa-dev] [PATCH 2/3] etnaviv: Add TS_SAMPLER formats to etnaviv_format
Christian Gmeiner
christian.gmeiner at gmail.com
Tue Nov 7 18:33:57 UTC 2017
2017-11-07 17:43 GMT+01:00 Wladimir J. van der Laan <laanwj at gmail.com>:
> Sampler TS introduces yet another format enumeration for renderable
> formats. Introduce it into etnaviv_format as unobtrusively as possible.
>
> Signed-off-by: Wladimir J. van der Laan <laanwj at gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
> src/gallium/drivers/etnaviv/etnaviv_format.c | 19 +++++++++++++++++++
> src/gallium/drivers/etnaviv/etnaviv_format.h | 3 +++
> 2 files changed, 22 insertions(+)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index 3dd212f..f3cba46 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -40,6 +40,7 @@ struct etna_format {
> unsigned vtx;
> unsigned tex;
> unsigned rs;
> + unsigned ts;
> boolean present;
> const unsigned char tex_swiz[4];
> };
> @@ -53,6 +54,13 @@ struct etna_format {
> #define RS_FORMAT_X8B8G8R8 (RS_FORMAT_X8R8G8B8 | RS_FORMAT_RB_SWAP)
> #define RS_FORMAT_A8B8G8R8 (RS_FORMAT_A8R8G8B8 | RS_FORMAT_RB_SWAP)
>
> +#define TS_SAMPLER_FORMAT_NONE ETNA_NO_MATCH
> +#define TS_SAMPLER_FORMAT_X4R4G4B4 TS_SAMPLER_FORMAT_A4R4G4B4
> +#define TS_SAMPLER_FORMAT_X1R5G5B5 TS_SAMPLER_FORMAT_A1R5G5B5
> +#define TS_SAMPLER_FORMAT_YUY2 TS_SAMPLER_FORMAT_NONE /* Not supported AFAIK */
> +#define TS_SAMPLER_FORMAT_X8B8G8R8 TS_SAMPLER_FORMAT_X8R8G8B8
> +#define TS_SAMPLER_FORMAT_A8B8G8R8 TS_SAMPLER_FORMAT_A8R8G8B8
> +
> #define SWIZ(x,y,z,w) { \
> PIPE_SWIZZLE_##x, \
> PIPE_SWIZZLE_##y, \
> @@ -66,6 +74,7 @@ struct etna_format {
> .vtx = FE_DATA_TYPE_##vtxfmt, \
> .tex = TEXTURE_FORMAT_##texfmt, \
> .rs = RS_FORMAT_##rsfmt, \
> + .ts = TS_SAMPLER_FORMAT_##rsfmt, \
> .present = 1, \
> .tex_swiz = texswiz, \
> }
> @@ -76,6 +85,7 @@ struct etna_format {
> .vtx = ETNA_NO_MATCH, \
> .tex = TEXTURE_FORMAT_##fmt, \
> .rs = RS_FORMAT_##rsfmt, \
> + .ts = TS_SAMPLER_FORMAT_##rsfmt, \
> .present = 1, \
> .tex_swiz = swiz, \
> }
> @@ -356,3 +366,12 @@ translate_vertex_format_type(enum pipe_format fmt)
>
> return formats[fmt].vtx;
> }
> +
> +uint32_t
> +translate_ts_sampler_format(enum pipe_format fmt)
> +{
> + if (!formats[fmt].present)
> + return ETNA_NO_MATCH;
> +
> + return formats[fmt].ts;
> +}
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.h b/src/gallium/drivers/etnaviv/etnaviv_format.h
> index 1672d67..20c8e1b 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.h
> @@ -53,4 +53,7 @@ translate_rs_format_rb_swap(enum pipe_format fmt);
> uint32_t
> translate_vertex_format_type(enum pipe_format fmt);
>
> +uint32_t
> +translate_ts_sampler_format(enum pipe_format fmt);
> +
> #endif /* ETNAVIV_FORMAT_H_ */
> --
> 2.7.4
>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
More information about the mesa-dev
mailing list