diff options
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_formats.c | 107 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 3 |
2 files changed, 69 insertions, 41 deletions
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 9199567f445..d3a7c2be85c 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -51,6 +51,7 @@ .planes = { \ { .isl_format = __hw_fmt, .swizzle = __swizzle, \ .denominator_scales = { 1, 1, }, \ + .aspect = VK_IMAGE_ASPECT_COLOR_BIT, \ }, \ }, \ .n_planes = 1, \ @@ -59,16 +60,38 @@ #define fmt1(__vk_fmt, __hw_fmt) \ swiz_fmt1(__vk_fmt, __hw_fmt, RGBA) -#define fmt2(__vk_fmt, __fmt1, __fmt2) \ +#define d_fmt(__vk_fmt, __hw_fmt) \ [VK_ENUM_OFFSET(__vk_fmt)] = { \ .planes = { \ - { .isl_format = __fmt1, \ - .swizzle = RGBA, \ + { .isl_format = __hw_fmt, .swizzle = RGBA, \ .denominator_scales = { 1, 1, }, \ + .aspect = VK_IMAGE_ASPECT_DEPTH_BIT, \ }, \ - { .isl_format = __fmt2, \ - .swizzle = RGBA, \ + }, \ + .n_planes = 1, \ + } + +#define s_fmt(__vk_fmt, __hw_fmt) \ + [VK_ENUM_OFFSET(__vk_fmt)] = { \ + .planes = { \ + { .isl_format = __hw_fmt, .swizzle = RGBA, \ + .denominator_scales = { 1, 1, }, \ + .aspect = VK_IMAGE_ASPECT_STENCIL_BIT, \ + }, \ + }, \ + .n_planes = 1, \ + } + +#define ds_fmt2(__vk_fmt, __fmt1, __fmt2) \ + [VK_ENUM_OFFSET(__vk_fmt)] = { \ + .planes = { \ + { .isl_format = __fmt1, .swizzle = RGBA, \ + .denominator_scales = { 1, 1, }, \ + .aspect = VK_IMAGE_ASPECT_DEPTH_BIT, \ + }, \ + { .isl_format = __fmt2, .swizzle = RGBA, \ .denominator_scales = { 1, 1, }, \ + .aspect = VK_IMAGE_ASPECT_STENCIL_BIT, \ }, \ }, \ .n_planes = 2, \ @@ -81,20 +104,22 @@ }, \ } -#define y_plane(__hw_fmt, __swizzle, __ycbcr_swizzle, dhs, dvs) \ +#define y_plane(__plane, __hw_fmt, __swizzle, __ycbcr_swizzle, dhs, dvs) \ { .isl_format = __hw_fmt, \ .swizzle = __swizzle, \ .ycbcr_swizzle = __ycbcr_swizzle, \ .denominator_scales = { dhs, dvs, }, \ .has_chroma = false, \ + .aspect = VK_IMAGE_ASPECT_PLANE_0_BIT, /* Y plane is always plane 0 */ \ } -#define chroma_plane(__hw_fmt, __swizzle, __ycbcr_swizzle, dhs, dvs) \ +#define chroma_plane(__plane, __hw_fmt, __swizzle, __ycbcr_swizzle, dhs, dvs) \ { .isl_format = __hw_fmt, \ .swizzle = __swizzle, \ .ycbcr_swizzle = __ycbcr_swizzle, \ .denominator_scales = { dhs, dvs, }, \ .has_chroma = true, \ + .aspect = VK_IMAGE_ASPECT_PLANE_ ## __plane ## _BIT, \ } #define ycbcr_fmt(__vk_fmt, __n_planes, ...) \ @@ -224,13 +249,13 @@ static const struct anv_format main_formats[] = { fmt1(VK_FORMAT_B10G11R11_UFLOAT_PACK32, ISL_FORMAT_R11G11B10_FLOAT), fmt1(VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, ISL_FORMAT_R9G9B9E5_SHAREDEXP), - fmt1(VK_FORMAT_D16_UNORM, ISL_FORMAT_R16_UNORM), - fmt1(VK_FORMAT_X8_D24_UNORM_PACK32, ISL_FORMAT_R24_UNORM_X8_TYPELESS), - fmt1(VK_FORMAT_D32_SFLOAT, ISL_FORMAT_R32_FLOAT), - fmt1(VK_FORMAT_S8_UINT, ISL_FORMAT_R8_UINT), + d_fmt(VK_FORMAT_D16_UNORM, ISL_FORMAT_R16_UNORM), + d_fmt(VK_FORMAT_X8_D24_UNORM_PACK32, ISL_FORMAT_R24_UNORM_X8_TYPELESS), + d_fmt(VK_FORMAT_D32_SFLOAT, ISL_FORMAT_R32_FLOAT), + s_fmt(VK_FORMAT_S8_UINT, ISL_FORMAT_R8_UINT), fmt_unsupported(VK_FORMAT_D16_UNORM_S8_UINT), - fmt2(VK_FORMAT_D24_UNORM_S8_UINT, ISL_FORMAT_R24_UNORM_X8_TYPELESS, ISL_FORMAT_R8_UINT), - fmt2(VK_FORMAT_D32_SFLOAT_S8_UINT, ISL_FORMAT_R32_FLOAT, ISL_FORMAT_R8_UINT), + ds_fmt2(VK_FORMAT_D24_UNORM_S8_UINT, ISL_FORMAT_R24_UNORM_X8_TYPELESS, ISL_FORMAT_R8_UINT), + ds_fmt2(VK_FORMAT_D32_SFLOAT_S8_UINT, ISL_FORMAT_R32_FLOAT, ISL_FORMAT_R8_UINT), swiz_fmt1(VK_FORMAT_BC1_RGB_UNORM_BLOCK, ISL_FORMAT_BC1_UNORM, RGB1), swiz_fmt1(VK_FORMAT_BC1_RGB_SRGB_BLOCK, ISL_FORMAT_BC1_UNORM_SRGB, RGB1), @@ -304,27 +329,27 @@ static const struct anv_format main_formats[] = { static const struct anv_format ycbcr_formats[] = { ycbcr_fmt(VK_FORMAT_G8B8G8R8_422_UNORM, 1, - y_plane(ISL_FORMAT_YCRCB_SWAPUV, RGBA, _ISL_SWIZZLE(BLUE, GREEN, RED, ZERO), 1, 1)), + y_plane(0, ISL_FORMAT_YCRCB_SWAPUV, RGBA, _ISL_SWIZZLE(BLUE, GREEN, RED, ZERO), 1, 1)), ycbcr_fmt(VK_FORMAT_B8G8R8G8_422_UNORM, 1, - y_plane(ISL_FORMAT_YCRCB_SWAPUVY, RGBA, _ISL_SWIZZLE(BLUE, GREEN, RED, ZERO), 1, 1)), + y_plane(0, ISL_FORMAT_YCRCB_SWAPUVY, RGBA, _ISL_SWIZZLE(BLUE, GREEN, RED, ZERO), 1, 1)), ycbcr_fmt(VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM, 3, - y_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 2, 2), - chroma_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 2, 2)), + y_plane(0, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 2, 2), + chroma_plane(2, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 2, 2)), ycbcr_fmt(VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, 2, - y_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R8G8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, RED, ZERO, ZERO), 2, 2)), + y_plane(0, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R8G8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, RED, ZERO, ZERO), 2, 2)), ycbcr_fmt(VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM, 3, - y_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 2, 1), - chroma_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 2, 1)), + y_plane(0, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 2, 1), + chroma_plane(2, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 2, 1)), ycbcr_fmt(VK_FORMAT_G8_B8R8_2PLANE_422_UNORM, 2, - y_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R8G8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, RED, ZERO, ZERO), 2, 1)), + y_plane(0, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R8G8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, RED, ZERO, ZERO), 2, 1)), ycbcr_fmt(VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM, 3, - y_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 1, 1)), + y_plane(0, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(2, ISL_FORMAT_R8_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 1, 1)), fmt_unsupported(VK_FORMAT_R10X6_UNORM_PACK16), fmt_unsupported(VK_FORMAT_R10X6G10X6_UNORM_2PACK16), @@ -353,23 +378,23 @@ static const struct anv_format ycbcr_formats[] = { fmt_unsupported(VK_FORMAT_B16G16R16G16_422_UNORM), ycbcr_fmt(VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, 3, - y_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 2, 2), - chroma_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 2, 2)), + y_plane(0, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 2, 2), + chroma_plane(2, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 2, 2)), ycbcr_fmt(VK_FORMAT_G16_B16R16_2PLANE_420_UNORM, 2, - y_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R16G16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, RED, ZERO, ZERO), 2, 2)), + y_plane(0, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R16G16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, RED, ZERO, ZERO), 2, 2)), ycbcr_fmt(VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM, 3, - y_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 2, 1), - chroma_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 2, 1)), + y_plane(0, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 2, 1), + chroma_plane(2, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 2, 1)), ycbcr_fmt(VK_FORMAT_G16_B16R16_2PLANE_422_UNORM, 2, - y_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R16G16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, RED, ZERO, ZERO), 2, 1)), + y_plane(0, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R16G16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, RED, ZERO, ZERO), 2, 1)), ycbcr_fmt(VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM, 3, - y_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 1, 1), - chroma_plane(ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 1, 1)), + y_plane(0, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(GREEN, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(1, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(BLUE, ZERO, ZERO, ZERO), 1, 1), + chroma_plane(2, ISL_FORMAT_R16_UNORM, RGBA, _ISL_SWIZZLE(RED, ZERO, ZERO, ZERO), 1, 1)), }; #undef _fmt diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 0ce81cf086a..b6e3d1a36d4 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2549,6 +2549,9 @@ struct anv_format_plane { /* How to map sampled ycbcr planes to a single 4 component element. */ struct isl_swizzle ycbcr_swizzle; + + /* What aspect is associated to this plane */ + VkImageAspectFlags aspect; }; |