diff --git a/src/amd/vulkan/radv_formats.h b/src/amd/vulkan/radv_formats.h index 012220aae7c..a83430e90cc 100644 --- a/src/amd/vulkan/radv_formats.h +++ b/src/amd/vulkan/radv_formats.h @@ -104,18 +104,6 @@ vk_format_no_srgb(VkFormat format) } } -static inline unsigned -vk_format_get_plane_width(VkFormat format, unsigned plane, unsigned width) -{ - return util_format_get_plane_width(vk_format_to_pipe_format(format), plane, width); -} - -static inline unsigned -vk_format_get_plane_height(VkFormat format, unsigned plane, unsigned height) -{ - return util_format_get_plane_height(vk_format_to_pipe_format(format), plane, height); -} - struct radv_physical_device; uint32_t radv_translate_buffer_numformat(const struct util_format_description *desc, int first_non_void); diff --git a/src/vulkan/util/vk_format.h b/src/vulkan/util/vk_format.h index 4fb3a85198f..720c5c185d7 100644 --- a/src/vulkan/util/vk_format.h +++ b/src/vulkan/util/vk_format.h @@ -260,6 +260,26 @@ vk_format_get_plane_count(VkFormat format) return ycbcr_info ? ycbcr_info->n_planes : 1; } +static inline unsigned +vk_format_get_plane_width(VkFormat format, unsigned plane, unsigned width) +{ + const struct vk_format_ycbcr_info *ycbcr_info = + vk_format_get_ycbcr_info(format); + const uint8_t width_scale = ycbcr_info ? + ycbcr_info->planes[plane].denominator_scales[0] : 1; + return width / width_scale; +} + +static inline unsigned +vk_format_get_plane_height(VkFormat format, unsigned plane, unsigned height) +{ + const struct vk_format_ycbcr_info *ycbcr_info = + vk_format_get_ycbcr_info(format); + const uint8_t height_scale = ycbcr_info ? + ycbcr_info->planes[plane].denominator_scales[1] : 1; + return height / height_scale; +} + VkClearColorValue vk_swizzle_color_value(VkClearColorValue color, VkComponentMapping swizzle, bool is_int);