radv: add a new drirc option to disable DCC for mips and enable it for RDR2

The game aliases two images. It binds a memory object to two different
images, the first one being an image with 4 mips and the second with
only one mip but the bind offset is incorrect. It's like it queried
the first image size with different usage flags, so that DCC was
disabled.

Force disabling DCC for mips fixes the incorrect rendering and doesn't
hurt performance.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10200
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32190>
This commit is contained in:
Samuel Pitoiset
2024-11-18 16:00:36 +01:00
committed by Marge Bot
parent 2e51d0c724
commit 2f13723c0a
5 changed files with 15 additions and 0 deletions
+4
View File
@@ -291,6 +291,10 @@ radv_use_dcc_for_image_early(struct radv_device *device, struct radv_image *imag
return false;
}
/* Force disable DCC for mips to workaround game bugs. */
if (instance->drirc.disable_dcc_mips && pCreateInfo->mipLevels > 1)
return false;
/* DCC MSAA can't work on GFX10.3 and earlier without FMASK. */
if (pCreateInfo->samples > 1 && pdev->info.gfx_level < GFX11 && (instance->debug_flags & RADV_DEBUG_NO_FMASK))
return false;
+3
View File
@@ -154,6 +154,7 @@ static const driOptionDescription radv_dri_options[] = {
DRI_CONF_RADV_SPLIT_FMA(false)
DRI_CONF_RADV_DISABLE_TC_COMPAT_HTILE_GENERAL(false)
DRI_CONF_RADV_DISABLE_DCC(false)
DRI_CONF_RADV_DISABLE_DCC_MIPS(false)
DRI_CONF_RADV_DISABLE_ANISO_SINGLE_LEVEL(false)
DRI_CONF_RADV_DISABLE_TRUNC_COORD(false)
DRI_CONF_RADV_DISABLE_SINKING_LOAD_INPUT_FS(false)
@@ -264,6 +265,8 @@ radv_init_dri_options(struct radv_instance *instance)
instance->drirc.vk_require_etc2 = driQueryOptionb(&instance->drirc.options, "vk_require_etc2");
instance->drirc.vk_require_astc = driQueryOptionb(&instance->drirc.options, "vk_require_astc");
instance->drirc.disable_dcc_mips = driQueryOptionb(&instance->drirc.options, "radv_disable_dcc_mips");
}
static const struct vk_instance_extension_table radv_instance_extensions_supported = {
+1
View File
@@ -71,6 +71,7 @@ struct radv_instance {
bool report_llvm9_version_string;
bool vk_require_etc2;
bool vk_require_astc;
bool disable_dcc_mips;
char *app_layer;
uint8_t override_graphics_shader_version;
uint8_t override_compute_shader_version;
+3
View File
@@ -132,6 +132,9 @@ Application bugs worked around in this file:
<application name="RDR2" application_name_match="Red Dead Redemption 2">
<option name="radv_enable_unified_heap_on_apu" value="true" />
<option name="radv_zero_vram" value="true" />
<!-- Disable DCC for mips to workaround rendering issues because
the game aliases two images incorrectly. -->
<option name="radv_disable_dcc_mips" value="true" />
</application>
<application name="Metro Exodus (Linux native)" application_name_match="metroexodus">
+4
View File
@@ -692,6 +692,10 @@
DRI_CONF_OPT_B(radv_disable_dcc, def, \
"Disable DCC for color images")
#define DRI_CONF_RADV_DISABLE_DCC_MIPS(def) \
DRI_CONF_OPT_B(radv_disable_dcc_mips, def, \
"Disable DCC for color images with mips")
#define DRI_CONF_RADV_DISABLE_ANISO_SINGLE_LEVEL(def) \
DRI_CONF_OPT_B(radv_disable_aniso_single_level, def, \
"Disable anisotropic filtering for single level images")