diff --git a/src/freedreno/vulkan/tu_device.cc b/src/freedreno/vulkan/tu_device.cc
index 73b79fca7c7..2dc972b6f12 100644
--- a/src/freedreno/vulkan/tu_device.cc
+++ b/src/freedreno/vulkan/tu_device.cc
@@ -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();
diff --git a/src/freedreno/vulkan/tu_device.h b/src/freedreno/vulkan/tu_device.h
index e9ce79b6ac2..d5044adce67 100644
--- a/src/freedreno/vulkan/tu_device.h
+++ b/src/freedreno/vulkan/tu_device.h
@@ -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)
diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf
index b9e2e17996e..105b2f99e4d 100644
--- a/src/util/00-mesa-defaults.conf
+++ b/src/util/00-mesa-defaults.conf
@@ -1368,5 +1368,14 @@ TODO: document the other workarounds.
-->
+
+
+
+
diff --git a/src/util/driconf.h b/src/util/driconf.h
index 464e0713a0f..8d8ab4fa2a0 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -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
*/