From addc2a9d021cddfebf01db37add9de84ba8def81 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Thu, 12 Nov 2015 12:14:43 -0800 Subject: [PATCH] anv: Remove redundant fields anv_format::bs,bw,bh,bd Instead, use the equivalent fields in anv_format::isl_layout. --- src/vulkan/anv_formats.c | 218 +++++++++++++++++------------------ src/vulkan/anv_image.c | 23 ++-- src/vulkan/anv_private.h | 5 +- src/vulkan/anv_wsi_wayland.c | 4 +- 4 files changed, 127 insertions(+), 123 deletions(-) diff --git a/src/vulkan/anv_formats.c b/src/vulkan/anv_formats.c index 3e7a6f6e5a8..942e7cfb484 100644 --- a/src/vulkan/anv_formats.c +++ b/src/vulkan/anv_formats.c @@ -29,12 +29,12 @@ .vk_format = __vk_fmt, \ .name = #__vk_fmt, \ .surface_format = __hw_fmt, \ - .bw = 1, .bh = 1, .bd = 1, \ + .isl_layout = &isl_format_layouts[__hw_fmt], \ __VA_ARGS__ \ } static const struct anv_format anv_formats[] = { - fmt(VK_FORMAT_UNDEFINED, ISL_FORMAT_RAW, .bs = 1, .num_channels = 1), + fmt(VK_FORMAT_UNDEFINED, ISL_FORMAT_RAW, .num_channels = 1), fmt(VK_FORMAT_R4G4_UNORM, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_R4G4_USCALED, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_R4G4B4A4_UNORM, ISL_FORMAT_UNSUPPORTED), @@ -43,94 +43,94 @@ static const struct anv_format anv_formats[] = { fmt(VK_FORMAT_R5G6B5_USCALED, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_R5G5B5A1_UNORM, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_R5G5B5A1_USCALED, ISL_FORMAT_UNSUPPORTED), - fmt(VK_FORMAT_R8_UNORM, ISL_FORMAT_R8_UNORM, .bs = 1, .num_channels = 1), - fmt(VK_FORMAT_R8_SNORM, ISL_FORMAT_R8_SNORM, .bs = 1, .num_channels = 1,), - fmt(VK_FORMAT_R8_USCALED, ISL_FORMAT_R8_USCALED, .bs = 1, .num_channels = 1), - fmt(VK_FORMAT_R8_SSCALED, ISL_FORMAT_R8_SSCALED, .bs = 1, .num_channels = 1), - fmt(VK_FORMAT_R8_UINT, ISL_FORMAT_R8_UINT, .bs = 1, .num_channels = 1), - fmt(VK_FORMAT_R8_SINT, ISL_FORMAT_R8_SINT, .bs = 1, .num_channels = 1), + fmt(VK_FORMAT_R8_UNORM, ISL_FORMAT_R8_UNORM, .num_channels = 1), + fmt(VK_FORMAT_R8_SNORM, ISL_FORMAT_R8_SNORM, .num_channels = 1,), + fmt(VK_FORMAT_R8_USCALED, ISL_FORMAT_R8_USCALED, .num_channels = 1), + fmt(VK_FORMAT_R8_SSCALED, ISL_FORMAT_R8_SSCALED, .num_channels = 1), + fmt(VK_FORMAT_R8_UINT, ISL_FORMAT_R8_UINT, .num_channels = 1), + fmt(VK_FORMAT_R8_SINT, ISL_FORMAT_R8_SINT, .num_channels = 1), fmt(VK_FORMAT_R8_SRGB, ISL_FORMAT_UNSUPPORTED), - fmt(VK_FORMAT_R8G8_UNORM, ISL_FORMAT_R8G8_UNORM, .bs = 2, .num_channels = 2), - fmt(VK_FORMAT_R8G8_SNORM, ISL_FORMAT_R8G8_SNORM, .bs = 2, .num_channels = 2), - fmt(VK_FORMAT_R8G8_USCALED, ISL_FORMAT_R8G8_USCALED, .bs = 2, .num_channels = 2), - fmt(VK_FORMAT_R8G8_SSCALED, ISL_FORMAT_R8G8_SSCALED, .bs = 2, .num_channels = 2), - fmt(VK_FORMAT_R8G8_UINT, ISL_FORMAT_R8G8_UINT, .bs = 2, .num_channels = 2), - fmt(VK_FORMAT_R8G8_SINT, ISL_FORMAT_R8G8_SINT, .bs = 2, .num_channels = 2), + fmt(VK_FORMAT_R8G8_UNORM, ISL_FORMAT_R8G8_UNORM, .num_channels = 2), + fmt(VK_FORMAT_R8G8_SNORM, ISL_FORMAT_R8G8_SNORM, .num_channels = 2), + fmt(VK_FORMAT_R8G8_USCALED, ISL_FORMAT_R8G8_USCALED, .num_channels = 2), + fmt(VK_FORMAT_R8G8_SSCALED, ISL_FORMAT_R8G8_SSCALED, .num_channels = 2), + fmt(VK_FORMAT_R8G8_UINT, ISL_FORMAT_R8G8_UINT, .num_channels = 2), + fmt(VK_FORMAT_R8G8_SINT, ISL_FORMAT_R8G8_SINT, .num_channels = 2), fmt(VK_FORMAT_R8G8_SRGB, ISL_FORMAT_UNSUPPORTED), /* L8A8_UNORM_SRGB */ - fmt(VK_FORMAT_R8G8B8_UNORM, ISL_FORMAT_R8G8B8X8_UNORM, .bs = 3, .num_channels = 3), - fmt(VK_FORMAT_R8G8B8_SNORM, ISL_FORMAT_R8G8B8_SNORM, .bs = 3, .num_channels = 3), - fmt(VK_FORMAT_R8G8B8_USCALED, ISL_FORMAT_R8G8B8_USCALED, .bs = 3, .num_channels = 3), - fmt(VK_FORMAT_R8G8B8_SSCALED, ISL_FORMAT_R8G8B8_SSCALED, .bs = 3, .num_channels = 3), - fmt(VK_FORMAT_R8G8B8_UINT, ISL_FORMAT_R8G8B8_UINT, .bs = 3, .num_channels = 3), - fmt(VK_FORMAT_R8G8B8_SINT, ISL_FORMAT_R8G8B8_SINT, .bs = 3, .num_channels = 3), + fmt(VK_FORMAT_R8G8B8_UNORM, ISL_FORMAT_R8G8B8X8_UNORM, .num_channels = 3), + fmt(VK_FORMAT_R8G8B8_SNORM, ISL_FORMAT_R8G8B8_SNORM, .num_channels = 3), + fmt(VK_FORMAT_R8G8B8_USCALED, ISL_FORMAT_R8G8B8_USCALED, .num_channels = 3), + fmt(VK_FORMAT_R8G8B8_SSCALED, ISL_FORMAT_R8G8B8_SSCALED, .num_channels = 3), + fmt(VK_FORMAT_R8G8B8_UINT, ISL_FORMAT_R8G8B8_UINT, .num_channels = 3), + fmt(VK_FORMAT_R8G8B8_SINT, ISL_FORMAT_R8G8B8_SINT, .num_channels = 3), fmt(VK_FORMAT_R8G8B8_SRGB, ISL_FORMAT_UNSUPPORTED), /* B8G8R8A8_UNORM_SRGB */ - fmt(VK_FORMAT_R8G8B8A8_UNORM, ISL_FORMAT_R8G8B8A8_UNORM, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R8G8B8A8_SNORM, ISL_FORMAT_R8G8B8A8_SNORM, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R8G8B8A8_USCALED, ISL_FORMAT_R8G8B8A8_USCALED, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R8G8B8A8_SSCALED, ISL_FORMAT_R8G8B8A8_SSCALED, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R8G8B8A8_UINT, ISL_FORMAT_R8G8B8A8_UINT, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R8G8B8A8_SINT, ISL_FORMAT_R8G8B8A8_SINT, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R8G8B8A8_SRGB, ISL_FORMAT_R8G8B8A8_UNORM_SRGB, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R10G10B10A2_UNORM, ISL_FORMAT_R10G10B10A2_UNORM, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R10G10B10A2_SNORM, ISL_FORMAT_R10G10B10A2_SNORM, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R10G10B10A2_USCALED, ISL_FORMAT_R10G10B10A2_USCALED, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R10G10B10A2_SSCALED, ISL_FORMAT_R10G10B10A2_SSCALED, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R10G10B10A2_UINT, ISL_FORMAT_R10G10B10A2_UINT, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R10G10B10A2_SINT, ISL_FORMAT_R10G10B10A2_SINT, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_R16_UNORM, ISL_FORMAT_R16_UNORM, .bs = 2, .num_channels = 1), - fmt(VK_FORMAT_R16_SNORM, ISL_FORMAT_R16_SNORM, .bs = 2, .num_channels = 1), - fmt(VK_FORMAT_R16_USCALED, ISL_FORMAT_R16_USCALED, .bs = 2, .num_channels = 1), - fmt(VK_FORMAT_R16_SSCALED, ISL_FORMAT_R16_SSCALED, .bs = 2, .num_channels = 1), - fmt(VK_FORMAT_R16_UINT, ISL_FORMAT_R16_UINT, .bs = 2, .num_channels = 1), - fmt(VK_FORMAT_R16_SINT, ISL_FORMAT_R16_SINT, .bs = 2, .num_channels = 1), - fmt(VK_FORMAT_R16_SFLOAT, ISL_FORMAT_R16_FLOAT, .bs = 2, .num_channels = 1), - fmt(VK_FORMAT_R16G16_UNORM, ISL_FORMAT_R16G16_UNORM, .bs = 4, .num_channels = 2), - fmt(VK_FORMAT_R16G16_SNORM, ISL_FORMAT_R16G16_SNORM, .bs = 4, .num_channels = 2), - fmt(VK_FORMAT_R16G16_USCALED, ISL_FORMAT_R16G16_USCALED, .bs = 4, .num_channels = 2), - fmt(VK_FORMAT_R16G16_SSCALED, ISL_FORMAT_R16G16_SSCALED, .bs = 4, .num_channels = 2), - fmt(VK_FORMAT_R16G16_UINT, ISL_FORMAT_R16G16_UINT, .bs = 4, .num_channels = 2), - fmt(VK_FORMAT_R16G16_SINT, ISL_FORMAT_R16G16_SINT, .bs = 4, .num_channels = 2), - fmt(VK_FORMAT_R16G16_SFLOAT, ISL_FORMAT_R16G16_FLOAT, .bs = 4, .num_channels = 2), - fmt(VK_FORMAT_R16G16B16_UNORM, ISL_FORMAT_R16G16B16_UNORM, .bs = 6, .num_channels = 3), - fmt(VK_FORMAT_R16G16B16_SNORM, ISL_FORMAT_R16G16B16_SNORM, .bs = 6, .num_channels = 3), - fmt(VK_FORMAT_R16G16B16_USCALED, ISL_FORMAT_R16G16B16_USCALED, .bs = 6, .num_channels = 3), - fmt(VK_FORMAT_R16G16B16_SSCALED, ISL_FORMAT_R16G16B16_SSCALED, .bs = 6, .num_channels = 3), - fmt(VK_FORMAT_R16G16B16_UINT, ISL_FORMAT_R16G16B16_UINT, .bs = 6, .num_channels = 3), - fmt(VK_FORMAT_R16G16B16_SINT, ISL_FORMAT_R16G16B16_SINT, .bs = 6, .num_channels = 3), - fmt(VK_FORMAT_R16G16B16_SFLOAT, ISL_FORMAT_R16G16B16_FLOAT, .bs = 6, .num_channels = 3), - fmt(VK_FORMAT_R16G16B16A16_UNORM, ISL_FORMAT_R16G16B16A16_UNORM, .bs = 8, .num_channels = 4), - fmt(VK_FORMAT_R16G16B16A16_SNORM, ISL_FORMAT_R16G16B16A16_SNORM, .bs = 8, .num_channels = 4), - fmt(VK_FORMAT_R16G16B16A16_USCALED, ISL_FORMAT_R16G16B16A16_USCALED, .bs = 8, .num_channels = 4), - fmt(VK_FORMAT_R16G16B16A16_SSCALED, ISL_FORMAT_R16G16B16A16_SSCALED, .bs = 8, .num_channels = 4), - fmt(VK_FORMAT_R16G16B16A16_UINT, ISL_FORMAT_R16G16B16A16_UINT, .bs = 8, .num_channels = 4), - fmt(VK_FORMAT_R16G16B16A16_SINT, ISL_FORMAT_R16G16B16A16_SINT, .bs = 8, .num_channels = 4), - fmt(VK_FORMAT_R16G16B16A16_SFLOAT, ISL_FORMAT_R16G16B16A16_FLOAT, .bs = 8, .num_channels = 4), - fmt(VK_FORMAT_R32_UINT, ISL_FORMAT_R32_UINT, .bs = 4, .num_channels = 1,), - fmt(VK_FORMAT_R32_SINT, ISL_FORMAT_R32_SINT, .bs = 4, .num_channels = 1,), - fmt(VK_FORMAT_R32_SFLOAT, ISL_FORMAT_R32_FLOAT, .bs = 4, .num_channels = 1,), - fmt(VK_FORMAT_R32G32_UINT, ISL_FORMAT_R32G32_UINT, .bs = 8, .num_channels = 2,), - fmt(VK_FORMAT_R32G32_SINT, ISL_FORMAT_R32G32_SINT, .bs = 8, .num_channels = 2,), - fmt(VK_FORMAT_R32G32_SFLOAT, ISL_FORMAT_R32G32_FLOAT, .bs = 8, .num_channels = 2,), - fmt(VK_FORMAT_R32G32B32_UINT, ISL_FORMAT_R32G32B32_UINT, .bs = 12, .num_channels = 3,), - fmt(VK_FORMAT_R32G32B32_SINT, ISL_FORMAT_R32G32B32_SINT, .bs = 12, .num_channels = 3,), - fmt(VK_FORMAT_R32G32B32_SFLOAT, ISL_FORMAT_R32G32B32_FLOAT, .bs = 12, .num_channels = 3,), - fmt(VK_FORMAT_R32G32B32A32_UINT, ISL_FORMAT_R32G32B32A32_UINT, .bs = 16, .num_channels = 4,), - fmt(VK_FORMAT_R32G32B32A32_SINT, ISL_FORMAT_R32G32B32A32_SINT, .bs = 16, .num_channels = 4,), - fmt(VK_FORMAT_R32G32B32A32_SFLOAT, ISL_FORMAT_R32G32B32A32_FLOAT, .bs = 16, .num_channels = 4,), - fmt(VK_FORMAT_R64_SFLOAT, ISL_FORMAT_R64_FLOAT, .bs = 8, .num_channels = 1), - fmt(VK_FORMAT_R64G64_SFLOAT, ISL_FORMAT_R64G64_FLOAT, .bs = 16, .num_channels = 2), - fmt(VK_FORMAT_R64G64B64_SFLOAT, ISL_FORMAT_R64G64B64_FLOAT, .bs = 24, .num_channels = 3), - fmt(VK_FORMAT_R64G64B64A64_SFLOAT, ISL_FORMAT_R64G64B64A64_FLOAT, .bs = 32, .num_channels = 4), - fmt(VK_FORMAT_R11G11B10_UFLOAT, ISL_FORMAT_R11G11B10_FLOAT, .bs = 4, .num_channels = 3), - fmt(VK_FORMAT_R9G9B9E5_UFLOAT, ISL_FORMAT_R9G9B9E5_SHAREDEXP, .bs = 4, .num_channels = 3), - - fmt(VK_FORMAT_D16_UNORM, ISL_FORMAT_R16_UNORM, .bs = 2, .num_channels = 1, .depth_format = D16_UNORM), - fmt(VK_FORMAT_D24_UNORM_X8, ISL_FORMAT_R24_UNORM_X8_TYPELESS, .bs = 4, .num_channels = 1, .depth_format = D24_UNORM_X8_UINT), - fmt(VK_FORMAT_D32_SFLOAT, ISL_FORMAT_R32_FLOAT, .bs = 4, .num_channels = 1, .depth_format = D32_FLOAT), - fmt(VK_FORMAT_S8_UINT, ISL_FORMAT_R8_UINT, .bs = 1, .num_channels = 1, .has_stencil = true), - fmt(VK_FORMAT_D16_UNORM_S8_UINT, ISL_FORMAT_R16_UNORM, .bs = 2, .num_channels = 2, .depth_format = D16_UNORM, .has_stencil = true), - fmt(VK_FORMAT_D24_UNORM_S8_UINT, ISL_FORMAT_R24_UNORM_X8_TYPELESS, .bs = 4, .num_channels = 2, .depth_format = D24_UNORM_X8_UINT, .has_stencil = true), - fmt(VK_FORMAT_D32_SFLOAT_S8_UINT, ISL_FORMAT_R32_FLOAT, .bs = 4, .num_channels = 2, .depth_format = D32_FLOAT, .has_stencil = true), + fmt(VK_FORMAT_R8G8B8A8_UNORM, ISL_FORMAT_R8G8B8A8_UNORM, .num_channels = 4), + fmt(VK_FORMAT_R8G8B8A8_SNORM, ISL_FORMAT_R8G8B8A8_SNORM, .num_channels = 4), + fmt(VK_FORMAT_R8G8B8A8_USCALED, ISL_FORMAT_R8G8B8A8_USCALED, .num_channels = 4), + fmt(VK_FORMAT_R8G8B8A8_SSCALED, ISL_FORMAT_R8G8B8A8_SSCALED, .num_channels = 4), + fmt(VK_FORMAT_R8G8B8A8_UINT, ISL_FORMAT_R8G8B8A8_UINT, .num_channels = 4), + fmt(VK_FORMAT_R8G8B8A8_SINT, ISL_FORMAT_R8G8B8A8_SINT, .num_channels = 4), + fmt(VK_FORMAT_R8G8B8A8_SRGB, ISL_FORMAT_R8G8B8A8_UNORM_SRGB, .num_channels = 4), + fmt(VK_FORMAT_R10G10B10A2_UNORM, ISL_FORMAT_R10G10B10A2_UNORM, .num_channels = 4), + fmt(VK_FORMAT_R10G10B10A2_SNORM, ISL_FORMAT_R10G10B10A2_SNORM, .num_channels = 4), + fmt(VK_FORMAT_R10G10B10A2_USCALED, ISL_FORMAT_R10G10B10A2_USCALED, .num_channels = 4), + fmt(VK_FORMAT_R10G10B10A2_SSCALED, ISL_FORMAT_R10G10B10A2_SSCALED, .num_channels = 4), + fmt(VK_FORMAT_R10G10B10A2_UINT, ISL_FORMAT_R10G10B10A2_UINT, .num_channels = 4), + fmt(VK_FORMAT_R10G10B10A2_SINT, ISL_FORMAT_R10G10B10A2_SINT, .num_channels = 4), + fmt(VK_FORMAT_R16_UNORM, ISL_FORMAT_R16_UNORM, .num_channels = 1), + fmt(VK_FORMAT_R16_SNORM, ISL_FORMAT_R16_SNORM, .num_channels = 1), + fmt(VK_FORMAT_R16_USCALED, ISL_FORMAT_R16_USCALED, .num_channels = 1), + fmt(VK_FORMAT_R16_SSCALED, ISL_FORMAT_R16_SSCALED, .num_channels = 1), + fmt(VK_FORMAT_R16_UINT, ISL_FORMAT_R16_UINT, .num_channels = 1), + fmt(VK_FORMAT_R16_SINT, ISL_FORMAT_R16_SINT, .num_channels = 1), + fmt(VK_FORMAT_R16_SFLOAT, ISL_FORMAT_R16_FLOAT, .num_channels = 1), + fmt(VK_FORMAT_R16G16_UNORM, ISL_FORMAT_R16G16_UNORM, .num_channels = 2), + fmt(VK_FORMAT_R16G16_SNORM, ISL_FORMAT_R16G16_SNORM, .num_channels = 2), + fmt(VK_FORMAT_R16G16_USCALED, ISL_FORMAT_R16G16_USCALED, .num_channels = 2), + fmt(VK_FORMAT_R16G16_SSCALED, ISL_FORMAT_R16G16_SSCALED, .num_channels = 2), + fmt(VK_FORMAT_R16G16_UINT, ISL_FORMAT_R16G16_UINT, .num_channels = 2), + fmt(VK_FORMAT_R16G16_SINT, ISL_FORMAT_R16G16_SINT, .num_channels = 2), + fmt(VK_FORMAT_R16G16_SFLOAT, ISL_FORMAT_R16G16_FLOAT, .num_channels = 2), + fmt(VK_FORMAT_R16G16B16_UNORM, ISL_FORMAT_R16G16B16_UNORM, .num_channels = 3), + fmt(VK_FORMAT_R16G16B16_SNORM, ISL_FORMAT_R16G16B16_SNORM, .num_channels = 3), + fmt(VK_FORMAT_R16G16B16_USCALED, ISL_FORMAT_R16G16B16_USCALED, .num_channels = 3), + fmt(VK_FORMAT_R16G16B16_SSCALED, ISL_FORMAT_R16G16B16_SSCALED, .num_channels = 3), + fmt(VK_FORMAT_R16G16B16_UINT, ISL_FORMAT_R16G16B16_UINT, .num_channels = 3), + fmt(VK_FORMAT_R16G16B16_SINT, ISL_FORMAT_R16G16B16_SINT, .num_channels = 3), + fmt(VK_FORMAT_R16G16B16_SFLOAT, ISL_FORMAT_R16G16B16_FLOAT, .num_channels = 3), + fmt(VK_FORMAT_R16G16B16A16_UNORM, ISL_FORMAT_R16G16B16A16_UNORM, .num_channels = 4), + fmt(VK_FORMAT_R16G16B16A16_SNORM, ISL_FORMAT_R16G16B16A16_SNORM, .num_channels = 4), + fmt(VK_FORMAT_R16G16B16A16_USCALED, ISL_FORMAT_R16G16B16A16_USCALED, .num_channels = 4), + fmt(VK_FORMAT_R16G16B16A16_SSCALED, ISL_FORMAT_R16G16B16A16_SSCALED, .num_channels = 4), + fmt(VK_FORMAT_R16G16B16A16_UINT, ISL_FORMAT_R16G16B16A16_UINT, .num_channels = 4), + fmt(VK_FORMAT_R16G16B16A16_SINT, ISL_FORMAT_R16G16B16A16_SINT, .num_channels = 4), + fmt(VK_FORMAT_R16G16B16A16_SFLOAT, ISL_FORMAT_R16G16B16A16_FLOAT, .num_channels = 4), + fmt(VK_FORMAT_R32_UINT, ISL_FORMAT_R32_UINT, .num_channels = 1,), + fmt(VK_FORMAT_R32_SINT, ISL_FORMAT_R32_SINT, .num_channels = 1,), + fmt(VK_FORMAT_R32_SFLOAT, ISL_FORMAT_R32_FLOAT, .num_channels = 1,), + fmt(VK_FORMAT_R32G32_UINT, ISL_FORMAT_R32G32_UINT, .num_channels = 2,), + fmt(VK_FORMAT_R32G32_SINT, ISL_FORMAT_R32G32_SINT, .num_channels = 2,), + fmt(VK_FORMAT_R32G32_SFLOAT, ISL_FORMAT_R32G32_FLOAT, .num_channels = 2,), + fmt(VK_FORMAT_R32G32B32_UINT, ISL_FORMAT_R32G32B32_UINT, .num_channels = 3,), + fmt(VK_FORMAT_R32G32B32_SINT, ISL_FORMAT_R32G32B32_SINT, .num_channels = 3,), + fmt(VK_FORMAT_R32G32B32_SFLOAT, ISL_FORMAT_R32G32B32_FLOAT, .num_channels = 3,), + fmt(VK_FORMAT_R32G32B32A32_UINT, ISL_FORMAT_R32G32B32A32_UINT, .num_channels = 4,), + fmt(VK_FORMAT_R32G32B32A32_SINT, ISL_FORMAT_R32G32B32A32_SINT, .num_channels = 4,), + fmt(VK_FORMAT_R32G32B32A32_SFLOAT, ISL_FORMAT_R32G32B32A32_FLOAT, .num_channels = 4,), + fmt(VK_FORMAT_R64_SFLOAT, ISL_FORMAT_R64_FLOAT, .num_channels = 1), + fmt(VK_FORMAT_R64G64_SFLOAT, ISL_FORMAT_R64G64_FLOAT, .num_channels = 2), + fmt(VK_FORMAT_R64G64B64_SFLOAT, ISL_FORMAT_R64G64B64_FLOAT, .num_channels = 3), + fmt(VK_FORMAT_R64G64B64A64_SFLOAT, ISL_FORMAT_R64G64B64A64_FLOAT, .num_channels = 4), + fmt(VK_FORMAT_R11G11B10_UFLOAT, ISL_FORMAT_R11G11B10_FLOAT, .num_channels = 3), + fmt(VK_FORMAT_R9G9B9E5_UFLOAT, ISL_FORMAT_R9G9B9E5_SHAREDEXP, .num_channels = 3), + + fmt(VK_FORMAT_D16_UNORM, ISL_FORMAT_R16_UNORM, .num_channels = 1, .depth_format = D16_UNORM), + fmt(VK_FORMAT_D24_UNORM_X8, ISL_FORMAT_R24_UNORM_X8_TYPELESS, .num_channels = 1, .depth_format = D24_UNORM_X8_UINT), + fmt(VK_FORMAT_D32_SFLOAT, ISL_FORMAT_R32_FLOAT, .num_channels = 1, .depth_format = D32_FLOAT), + fmt(VK_FORMAT_S8_UINT, ISL_FORMAT_R8_UINT, .num_channels = 1, .has_stencil = true), + fmt(VK_FORMAT_D16_UNORM_S8_UINT, ISL_FORMAT_R16_UNORM, .num_channels = 2, .depth_format = D16_UNORM, .has_stencil = true), + fmt(VK_FORMAT_D24_UNORM_S8_UINT, ISL_FORMAT_R24_UNORM_X8_TYPELESS, .num_channels = 2, .depth_format = D24_UNORM_X8_UINT, .has_stencil = true), + fmt(VK_FORMAT_D32_SFLOAT_S8_UINT, ISL_FORMAT_R32_FLOAT, .num_channels = 2, .depth_format = D32_FLOAT, .has_stencil = true), fmt(VK_FORMAT_BC1_RGB_UNORM, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_BC1_RGB_SRGB, ISL_FORMAT_UNSUPPORTED), @@ -148,16 +148,16 @@ static const struct anv_format anv_formats[] = { fmt(VK_FORMAT_BC6H_SFLOAT, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_BC7_UNORM, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_BC7_SRGB, ISL_FORMAT_UNSUPPORTED), - fmt(VK_FORMAT_ETC2_R8G8B8_UNORM, ISL_FORMAT_ETC2_RGB8 , .bs = 8, .bw = 4, .bh = 4), - fmt(VK_FORMAT_ETC2_R8G8B8_SRGB, ISL_FORMAT_ETC2_SRGB8 , .bs = 8, .bw = 4, .bh = 4), - fmt(VK_FORMAT_ETC2_R8G8B8A1_UNORM, ISL_FORMAT_ETC2_RGB8_PTA , .bs = 8, .bw = 4, .bh = 4), - fmt(VK_FORMAT_ETC2_R8G8B8A1_SRGB, ISL_FORMAT_ETC2_SRGB8_PTA , .bs = 8, .bw = 4, .bh = 4), - fmt(VK_FORMAT_ETC2_R8G8B8A8_UNORM, ISL_FORMAT_ETC2_EAC_RGBA8 , .bs = 16, .bw = 4, .bh = 4), - fmt(VK_FORMAT_ETC2_R8G8B8A8_SRGB, ISL_FORMAT_ETC2_EAC_SRGB8_A8, .bs = 16, .bw = 4, .bh = 4), - fmt(VK_FORMAT_EAC_R11_UNORM, ISL_FORMAT_EAC_R11 , .bs = 8, .bw = 4, .bh = 4), - fmt(VK_FORMAT_EAC_R11_SNORM, ISL_FORMAT_EAC_SIGNED_R11 , .bs = 8, .bw = 4, .bh = 4), - fmt(VK_FORMAT_EAC_R11G11_UNORM, ISL_FORMAT_EAC_RG11 , .bs = 16, .bw = 4, .bh = 4), - fmt(VK_FORMAT_EAC_R11G11_SNORM, ISL_FORMAT_EAC_SIGNED_RG11 , .bs = 16, .bw = 4, .bh = 4), + fmt(VK_FORMAT_ETC2_R8G8B8_UNORM, ISL_FORMAT_ETC2_RGB8), + fmt(VK_FORMAT_ETC2_R8G8B8_SRGB, ISL_FORMAT_ETC2_SRGB8), + fmt(VK_FORMAT_ETC2_R8G8B8A1_UNORM, ISL_FORMAT_ETC2_RGB8_PTA), + fmt(VK_FORMAT_ETC2_R8G8B8A1_SRGB, ISL_FORMAT_ETC2_SRGB8_PTA), + fmt(VK_FORMAT_ETC2_R8G8B8A8_UNORM, ISL_FORMAT_ETC2_EAC_RGBA8), + fmt(VK_FORMAT_ETC2_R8G8B8A8_SRGB, ISL_FORMAT_ETC2_EAC_SRGB8_A8), + fmt(VK_FORMAT_EAC_R11_UNORM, ISL_FORMAT_EAC_R11), + fmt(VK_FORMAT_EAC_R11_SNORM, ISL_FORMAT_EAC_SIGNED_R11), + fmt(VK_FORMAT_EAC_R11G11_UNORM, ISL_FORMAT_EAC_RG11), + fmt(VK_FORMAT_EAC_R11G11_SNORM, ISL_FORMAT_EAC_SIGNED_RG11), fmt(VK_FORMAT_ASTC_4x4_UNORM, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_ASTC_4x4_SRGB, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_ASTC_5x4_UNORM, ISL_FORMAT_UNSUPPORTED), @@ -186,9 +186,9 @@ static const struct anv_format anv_formats[] = { fmt(VK_FORMAT_ASTC_12x10_SRGB, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_ASTC_12x12_UNORM, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_ASTC_12x12_SRGB, ISL_FORMAT_UNSUPPORTED), - fmt(VK_FORMAT_B4G4R4A4_UNORM, ISL_FORMAT_B4G4R4A4_UNORM, .bs = 2, .num_channels = 4), - fmt(VK_FORMAT_B5G5R5A1_UNORM, ISL_FORMAT_B5G5R5A1_UNORM, .bs = 2, .num_channels = 4), - fmt(VK_FORMAT_B5G6R5_UNORM, ISL_FORMAT_B5G6R5_UNORM, .bs = 2, .num_channels = 3), + fmt(VK_FORMAT_B4G4R4A4_UNORM, ISL_FORMAT_B4G4R4A4_UNORM, .num_channels = 4), + fmt(VK_FORMAT_B5G5R5A1_UNORM, ISL_FORMAT_B5G5R5A1_UNORM, .num_channels = 4), + fmt(VK_FORMAT_B5G6R5_UNORM, ISL_FORMAT_B5G6R5_UNORM, .num_channels = 3), fmt(VK_FORMAT_B5G6R5_USCALED, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_B8G8R8_UNORM, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_B8G8R8_SNORM, ISL_FORMAT_UNSUPPORTED), @@ -197,19 +197,19 @@ static const struct anv_format anv_formats[] = { fmt(VK_FORMAT_B8G8R8_UINT, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_B8G8R8_SINT, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_B8G8R8_SRGB, ISL_FORMAT_UNSUPPORTED), - fmt(VK_FORMAT_B8G8R8A8_UNORM, ISL_FORMAT_B8G8R8A8_UNORM, .bs = 4, .num_channels = 4), + fmt(VK_FORMAT_B8G8R8A8_UNORM, ISL_FORMAT_B8G8R8A8_UNORM, .num_channels = 4), fmt(VK_FORMAT_B8G8R8A8_SNORM, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_B8G8R8A8_USCALED, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_B8G8R8A8_SSCALED, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_B8G8R8A8_UINT, ISL_FORMAT_UNSUPPORTED), fmt(VK_FORMAT_B8G8R8A8_SINT, ISL_FORMAT_UNSUPPORTED), - fmt(VK_FORMAT_B8G8R8A8_SRGB, ISL_FORMAT_B8G8R8A8_UNORM_SRGB, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_B10G10R10A2_UNORM, ISL_FORMAT_B10G10R10A2_UNORM, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_B10G10R10A2_SNORM, ISL_FORMAT_B10G10R10A2_SNORM, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_B10G10R10A2_USCALED, ISL_FORMAT_B10G10R10A2_USCALED, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_B10G10R10A2_SSCALED, ISL_FORMAT_B10G10R10A2_SSCALED, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_B10G10R10A2_UINT, ISL_FORMAT_B10G10R10A2_UINT, .bs = 4, .num_channels = 4), - fmt(VK_FORMAT_B10G10R10A2_SINT, ISL_FORMAT_B10G10R10A2_SINT, .bs = 4, .num_channels = 4) + fmt(VK_FORMAT_B8G8R8A8_SRGB, ISL_FORMAT_B8G8R8A8_UNORM_SRGB, .num_channels = 4), + fmt(VK_FORMAT_B10G10R10A2_UNORM, ISL_FORMAT_B10G10R10A2_UNORM, .num_channels = 4), + fmt(VK_FORMAT_B10G10R10A2_SNORM, ISL_FORMAT_B10G10R10A2_SNORM, .num_channels = 4), + fmt(VK_FORMAT_B10G10R10A2_USCALED, ISL_FORMAT_B10G10R10A2_USCALED, .num_channels = 4), + fmt(VK_FORMAT_B10G10R10A2_SSCALED, ISL_FORMAT_B10G10R10A2_SSCALED, .num_channels = 4), + fmt(VK_FORMAT_B10G10R10A2_UINT, ISL_FORMAT_B10G10R10A2_UINT, .num_channels = 4), + fmt(VK_FORMAT_B10G10R10A2_SINT, ISL_FORMAT_B10G10R10A2_SINT, .num_channels = 4) }; #undef fmt @@ -250,7 +250,7 @@ anv_physical_device_get_format_properties(struct anv_physical_device *physical_d if (physical_device->info->is_haswell) gen += 5; - if (format->surface_format == ISL_FORMAT_UNSUPPORTED) + if (format->surface_format== ISL_FORMAT_UNSUPPORTED) goto unsupported; uint32_t linear = 0, tiled = 0; diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index 247a75dd8f4..ecd34e3ab5b 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -152,8 +152,12 @@ anv_image_make_surface(const struct anv_image_create_info *create_info, const struct anv_tile_info *tile_info = &anv_tile_info_table[tile_mode]; - const uint32_t i = MAX(4, format->bw); /* FINISHME: Stop hardcoding subimage alignment */ - const uint32_t j = MAX(4, format->bh); /* FINISHME: Stop hardcoding subimage alignment */ + const uint32_t bs = format->isl_layout->bs; + const uint32_t bw = format->isl_layout->bw; + const uint32_t bh = format->isl_layout->bh; + + const uint32_t i = MAX(4, bw); /* FINISHME: Stop hardcoding subimage alignment */ + const uint32_t j = MAX(4, bh); /* FINISHME: Stop hardcoding subimage alignment */ assert(i == 4 || i == 8 || i == 16); assert(j == 4 || j == 8 || j == 16); @@ -187,8 +191,8 @@ anv_image_make_surface(const struct anv_image_create_info *create_info, * Views >> Common Surface Formats >> Surface Layout >> 2D Surfaces >> * Surface Arrays >> For All Surface Other Than Separate Stencil Buffer: */ - assert(format->bh == 1 || format->bh == 4); - qpitch = (h0 + h1 + 11 * j) / format->bh; + assert(bh ==1 || bh == 4); + qpitch = (h0 + h1 + 11 * j) / bh; mt_width = MAX(w0, w1 + w2); mt_height = array_size * qpitch; } @@ -228,8 +232,7 @@ anv_image_make_surface(const struct anv_image_create_info *create_info, */ assert(anv_is_aligned(qpitch, j)); - uint32_t stride = align_u32(mt_width * format->bs / format->bw, - tile_info->width); + uint32_t stride = align_u32(mt_width * bs / bw, tile_info->width); if (create_info->stride > 0) stride = create_info->stride; @@ -237,7 +240,7 @@ anv_image_make_surface(const struct anv_image_create_info *create_info, * Views >> Common Surface Formats >> Surface Padding Requirements >> * Sampling Engine Surfaces >> Buffer Padding Requirements: */ - const uint32_t mem_rows = align_u32(mt_height / format->bh, 2 * format->bh); + const uint32_t mem_rows = align_u32(mt_height / bh, 2 * bh); const uint32_t size = stride * align_u32(mem_rows, tile_info->height); const uint32_t offset = align_u32(*inout_image_size, tile_info->surface_alignment); @@ -499,14 +502,16 @@ anv_validate_CreateImageView(VkDevice _device, assert(!image->format->has_stencil); assert(!view_format_info->depth_format); assert(!view_format_info->has_stencil); - assert(view_format_info->bs == image->format->bs); + assert(view_format_info->isl_layout->bs == + image->format->isl_layout->bs); } else if (subresource->aspectMask & ds_flags) { assert((subresource->aspectMask & ~ds_flags) == 0); if (subresource->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) { assert(image->format->depth_format); assert(view_format_info->depth_format); - assert(view_format_info->bs == image->format->bs); + assert(view_format_info->isl_layout->bs == + image->format->isl_layout->bs); } if (subresource->aspectMask & VK_IMAGE_ASPECT_STENCIL) { diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 4495499eda1..205338adc26 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -1209,10 +1209,7 @@ struct anv_format { const VkFormat vk_format; const char *name; enum isl_format surface_format; /**< RENDER_SURFACE_STATE.SurfaceFormat */ - uint8_t bs; /**< Block size (in bytes) of anv_format::surface_format. */ - uint8_t bw; /**< Block width of anv_format::surface_format. */ - uint8_t bh; /**< Block height of anv_format::surface_format. */ - uint8_t bd; /**< Block depth of anv_format::surface_format. */ + const struct isl_format_layout *isl_layout; uint8_t num_channels; uint16_t depth_format; /**< 3DSTATE_DEPTH_BUFFER.SurfaceFormat */ bool has_stencil; diff --git a/src/vulkan/anv_wsi_wayland.c b/src/vulkan/anv_wsi_wayland.c index 1828b090335..d3d73b8ae2d 100644 --- a/src/vulkan/anv_wsi_wayland.c +++ b/src/vulkan/anv_wsi_wayland.c @@ -60,8 +60,10 @@ wsi_wl_display_add_vk_format(struct wsi_wl_display *display, VkFormat format) return; /* Don't add formats which aren't supported by the driver */ - if (anv_format_for_vk_format(format)->bs == 0) + if (anv_format_for_vk_format(format)->surface_format == + ISL_FORMAT_UNSUPPORTED) { return; + } f = anv_vector_add(&display->formats); if (f) -- 2.30.2