[Mesa-dev] [PATCH 7/8] etnaviv: add float formats

Wladimir J. van der Laan laanwj at gmail.com
Sat Oct 21 06:27:31 UTC 2017


On Fri, Oct 20, 2017 at 10:21:27PM +0200, Christian Gmeiner wrote:
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>

Reviewed-by: Wladimir J. van der Laan <laanwj at gmail.com>

Optional suggestions inline.

> ---
>  src/gallium/drivers/etnaviv/etnaviv_format.c | 22 +++++++++++++++++-----
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index 7297de3d85..a7085800aa 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -108,7 +108,10 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
>     V_(R16_SINT,    SHORT,          NONE),
>     V_(R16_USCALED, UNSIGNED_SHORT, NONE),
>     V_(R16_SSCALED, SHORT,          NONE),
> -   V_(R16_FLOAT,   HALF_FLOAT,     NONE),
> +   VT(R16_FLOAT,   HALF_FLOAT,     EXT_R16F | EXT_FORMAT, SWIZ(X, Y, Z, W), R16F),
> +
> +   _T(A16_FLOAT, EXT_R16F | EXT_FORMAT, SWIZ(0, 0, 0, X), NONE),
> +   _T(L16_FLOAT, EXT_R16F | EXT_FORMAT, SWIZ(X, X, X, 1), NONE),

FWIW we can also do:

_T(I16_FLOAT, EXT_R16F | EXT_FORMAT, SWIZ(X, X, X, X), NONE),

>     _T(B4G4R4A4_UNORM, A4R4G4B4, SWIZ(X, Y, Z, W), A4R4G4B4),
>     _T(B4G4R4X4_UNORM, X4R4G4B4, SWIZ(X, Y, Z, W), X4R4G4B4),
> @@ -142,16 +145,22 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
>     V_(R32_UINT,    UNSIGNED_INT, NONE),
>     V_(R32_USCALED, UNSIGNED_INT, NONE),
>     V_(R32_SSCALED, INT,          NONE),
> -   V_(R32_FLOAT,   FLOAT,        NONE),
> +   VT(R32_FLOAT,   FLOAT,        EXT_R32F | EXT_FORMAT, SWIZ(X, Y, Z, W), R32F),
>     V_(R32_FIXED,   FIXED,        NONE),
>  
> +   _T(A32_FLOAT, EXT_R32F | EXT_FORMAT, SWIZ(0, 0, 0, X), NONE),
> +   _T(L32_FLOAT, EXT_R32F | EXT_FORMAT, SWIZ(X, X, X, 1), NONE),

And:

_T(I32_FLOAT, EXT_R32F | EXT_FORMAT, SWIZ(X, X, X, X), NONE),

> +
>     V_(R16G16_UNORM,   UNSIGNED_SHORT, NONE),
>     V_(R16G16_SNORM,   SHORT,          NONE),
>     V_(R16G16_UINT,    UNSIGNED_SHORT, NONE),
>     V_(R16G16_SINT,    SHORT,          NONE),
>     V_(R16G16_USCALED, UNSIGNED_SHORT, NONE),
>     V_(R16G16_SSCALED, SHORT,          NONE),
> -   V_(R16G16_FLOAT,   HALF_FLOAT,     NONE),
> +   VT(R16G16_FLOAT,   HALF_FLOAT,     EXT_G16R16F | EXT_FORMAT, SWIZ(X, 0, 0, 1), G16R16F),
> +
> +   _T(R16A16_FLOAT, EXT_G16R16F | EXT_FORMAT, SWIZ(X, 0, 0, Y), NONE),
> +   _T(L16A16_FLOAT, EXT_G16R16F | EXT_FORMAT, SWIZ(X, X, X, Y), NONE),
>  
>     V_(A8B8G8R8_UNORM,   UNSIGNED_BYTE, NONE),
>  
> @@ -171,6 +180,8 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
>     V_(R10G10B10A2_USCALED, UNSIGNED_INT_10_10_10_2, NONE),
>     V_(R10G10B10A2_SSCALED, INT_10_10_10_2,          NONE),
>  
> +   _T(R11G11B10_FLOAT, EXT_B10G11R11F | EXT_FORMAT, SWIZ(X, Y, Z, 1), B10G11R11F),
> +
>     _T(X8Z24_UNORM,       D24S8, SWIZ(X, Y, Z, W), A8R8G8B8),
>     _T(S8_UINT_Z24_UNORM, D24S8, SWIZ(X, Y, Z, W), A8R8G8B8),
>  
> @@ -190,7 +201,8 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
>     V_(R16G16B16A16_SINT,    SHORT,          NONE),
>     V_(R16G16B16A16_USCALED, UNSIGNED_SHORT, NONE),
>     V_(R16G16B16A16_SSCALED, SHORT,          NONE),
> -   V_(R16G16B16A16_FLOAT,   HALF_FLOAT,     NONE),
> +   VT(R16G16B16A16_FLOAT,   HALF_FLOAT,     EXT_A16B16G16R16F | EXT_FORMAT, SWIZ(X, Y, Z, W), A16B16G16R16F),
> +   VT(R16G16B16X16_FLOAT,   HALF_FLOAT,     EXT_A16B16G16R16F | EXT_FORMAT, SWIZ(X, Y, Z, 1), A16B16G16R16F),
>  
>     V_(R32G32_UNORM,   UNSIGNED_INT, NONE),
>     V_(R32G32_SNORM,   INT,          NONE),
> @@ -198,7 +210,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
>     V_(R32G32_SINT,    INT,          NONE),
>     V_(R32G32_USCALED, UNSIGNED_INT, NONE),
>     V_(R32G32_SSCALED, INT,          NONE),
> -   V_(R32G32_FLOAT,   FLOAT,        NONE),
> +   VT(R32G32_FLOAT,   FLOAT,        EXT_G32R32F | EXT_FORMAT, SWIZ(X, Y, Z, W), G32R32F),
>     V_(R32G32_FIXED,   FIXED,        NONE),
>  
>     /* 96-bit */
> -- 
> 2.11.0
> 
> _______________________________________________
> etnaviv mailing list
> etnaviv at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv


More information about the mesa-dev mailing list