[Mesa-dev] [PATCH 1/2] anv: Advertise support for two more sRGB formats

Kenneth Graunke kenneth at whitecape.org
Wed Aug 2 08:48:01 UTC 2017


On Tuesday, August 1, 2017 6:16:31 PM PDT Jason Ekstrand wrote:
> Unreal Engine 4 seems to really like VK_FORMAT_R8_SRGB for some reason.
> We don't technically have the hardware format but we do have L8_SRGB.
> It's easy enough to fake with that and a swizzle.  While we're at it, we
> may as well support R8G8_SRGB using L8A8_SRGB.
> ---
>  src/intel/vulkan/anv_formats.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
> index c656d7e..2309dfe 100644
> --- a/src/intel/vulkan/anv_formats.c
> +++ b/src/intel/vulkan/anv_formats.c
> @@ -74,14 +74,16 @@ static const struct anv_format anv_formats[] = {
>     fmt(VK_FORMAT_R8_SSCALED,              ISL_FORMAT_R8_SSCALED),
>     fmt(VK_FORMAT_R8_UINT,                 ISL_FORMAT_R8_UINT),
>     fmt(VK_FORMAT_R8_SINT,                 ISL_FORMAT_R8_SINT),
> -   fmt(VK_FORMAT_R8_SRGB,                 ISL_FORMAT_UNSUPPORTED),
> +   swiz_fmt(VK_FORMAT_R8_SRGB,            ISL_FORMAT_L8_UNORM_SRGB,
> +                                          _ISL_SWIZZLE(RED, ZERO, ZERO, ONE)),
>     fmt(VK_FORMAT_R8G8_UNORM,              ISL_FORMAT_R8G8_UNORM),
>     fmt(VK_FORMAT_R8G8_SNORM,              ISL_FORMAT_R8G8_SNORM),
>     fmt(VK_FORMAT_R8G8_USCALED,            ISL_FORMAT_R8G8_USCALED),
>     fmt(VK_FORMAT_R8G8_SSCALED,            ISL_FORMAT_R8G8_SSCALED),
>     fmt(VK_FORMAT_R8G8_UINT,               ISL_FORMAT_R8G8_UINT),
>     fmt(VK_FORMAT_R8G8_SINT,               ISL_FORMAT_R8G8_SINT),
> -   fmt(VK_FORMAT_R8G8_SRGB,               ISL_FORMAT_UNSUPPORTED), /* L8A8_UNORM_SRGB */
> +   swiz_fmt(VK_FORMAT_R8G8_SRGB,          ISL_FORMAT_L8A8_UNORM_SRGB,
> +                                          _ISL_SWIZZLE(RED, ALPHA, ZERO, ONE)),
>     fmt(VK_FORMAT_R8G8B8_UNORM,            ISL_FORMAT_R8G8B8_UNORM),
>     fmt(VK_FORMAT_R8G8B8_SNORM,            ISL_FORMAT_R8G8B8_SNORM),
>     fmt(VK_FORMAT_R8G8B8_USCALED,          ISL_FORMAT_R8G8B8_USCALED),
> 

L/LA formats are still wasteful (converted to RGBA early in the pipe), but
I guess the alternative is for the app to fall back to RGBA...which is the
same cost...

Not thrilled about this but I guess it's the best we can do.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170802/9b247527/attachment-0001.sig>


More information about the mesa-dev mailing list