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 <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31152>
(cherry picked from commit bacf9752f4)
This commit is contained in:
Konstantin Seurer 2024-09-12 16:59:54 +02:00 committed by Eric Engestrom
parent 7f69a4901c
commit b73ffb6bfe
6 changed files with 20 additions and 1 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -206,5 +206,12 @@ Application bugs worked around in this file:
<application name="Enshrouded" executable="enshrouded.exe">
<option name="radv_zero_vram" value="true"/>
</application>
<!-- If storage features for depth formats are advertised, the Game chooses a code path
for Terrain height map initialization that has countless bugs:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/11265 -->
<application name="Total War: WARHAMMER III" application_name_match="TotalWarhammer3">
<option name="radv_disable_depth_storage" value="true"/>
</application>
</device>
</driconf>

View file

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