vulkan: make sure vk_image::format is never UNDEFINED
vk_image::android_external_format is only used for sanity check and is removed. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22619>
This commit is contained in:
@@ -2654,25 +2654,11 @@ anv_CreateImageView(VkDevice _device,
|
||||
const VkSamplerYcbcrConversionInfo *conv_info =
|
||||
vk_find_struct_const(pCreateInfo->pNext, SAMPLER_YCBCR_CONVERSION_INFO);
|
||||
|
||||
#ifdef ANDROID
|
||||
/* If image has an external format, the pNext chain must contain an
|
||||
* instance of VKSamplerYcbcrConversionInfo with a conversion object
|
||||
* created with the same external format as image."
|
||||
*/
|
||||
assert(!image->vk.android_external_format || conv_info);
|
||||
#endif
|
||||
|
||||
if (conv_info) {
|
||||
VK_FROM_HANDLE(vk_ycbcr_conversion, conversion, conv_info->conversion);
|
||||
conv_format = conversion->state.format;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
/* "If image has an external format, format must be VK_FORMAT_UNDEFINED." */
|
||||
assert(!image->vk.android_external_format ||
|
||||
pCreateInfo->format == VK_FORMAT_UNDEFINED);
|
||||
#endif
|
||||
|
||||
/* Format is undefined, this can happen when using external formats. Set
|
||||
* view format from the passed conversion info.
|
||||
*/
|
||||
|
||||
@@ -2409,25 +2409,11 @@ anv_CreateImageView(VkDevice _device,
|
||||
const VkSamplerYcbcrConversionInfo *conv_info =
|
||||
vk_find_struct_const(pCreateInfo->pNext, SAMPLER_YCBCR_CONVERSION_INFO);
|
||||
|
||||
#ifdef ANDROID
|
||||
/* If image has an external format, the pNext chain must contain an
|
||||
* instance of VKSamplerYcbcrConversionInfo with a conversion object
|
||||
* created with the same external format as image."
|
||||
*/
|
||||
assert(!image->vk.android_external_format || conv_info);
|
||||
#endif
|
||||
|
||||
if (conv_info) {
|
||||
VK_FROM_HANDLE(vk_ycbcr_conversion, conversion, conv_info->conversion);
|
||||
conv_format = conversion->state.format;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
/* "If image has an external format, format must be VK_FORMAT_UNDEFINED." */
|
||||
assert(!image->vk.android_external_format ||
|
||||
pCreateInfo->format == VK_FORMAT_UNDEFINED);
|
||||
#endif
|
||||
|
||||
/* Format is undefined, this can happen when using external formats. Set
|
||||
* view format from the passed conversion info.
|
||||
*/
|
||||
|
||||
@@ -108,9 +108,7 @@ vk_image_init(struct vk_device *device,
|
||||
assert(image->format == VK_FORMAT_UNDEFINED);
|
||||
assert(image->external_handle_types &
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID);
|
||||
image->android_external_format = ext_format->externalFormat;
|
||||
} else {
|
||||
image->android_external_format = 0;
|
||||
vk_image_set_format(image, (VkFormat)ext_format->externalFormat);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -36,7 +36,13 @@ struct vk_image {
|
||||
|
||||
VkImageCreateFlags create_flags;
|
||||
VkImageType image_type;
|
||||
|
||||
/* format is from VkImageCreateInfo::format or
|
||||
* VkExternalFormatANDROID::externalFormat. This works because only one of
|
||||
* them can be defined and the runtime uses VkFormat for external formats.
|
||||
*/
|
||||
VkFormat format;
|
||||
|
||||
VkExtent3D extent;
|
||||
uint32_t mip_levels;
|
||||
uint32_t array_layers;
|
||||
@@ -76,9 +82,6 @@ struct vk_image {
|
||||
* but it may be overridden by the driver as needed.
|
||||
*/
|
||||
unsigned ahardware_buffer_format;
|
||||
|
||||
/* VK_ANDROID_external_memory_android_hardware_buffer */
|
||||
uint64_t android_external_format;
|
||||
#endif
|
||||
};
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(vk_image, base, VkImage,
|
||||
|
||||
Reference in New Issue
Block a user