Mesa (master): radv: Do no use vk_format for getting divisors.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Feb 13 21:57:33 UTC 2021


Module: Mesa
Branch: master
Commit: 7cf8c4f683ab208b7f4bdd1c90bcf699c97f6e54
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7cf8c4f683ab208b7f4bdd1c90bcf699c97f6e54

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Sat Jan 30 19:14:15 2021 +0100

radv: Do no use vk_format for getting divisors.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8797>

---

 src/amd/vulkan/radv_nir_lower_ycbcr_textures.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_nir_lower_ycbcr_textures.c b/src/amd/vulkan/radv_nir_lower_ycbcr_textures.c
index db1a918dcd6..31b45ece46d 100644
--- a/src/amd/vulkan/radv_nir_lower_ycbcr_textures.c
+++ b/src/amd/vulkan/radv_nir_lower_ycbcr_textures.c
@@ -82,8 +82,11 @@ implicit_downsampled_coords(struct ycbcr_state *state,
 	const struct radv_sampler_ycbcr_conversion *conversion = state->conversion;
 	nir_ssa_def *image_size = NULL;
 	nir_ssa_def *comp[4] = { NULL, };
-	const struct vk_format_description *fmt_desc = vk_format_description(state->conversion->format);
-	const unsigned divisors[2] = {fmt_desc->width_divisor, fmt_desc->height_divisor};
+	enum pipe_video_chroma_format chroma_format = pipe_format_to_chroma_format(vk_format_to_pipe_format(state->conversion->format));
+	const unsigned divisors[2] = {
+		chroma_format <= PIPE_VIDEO_CHROMA_FORMAT_422 ? 2 : 1,
+		chroma_format <= PIPE_VIDEO_CHROMA_FORMAT_420 ? 2 : 1
+	};
 
 	for (int c = 0; c < old_coords->num_components; c++) {
 		if (c < ARRAY_SIZE(divisors) && divisors[c] > 1 &&



More information about the mesa-commit mailing list