anv: Implement VK_KHR_image_format_list
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
@@ -62,6 +62,7 @@ EXTENSIONS = [
|
|||||||
Extension('VK_KHR_get_memory_requirements2', 1, True),
|
Extension('VK_KHR_get_memory_requirements2', 1, True),
|
||||||
Extension('VK_KHR_get_physical_device_properties2', 1, True),
|
Extension('VK_KHR_get_physical_device_properties2', 1, True),
|
||||||
Extension('VK_KHR_get_surface_capabilities2', 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_incremental_present', 1, True),
|
||||||
Extension('VK_KHR_maintenance1', 1, True),
|
Extension('VK_KHR_maintenance1', 1, True),
|
||||||
Extension('VK_KHR_push_descriptor', 1, True),
|
Extension('VK_KHR_push_descriptor', 1, True),
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
#include "util/debug.h"
|
#include "util/debug.h"
|
||||||
|
#include "vk_util.h"
|
||||||
|
|
||||||
#include "vk_format_info.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);
|
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
|
* For color images that have an auxiliary surface, request allocation for an
|
||||||
* additional buffer that mainly stores fast-clear values. Use of this buffer
|
* 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.
|
* compression on at all times for these formats.
|
||||||
*/
|
*/
|
||||||
if (!(vk_info->usage & VK_IMAGE_USAGE_STORAGE_BIT) &&
|
if (!(vk_info->usage & VK_IMAGE_USAGE_STORAGE_BIT) &&
|
||||||
!(vk_info->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) &&
|
all_formats_ccs_e_compatible(&dev->info, vk_info)) {
|
||||||
isl_format_supports_ccs_e(&dev->info, format)) {
|
|
||||||
image->aux_usage = ISL_AUX_USAGE_CCS_E;
|
image->aux_usage = ISL_AUX_USAGE_CCS_E;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user