diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-06-19 08:38:48 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-09-18 07:35:37 -0700 |
commit | 1a994b053d53d68df92d698e3b82e9278652e958 (patch) | |
tree | 986066cf110a939e3c4da60587f3b938513e88fa /src | |
parent | 52a89fedf2a2811ca5a06199eb171dea94a579e8 (diff) |
anv: Implement VK_KHR_image_format_list
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/anv_extensions.py | 1 | ||||
-rw-r--r-- | src/intel/vulkan/anv_image.c | 37 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index cb0e36b7233..c94149c130a 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -62,6 +62,7 @@ EXTENSIONS = [ Extension('VK_KHR_get_memory_requirements2', 1, True), Extension('VK_KHR_get_physical_device_properties2', 1, True), Extension('VK_KHR_get_surface_capabilities2', 1, True), + Extension('VK_KHR_image_format_list', 1, True), Extension('VK_KHR_incremental_present', 1, True), Extension('VK_KHR_maintenance1', 1, True), Extension('VK_KHR_push_descriptor', 1, True), diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 982461c82c8..559e50da9a2 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -30,6 +30,7 @@ #include "anv_private.h" #include "util/debug.h" +#include "vk_util.h" #include "vk_format_info.h" @@ -116,6 +117,39 @@ add_surface(struct anv_image *image, struct anv_surface *surf) image->alignment = MAX2(image->alignment, surf->isl.alignment); } + +static bool +all_formats_ccs_e_compatible(const struct gen_device_info *devinfo, + const struct VkImageCreateInfo *vk_info) +{ + enum isl_format format = + anv_get_isl_format(devinfo, vk_info->format, + VK_IMAGE_ASPECT_COLOR_BIT, vk_info->tiling); + + if (!isl_format_supports_ccs_e(devinfo, format)) + return false; + + if (!(vk_info->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT)) + return true; + + const VkImageFormatListCreateInfoKHR *fmt_list = + vk_find_struct_const(vk_info->pNext, IMAGE_FORMAT_LIST_CREATE_INFO_KHR); + + if (!fmt_list || fmt_list->viewFormatCount == 0) + return false; + + for (uint32_t i = 0; i < fmt_list->viewFormatCount; i++) { + enum isl_format view_format = + anv_get_isl_format(devinfo, fmt_list->pViewFormats[i], + VK_IMAGE_ASPECT_COLOR_BIT, vk_info->tiling); + + if (!isl_formats_are_ccs_e_compatible(devinfo, format, view_format)) + return false; + } + + return true; +} + /** * For color images that have an auxiliary surface, request allocation for an * additional buffer that mainly stores fast-clear values. Use of this buffer @@ -319,8 +353,7 @@ make_surface(const struct anv_device *dev, * compression on at all times for these formats. */ if (!(vk_info->usage & VK_IMAGE_USAGE_STORAGE_BIT) && - !(vk_info->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) && - isl_format_supports_ccs_e(&dev->info, format)) { + all_formats_ccs_e_compatible(&dev->info, vk_info)) { image->aux_usage = ISL_AUX_USAGE_CCS_E; } } |