diff --git a/docs/features.txt b/docs/features.txt index 5746398d20b..3ef8fba9e2f 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -469,7 +469,7 @@ Vulkan 1.2 -- all DONE: anv, vn VK_EXT_host_query_reset DONE (anv, lvp, radv, tu, vn) VK_EXT_sampler_filter_minmax DONE (anv/gen9+, lvp, radv, tu, vn) VK_EXT_scalar_block_layout DONE (anv, lvp, radv/gfx7+, tu, vn) - VK_EXT_separate_stencil_usage DONE (anv, vn) + VK_EXT_separate_stencil_usage DONE (anv, tu, vn) VK_EXT_shader_viewport_index_layer DONE (anv, lvp, radv, tu, vn) Khronos extensions that are not part of any Vulkan version: diff --git a/src/freedreno/vulkan/tu_extensions.py b/src/freedreno/vulkan/tu_extensions.py index 08eb34c3576..d1c3a2f1f23 100644 --- a/src/freedreno/vulkan/tu_extensions.py +++ b/src/freedreno/vulkan/tu_extensions.py @@ -95,6 +95,7 @@ EXTENSIONS = [ Extension('VK_EXT_custom_border_color', 12, True), Extension('VK_KHR_multiview', 1, True), Extension('VK_EXT_host_query_reset', 1, True), + Extension('VK_EXT_separate_stencil_usage', 1, True), Extension('VK_EXT_shader_viewport_index_layer', 1, True), Extension('VK_EXT_extended_dynamic_state', 1, True), Extension('VK_KHR_push_descriptor', 1, True), diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c index d2e04ccfdf5..e49113669f6 100644 --- a/src/freedreno/vulkan/tu_formats.c +++ b/src/freedreno/vulkan/tu_formats.c @@ -499,7 +499,7 @@ tu_GetPhysicalDeviceFormatProperties2( /* note: ubwc_possible() argument values to be ignored except for format */ if (pFormatProperties->formatProperties.optimalTilingFeatures && - ubwc_possible(format, VK_IMAGE_TYPE_2D, 0, false, VK_SAMPLE_COUNT_1_BIT)) { + ubwc_possible(format, VK_IMAGE_TYPE_2D, 0, 0, false, VK_SAMPLE_COUNT_1_BIT)) { vk_outarray_append(&out, mod_props) { mod_props->drmFormatModifier = DRM_FORMAT_MOD_QCOM_COMPRESSED; mod_props->drmFormatModifierPlaneCount = 1; @@ -547,7 +547,7 @@ tu_get_image_format_properties( return VK_ERROR_FORMAT_NOT_SUPPORTED; - if (!ubwc_possible(info->format, info->type, info->usage, physical_device->info.a6xx.has_z24uint_s8uint, sampleCounts)) + if (!ubwc_possible(info->format, info->type, info->usage, info->usage, physical_device->info.a6xx.has_z24uint_s8uint, sampleCounts)) return VK_ERROR_FORMAT_NOT_SUPPORTED; format_feature_flags = format_props.optimalTilingFeatures; diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c index 5e323f8627c..c81b028170d 100644 --- a/src/freedreno/vulkan/tu_image.c +++ b/src/freedreno/vulkan/tu_image.c @@ -448,7 +448,8 @@ tu_image_view_init(struct tu_image_view *iview, } bool -ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, bool has_z24uint_s8uint, +ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, + VkImageUsageFlags stencil_usage, bool has_z24uint_s8uint, VkSampleCountFlagBits samples) { /* no UBWC with compressed formats, E5B9G9R9, S8_UINT @@ -473,7 +474,7 @@ ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, bool h * UBWC-enabled mipmaps in freedreno currently. Just match the closed GL * behavior of no UBWC. */ - if (usage & VK_IMAGE_USAGE_STORAGE_BIT) + if ((usage | stencil_usage) & VK_IMAGE_USAGE_STORAGE_BIT) return false; /* Disable UBWC for D24S8 on A630 in some cases @@ -489,7 +490,7 @@ ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, bool h */ if (!has_z24uint_s8uint && format == VK_FORMAT_D24_UNORM_S8_UINT && - (usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT))) + (stencil_usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT))) return false; if (!has_z24uint_s8uint && samples > VK_SAMPLE_COUNT_1_BIT) @@ -603,7 +604,11 @@ tu_CreateImage(VkDevice _device, ubwc_enabled = false; } + const VkImageStencilUsageCreateInfo *stencil_usage_info = + vk_find_struct_const(pCreateInfo->pNext, IMAGE_STENCIL_USAGE_CREATE_INFO); + if (!ubwc_possible(image->vk_format, pCreateInfo->imageType, pCreateInfo->usage, + stencil_usage_info ? stencil_usage_info->stencilUsage : pCreateInfo->usage, device->physical_device->info.a6xx.has_z24uint_s8uint, pCreateInfo->samples)) ubwc_enabled = false; diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index 99e2f1f63e2..8fb56eaeb42 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -1417,7 +1417,7 @@ tu_image_view_init(struct tu_image_view *iview, bool limited_z24s8); bool -ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, bool limited_z24s8, +ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, VkImageUsageFlags stencil_usage, bool limited_z24s8, VkSampleCountFlagBits samples); struct tu_buffer_view