aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2018-04-25 11:22:17 +0200
committerSamuel Pitoiset <[email protected]>2018-04-26 15:34:14 +0200
commitd7ffe3b384f4d1c15a9364768cf405d416522e60 (patch)
treea60c74e8566a9b9c2106d5cfacb69722f6f9d5bc
parenta6fbefa67b5b0ed1ee42a9034ee74dfaed1c389a (diff)
radv: set ac_surf_info::num_channels correctly
num_channels has been introduced since "ac/surface: don't set the display flag for obviously unsupported cases". Based on RadeonSI. Fixes: e29facff315 ("ac/surface: don't set the display flag for obviously unsupported cases (v2)") Cc: 18.1 <[email protected]> Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r--src/amd/vulkan/radv_image.c2
-rw-r--r--src/amd/vulkan/vk_format.h7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 793f861f4f6..a6f3628c8f8 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -968,7 +968,7 @@ radv_image_create(VkDevice _device,
image->info.samples = pCreateInfo->samples;
image->info.array_size = pCreateInfo->arrayLayers;
image->info.levels = pCreateInfo->mipLevels;
- image->info.num_channels = 4; /* TODO: set this correctly */
+ image->info.num_channels = vk_format_get_nr_components(pCreateInfo->format);
image->vk_format = pCreateInfo->format;
image->tiling = pCreateInfo->tiling;
diff --git a/src/amd/vulkan/vk_format.h b/src/amd/vulkan/vk_format.h
index 43265ed3d97..b8cb4f4ed37 100644
--- a/src/amd/vulkan/vk_format.h
+++ b/src/amd/vulkan/vk_format.h
@@ -488,4 +488,11 @@ vk_to_non_srgb_format(VkFormat format)
}
}
+static inline unsigned
+vk_format_get_nr_components(VkFormat format)
+{
+ const struct vk_format_description *desc = vk_format_description(format);
+ return desc->nr_channels;
+}
+
#endif /* VK_FORMAT_H */