diff --git a/src/freedreno/vulkan/tu_device.cc b/src/freedreno/vulkan/tu_device.cc
index 7f537cc448b..0b9b66aee2d 100644
--- a/src/freedreno/vulkan/tu_device.cc
+++ b/src/freedreno/vulkan/tu_device.cc
@@ -1643,6 +1643,7 @@ static const driOptionDescription tu_dri_options[] = {
DRI_CONF_TU_ALLOW_OOB_INDIRECT_UBO_LOADS(false)
DRI_CONF_TU_DISABLE_D24S8_BORDER_COLOR_WORKAROUND(false)
DRI_CONF_TU_USE_TEX_COORD_ROUND_NEAREST_EVEN_MODE(false)
+ DRI_CONF_TU_IGNORE_FRAG_DEPTH_DIRECTION(false)
DRI_CONF_SECTION_END
};
@@ -1667,6 +1668,8 @@ tu_init_dri_options(struct tu_instance *instance)
driQueryOptionb(&instance->dri_options, "tu_disable_d24s8_border_color_workaround");
instance->use_tex_coord_round_nearest_even_mode =
driQueryOptionb(&instance->dri_options, "tu_use_tex_coord_round_nearest_even_mode");
+ instance->ignore_frag_depth_direction =
+ driQueryOptionb(&instance->dri_options, "tu_ignore_frag_depth_direction");
}
static uint32_t instance_count = 0;
diff --git a/src/freedreno/vulkan/tu_device.h b/src/freedreno/vulkan/tu_device.h
index 58eae80f131..1c0509ff951 100644
--- a/src/freedreno/vulkan/tu_device.h
+++ b/src/freedreno/vulkan/tu_device.h
@@ -208,6 +208,9 @@ struct tu_instance
/* D3D emulation requires texture coordinates to be rounded to nearest even value. */
bool use_tex_coord_round_nearest_even_mode;
+
+ /* Apps may be accidentally incorrect */
+ bool ignore_frag_depth_direction;
};
VK_DEFINE_HANDLE_CASTS(tu_instance, vk.base, VkInstance,
VK_OBJECT_TYPE_INSTANCE)
diff --git a/src/freedreno/vulkan/tu_lrz.cc b/src/freedreno/vulkan/tu_lrz.cc
index 61646ed079f..f32861632be 100644
--- a/src/freedreno/vulkan/tu_lrz.cc
+++ b/src/freedreno/vulkan/tu_lrz.cc
@@ -815,7 +815,8 @@ tu6_calculate_lrz_state(struct tu_cmd_buffer *cmd,
* enable late Z test.
*/
if (!disable_lrz_due_to_fs && fs->variant->writes_pos &&
- !fs->variant->fs.early_fragment_tests) {
+ !fs->variant->fs.early_fragment_tests &&
+ !cmd->device->instance->ignore_frag_depth_direction) {
if (fs->variant->fs.depth_layout == FRAG_DEPTH_LAYOUT_NONE ||
fs->variant->fs.depth_layout == FRAG_DEPTH_LAYOUT_ANY) {
disable_lrz_due_to_fs = true;
diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf
index d8cc6b63392..cdcf300c9d4 100644
--- a/src/util/00-mesa-defaults.conf
+++ b/src/util/00-mesa-defaults.conf
@@ -1262,6 +1262,9 @@ TODO: document the other workarounds.
-->
+
+
+
diff --git a/src/util/driconf.h b/src/util/driconf.h
index d46947b3bac..215097492c1 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -676,6 +676,10 @@
DRI_CONF_OPT_B(tu_use_tex_coord_round_nearest_even_mode, def, \
"Use D3D-compliant round-to-nearest-even mode for texture coordinates")
+#define DRI_CONF_TU_IGNORE_FRAG_DEPTH_DIRECTION(def) \
+ DRI_CONF_OPT_B(tu_ignore_frag_depth_direction, def, \
+ "Ignore direction specified for gl_FragDepth output")
+
/**
* \brief Honeykrisp specific configuration options
*/