pvr: Implement VK_KHR_format_feature_flags2

This commit will implement and set VK_KHR_format_feature_flags2
instead of the old ones.

Signed-off-by: Vlad Schiller <vlad-radu.schiller@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24929>
This commit is contained in:
Vlad Schiller 2023-08-21 06:34:36 +01:00 committed by Marge Bot
parent e80fddf81f
commit c4506b5af5
3 changed files with 27 additions and 6 deletions

View file

@ -477,7 +477,7 @@ Vulkan 1.3 -- all DONE: anv, radv, tu, lvp, vn
VK_KHR_copy_commands2 DONE (anv, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_KHR_dynamic_rendering DONE (anv, dzn, hasvk, lvp, nvk, radv, tu, vn)
VK_KHR_format_feature_flags2 DONE (anv, hasvk, lvp, nvk, radv, tu, v3dv, vn)
VK_KHR_format_feature_flags2 DONE (anv, hasvk, lvp, nvk, pvr, radv, tu, v3dv, vn)
VK_KHR_maintenance4 DONE (anv, hasvk, lvp, nvk, radv, tu, v3dv, vn)
VK_KHR_shader_integer_dot_product DONE (anv, dzn, hasvk, lvp, radv, tu, v3dv, vn)
VK_KHR_shader_non_semantic_info DONE (anv, hasvk, nvk, radv, tu, v3dv, vn)

View file

@ -160,6 +160,7 @@ static void pvr_physical_device_get_supported_extensions(
.KHR_copy_commands2 = true,
.KHR_external_memory = true,
.KHR_external_memory_fd = true,
.KHR_format_feature_flags2 = true,
.KHR_get_memory_requirements2 = true,
.KHR_swapchain = PVR_USE_WSI_PLATFORM,
.KHR_timeline_semaphore = true,

View file

@ -461,12 +461,11 @@ void pvr_get_hw_clear_color(
#undef f32_to_snorm16
#undef f32_to_f16
/* TODO: This currently only sets up Vulkan 1.0 flags. */
static VkFormatFeatureFlags2
pvr_get_image_format_features2(const struct pvr_format *pvr_format,
VkImageTiling vk_tiling)
{
VkFormatFeatureFlags flags = 0;
VkFormatFeatureFlags2 flags = 0;
VkFormat vk_format;
if (!pvr_format)
@ -509,7 +508,8 @@ pvr_get_image_format_features2(const struct pvr_format *pvr_format,
}
} else if (vk_format_is_depth_or_stencil(vk_format)) {
flags |= VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_2_BLIT_DST_BIT;
VK_FORMAT_FEATURE_2_BLIT_DST_BIT |
VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT;
}
if (vk_tiling == VK_IMAGE_TILING_OPTIMAL) {
@ -566,6 +566,11 @@ pvr_get_image_format_features2(const struct pvr_format *pvr_format,
}
}
if (flags & VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT) {
flags |= VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT |
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT;
}
return flags;
}
@ -576,7 +581,6 @@ const uint8_t *pvr_get_format_swizzle(VkFormat vk_format)
return vf->swizzle;
}
/* TODO: This currently only sets up Vulkan 1.0 flags. */
static VkFormatFeatureFlags2
pvr_get_buffer_format_features2(const struct pvr_format *pvr_format)
{
@ -650,6 +654,11 @@ pvr_get_buffer_format_features2(const struct pvr_format *pvr_format)
break;
}
if (flags & VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT) {
flags |= VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT |
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT;
}
return flags;
}
@ -673,7 +682,18 @@ void pvr_GetPhysicalDeviceFormatProperties2(
};
vk_foreach_struct (ext, pFormatProperties->pNext) {
pvr_debug_ignored_stype(ext->sType);
switch (ext->sType) {
case VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3: {
VkFormatProperties3 *pFormatProperties3 = (VkFormatProperties3 *)ext;
pFormatProperties3->linearTilingFeatures = linear2;
pFormatProperties3->optimalTilingFeatures = optimal2;
pFormatProperties3->bufferFeatures = buffer2;
break;
}
default:
pvr_debug_ignored_stype(ext->sType);
break;
}
}
}