From b73ffb6bfe875415f49ef7c7cf527bdf67f0eb91 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Thu, 12 Sep 2024 16:59:54 +0200 Subject: [PATCH] radv: Work around broken terrain in Warhammer III Hiding storage support for depth formats forces the game to take a different, working path for terrain height map initialization. cc: mesa-stable Reviewed-by: Samuel Pitoiset Part-of: (cherry picked from commit bacf9752f4dbfd0c11995bd4cce0050cb8c2a606) --- .pick_status.json | 2 +- src/amd/vulkan/radv_formats.c | 4 ++++ src/amd/vulkan/radv_instance.c | 3 +++ src/amd/vulkan/radv_instance.h | 1 + src/util/00-radv-defaults.conf | 7 +++++++ src/util/driconf.h | 4 ++++ 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 7f3bab93bc8..05dc5c5ad55 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -924,7 +924,7 @@ "description": "radv: Work around broken terrain in Warhammer III", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index 904c47d77c9..373d8f98ab2 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -108,6 +108,7 @@ radv_is_atomic_format_supported(VkFormat format) bool radv_is_storage_image_format_supported(const struct radv_physical_device *pdev, VkFormat format) { + const struct radv_instance *instance = radv_physical_device_instance(pdev); const struct util_format_description *desc = vk_format_description(format); unsigned data_format, num_format; if (format == VK_FORMAT_UNDEFINED) @@ -116,6 +117,9 @@ radv_is_storage_image_format_supported(const struct radv_physical_device *pdev, if (vk_format_has_stencil(format)) return false; + if (instance->drirc.disable_depth_storage && vk_format_has_depth(format)) + return false; + data_format = radv_translate_tex_dataformat(pdev, desc, vk_format_get_first_non_void_channel(format)); num_format = radv_translate_tex_numformat(desc, vk_format_get_first_non_void_channel(format)); diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c index 132144ac280..9eba490397b 100644 --- a/src/amd/vulkan/radv_instance.c +++ b/src/amd/vulkan/radv_instance.c @@ -148,6 +148,7 @@ static const driOptionDescription radv_dri_options[] = { DRI_CONF_RADV_DISABLE_ANISO_SINGLE_LEVEL(false) DRI_CONF_RADV_DISABLE_TRUNC_COORD(false) DRI_CONF_RADV_DISABLE_SINKING_LOAD_INPUT_FS(false) + DRI_CONF_RADV_DISABLE_DEPTH_STORAGE(false) DRI_CONF_RADV_DGC(false) DRI_CONF_RADV_FLUSH_BEFORE_QUERY_COPY(false) DRI_CONF_RADV_ENABLE_UNIFIED_HEAP_ON_APU(false) @@ -210,6 +211,8 @@ radv_init_dri_options(struct radv_instance *instance) instance->drirc.disable_sinking_load_input_fs = driQueryOptionb(&instance->drirc.options, "radv_disable_sinking_load_input_fs"); + instance->drirc.disable_depth_storage = driQueryOptionb(&instance->drirc.options, "radv_disable_depth_storage"); + instance->drirc.flush_before_query_copy = driQueryOptionb(&instance->drirc.options, "radv_flush_before_query_copy"); instance->drirc.enable_unified_heap_on_apu = diff --git a/src/amd/vulkan/radv_instance.h b/src/amd/vulkan/radv_instance.h index b33a9295c01..e87a5301c60 100644 --- a/src/amd/vulkan/radv_instance.h +++ b/src/amd/vulkan/radv_instance.h @@ -50,6 +50,7 @@ struct radv_instance { bool disable_shrink_image_store; bool disable_aniso_single_level; bool disable_trunc_coord; + bool disable_depth_storage; bool zero_vram; bool disable_sinking_load_input_fs; bool flush_before_query_copy; diff --git a/src/util/00-radv-defaults.conf b/src/util/00-radv-defaults.conf index 1a503018413..364b2a0e8a2 100644 --- a/src/util/00-radv-defaults.conf +++ b/src/util/00-radv-defaults.conf @@ -206,5 +206,12 @@ Application bugs worked around in this file: + + + + diff --git a/src/util/driconf.h b/src/util/driconf.h index 362c0b84ffb..86cda10bf09 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -669,6 +669,10 @@ DRI_CONF_OPT_B(radv_disable_sinking_load_input_fs, def, \ "Disable sinking load inputs for fragment shaders") +#define DRI_CONF_RADV_DISABLE_DEPTH_STORAGE(def) \ + DRI_CONF_OPT_B(radv_disable_depth_storage, def, \ + "Hides support for storage access to depth formats") + #define DRI_CONF_RADV_DGC(def) \ DRI_CONF_OPT_B(radv_dgc, def, \ "Expose an experimental implementation of VK_NV_device_generated_commands")