tunrip: Add support for VK_EXT_separate_stencil_usage.

We were implictly including it in exposing VK 1.2, but we weren't making
use of the supplied struct.  Actually enabling it gives us a chance to do
slightly better at Z/S UBWC, and means we won't lose the separate usage
test coverage when switching back to exposing VK 1.1.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10594>
This commit is contained in:
Eric Anholt 2021-05-03 11:28:50 -07:00 committed by Marge Bot
parent 1d00e86078
commit 89114225b5
5 changed files with 13 additions and 7 deletions

View File

@ -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:

View File

@ -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),

View File

@ -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;

View File

@ -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;

View File

@ -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