tu: Enable UBWC for D24S8 with USAGE_SAMPLED and formatless border color

DXVK and VKD3D-Proton use customBorderColorWithoutFormat and have most of
D24S8 images with USAGE_SAMPLED, in such case we disable UBWC for correctness.
However, games don't use border color for depth-stencil images. So we elect
to ignore this edge case and force UBWC to be enabled.

See also https://github.com/doitsujin/dxvk/issues/4191

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30545>
This commit is contained in:
Danylo Piliaiev 2024-08-07 11:34:42 +02:00 committed by Marge Bot
parent 012323a1d1
commit 8b7beca572
4 changed files with 26 additions and 1 deletions

View file

@ -1361,6 +1361,7 @@ static const driOptionDescription tu_dri_options[] = {
DRI_CONF_DISABLE_CONSERVATIVE_LRZ(false)
DRI_CONF_TU_DONT_RESERVE_DESCRIPTOR_SET(false)
DRI_CONF_TU_ALLOW_OOB_INDIRECT_UBO_LOADS(false)
DRI_CONF_TU_DISABLE_D24S8_BORDER_COLOR_WORKAROUND(false)
DRI_CONF_SECTION_END
};
@ -1381,6 +1382,8 @@ tu_init_dri_options(struct tu_instance *instance)
!driQueryOptionb(&instance->dri_options, "tu_dont_reserve_descriptor_set");
instance->allow_oob_indirect_ubo_loads =
driQueryOptionb(&instance->dri_options, "tu_allow_oob_indirect_ubo_loads");
instance->disable_d24s8_border_color_workaround =
driQueryOptionb(&instance->dri_options, "tu_disable_d24s8_border_color_workaround");
}
VKAPI_ATTR VkResult VKAPI_CALL
@ -2513,7 +2516,8 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
device->use_z24uint_s8uint =
physical_device->info->a6xx.has_z24uint_s8uint &&
!border_color_without_format;
(!border_color_without_format ||
physical_device->instance->disable_d24s8_border_color_workaround);
device->use_lrz = !TU_DEBUG(NOLRZ);
tu_gpu_tracepoint_config_variable();

View file

@ -186,6 +186,14 @@ struct tu_instance
* See: https://github.com/doitsujin/dxvk/issues/3861
*/
bool allow_oob_indirect_ubo_loads;
/* DXVK and VKD3D-Proton use customBorderColorWithoutFormat
* and have most of D24S8 images with USAGE_SAMPLED, in such case we
* disable UBWC for correctness. However, games don't use border color for
* depth-stencil images. So we elect to ignore this edge case and force
* UBWC to be enabled.
*/
bool disable_d24s8_border_color_workaround;
};
VK_DEFINE_HANDLE_CASTS(tu_instance, vk.base, VkInstance,
VK_OBJECT_TYPE_INSTANCE)

View file

@ -1368,5 +1368,14 @@ TODO: document the other workarounds.
-->
<option name="tu_allow_oob_indirect_ubo_loads" value="true" />
</engine>
<engine engine_name_match="DXVK|vkd3d">
<!--
DXVK and VKD3D-Proton use customBorderColorWithoutFormat and have most of
D24S8 images with USAGE_SAMPLED, in such case we disable UBWC for correctness.
However, games don't use border color for depth-stencil images. So we elect
to ignore this edge case and force UBWC to be enabled.
-->
<option name="tu_disable_d24s8_border_color_workaround" value="true" />
</engine>
</device>
</driconf>

View file

@ -602,6 +602,10 @@
DRI_CONF_OPT_B(tu_allow_oob_indirect_ubo_loads, def, \
"Some D3D11 games rely on out-of-bounds indirect UBO loads to return real values from underlying bound descriptor, this prevents us from lowering indirectly accessed UBOs to consts")
#define DRI_CONF_TU_DISABLE_D24S8_BORDER_COLOR_WORKAROUND(def) \
DRI_CONF_OPT_B(tu_disable_d24s8_border_color_workaround, def, \
"Use UBWC for D24S8 images with VK_IMAGE_USAGE_SAMPLED_BIT when customBorderColorWithoutFormat is enabled")
/**
* \brief venus specific configuration options
*/