Skip to content

Commit

Permalink
mesa: Fix various issues with Indiana Jones
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Naim <[email protected]>
  • Loading branch information
1Naim authored and ptr1337 committed Dec 13, 2024
1 parent feb0b07 commit b28bffd
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 5 deletions.
17 changes: 13 additions & 4 deletions mesa/mesa/.SRCINFO
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pkgbase = mesa
pkgdesc = Open-source OpenGL drivers
pkgver = 24.3.1
pkgrel = 4
pkgrel = 6
epoch = 1
url = https://www.mesa3d.org/
arch = x86_64
Expand Down Expand Up @@ -59,6 +59,9 @@ pkgbase = mesa
source = 0001-dri-don-t-fetch-X11-modifiers-if-we-don-t-support-th.patch
source = 0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch
source = 0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch
source = 0004-radv-add-radv_disable_dcc_stores-and-enable-for-Indi.patch
source = 0005-radv-fix-disabling-DCC-for-stores-with-drirc.patch
source = 0006-radv-Add-radv_invariant_geom-true-for-Indiana-Jones.patch
source = ucd-trie-0.1.6.tar.gz::https://crates.io/api/v1/crates/ucd-trie/0.1.6/download
source = pest_meta-2.7.11.tar.gz::https://crates.io/api/v1/crates/pest_meta/2.7.11/download
source = indexmap-2.2.6.tar.gz::https://crates.io/api/v1/crates/indexmap/2.2.6/download
Expand All @@ -85,6 +88,9 @@ pkgbase = mesa
sha256sums = 2c20fee505be9a1f08546b63457b8378b0f1fcff58e60c03378b7de0a87a1e81
sha256sums = a58e6d0631da6dd077530136bb44f0233cd279fc75e3b65b495ec90be16db91a
sha256sums = 606acb4073f46c7ca7edec96b6af06619642f3bbcd6afab2c57bff26266b917f
sha256sums = 26a94d0d5f04d10570cbcac4cd22a27815485c963ad799b68b5b964faea2dbf9
sha256sums = beb02ca314b2e9840a8573d8bf2bbde718372fd60a23ed9905a6b65305edfd1c
sha256sums = c92d1089f7b8285031027eacde67519aae33a2bdc0fc75c6702e82fbf0d4e65e
sha256sums = ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9
sha256sums = a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f
sha256sums = 168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26
Expand All @@ -105,6 +111,9 @@ pkgbase = mesa
b2sums = d7a57fefd0ff94bbd88a9433b27b9037c07070f097264027f17026011259f33236a618b645a1a506b377da22f8c887f55f83c6320a8c7b6c3db32d90f60a5e93
b2sums = c1c722b0249808d34863e8b650fd2e60eb7e6168fd9e3948e8d260624a9753ec89332b0831faddf2b4dea388b74f07479ab833d1ad772edd8f20fe55bf5a813b
b2sums = 48105e489e06e9ad714cb61e23ef0962c308fb79f263111b6e102f3e8beed479bdd15cee7f3a5876da658ea1f25b1b1369a89f24bf6c6bb3285833b1206d1c29
b2sums = 7cd680e61e8cd3295829cff958f6c72005c7b717e6e8b329658279799ab36ef4aa4c8c84c07676e185b00dba7b408179bd94c602d65aece19a383a9210026c8c
b2sums = 943c6bfc24e6e973aaf2d887f0a11f3d4f344dd4ed68e51b7f39dc494ecfce7d1eca3a55783644948a85a812b865d876edc0f920a991a4ad4ff0c90abc67f076
b2sums = 05d098c77d7aefa85b7d512700f8bed7ede45932fdf41ad25827baf4dba26907d14e60fd4a588c08cffa09abbf184727bc7814478d257cf9d2102973b06d7b38
b2sums = a6d47c903be6094423d89b8ec3ca899d0a84df6dbd6e76632bb6c9b9f40ad9c216f8fa400310753d392f85072756b43ac3892e0a2c4d55f87ab6463002554823
b2sums = 9c34f1ab14ad5ae124882513e0f14b1d731d06a43203bdc37fa3b202dd3ce93dbe8ebb554d01bab475689fe6ffd3ec0cbc0d5365c9b984cb83fb34ea3e9e732e
b2sums = fac5cf6339dc3c0a40b100035a5c874cc7b2efeafeb31c51488d25156e392dc9db86a497e76eead351d2126f69d060422faa9c55d73407a0de9f5be18d234123
Expand Down Expand Up @@ -140,9 +149,9 @@ pkgname = mesa
depends = zlib
depends = zstd
optdepends = opengl-man-pages: for the OpenGL API man pages
provides = libva-mesa-driver=1:24.3.1-4
provides = mesa-libgl=1:24.3.1-4
provides = mesa-vdpau=1:24.3.1-4
provides = libva-mesa-driver=1:24.3.1-6
provides = mesa-libgl=1:24.3.1-6
provides = mesa-vdpau=1:24.3.1-6
provides = libva-driver
provides = opengl-driver
provides = vdpau-driver
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
From e6caa0f7991b00bb3a61dccf0b1022ee857d96c7 Mon Sep 17 00:00:00 2001
From: Samuel Pitoiset <[email protected]>
Date: Fri, 6 Dec 2024 16:25:18 +0100
Subject: [PATCH 4/6] radv: add radv_disable_dcc_stores and enable for Indiana
Jones: The Great Circle

Likely a game bug but can't be 100% sure because the game uses RT by
default and renderdoc still doesn't have support for it.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32528>
(cherry picked from commit e3d1f27b31816ce9e8fddfe9c669059893cd8934)

Conflicts:
src/util/00-radv-defaults.conf
---
.gitignore | 1 +
src/amd/vulkan/radv_image.c | 4 ++++
src/amd/vulkan/radv_instance.c | 2 ++
src/amd/vulkan/radv_instance.h | 1 +
src/util/00-radv-defaults.conf | 6 ++++++
src/util/driconf.h | 4 ++++
6 files changed, 18 insertions(+)

diff --git a/.gitignore b/.gitignore
index 30f4e69ea7d..3f389086fbf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
*.out
/build
.venv/
+.pick_status.json
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 5cc04237679..354e7951b31 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -295,6 +295,10 @@ radv_use_dcc_for_image_early(struct radv_device *device, struct radv_image *imag
if (instance->drirc.disable_dcc_mips && pCreateInfo->mipLevels > 1)
return false;

+ /* Force disable DCC for stores to workaround game bugs. */
+ if (instance->drirc.disable_dcc_stores && (pCreateInfo->usage & VK_IMAGE_USAGE_STORAGE_BIT))
+ 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;
diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c
index df2ae2cd307..f81edfd8663 100644
--- a/src/amd/vulkan/radv_instance.c
+++ b/src/amd/vulkan/radv_instance.c
@@ -153,6 +153,7 @@ static const driOptionDescription radv_dri_options[] = {
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_DCC_STORES(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)
@@ -265,6 +266,7 @@ radv_init_dri_options(struct radv_instance *instance)
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");
+ instance->drirc.disable_dcc_stores = driQueryOptionb(&instance->drirc.options, "radv_disable_dcc_stores");
}

static const struct vk_instance_extension_table radv_instance_extensions_supported = {
diff --git a/src/amd/vulkan/radv_instance.h b/src/amd/vulkan/radv_instance.h
index 876461b642b..57d6bdc5a48 100644
--- a/src/amd/vulkan/radv_instance.h
+++ b/src/amd/vulkan/radv_instance.h
@@ -72,6 +72,7 @@ struct radv_instance {
bool vk_require_etc2;
bool vk_require_astc;
bool disable_dcc_mips;
+ bool disable_dcc_stores;
char *app_layer;
uint8_t override_graphics_shader_version;
uint8_t override_compute_shader_version;
diff --git a/src/util/00-radv-defaults.conf b/src/util/00-radv-defaults.conf
index 5bf2bedc960..d125e24ede8 100644
--- a/src/util/00-radv-defaults.conf
+++ b/src/util/00-radv-defaults.conf
@@ -109,6 +109,12 @@ Application bugs worked around in this file:
<option name="radv_legacy_sparse_binding" value="true" />
</application>

+ <application name="Indiana Jones: The Great Circle" application_name_match="TheGreatCircle">
+ <option name="radv_zero_vram" value="true" />
+ <option name="radv_legacy_sparse_binding" value="true" />
+ <option name="radv_disable_dcc_stores" value="true" />
+ </application>
+
<application name="DOOM (2016)" application_name_match="DOOM$">
<option name="radv_disable_dcc" value="true" />
</application>
diff --git a/src/util/driconf.h b/src/util/driconf.h
index 769d2dfd7d5..f988ad7fc8c 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -696,6 +696,10 @@
DRI_CONF_OPT_B(radv_disable_dcc_mips, def, \
"Disable DCC for color images with mips")

+#define DRI_CONF_RADV_DISABLE_DCC_STORES(def) \
+ DRI_CONF_OPT_B(radv_disable_dcc_stores, def, \
+ "Disable DCC for color storage images")
+
#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")
--
2.47.1

36 changes: 36 additions & 0 deletions mesa/mesa/0005-radv-fix-disabling-DCC-for-stores-with-drirc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 3bbf8a159ece1d941ef7249309dedd463897a4ad Mon Sep 17 00:00:00 2001
From: Samuel Pitoiset <[email protected]>
Date: Wed, 11 Dec 2024 11:39:52 +0100
Subject: [PATCH 5/6] radv: fix disabling DCC for stores with drirc

Displayable DCC should also be disabled, otherwise it's asserting
somewhere in ac_surface.c

Fixes: e3d1f27b318 ("radv: add radv_disable_dcc_stores and enable for Indiana Jones: The Great Circle")
Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32584>
(cherry picked from commit 4d1aa9a2d0858c975e365a63234301256fa9cc77)
---
src/amd/vulkan/radv_formats.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
index b56cf52f275..d8410814553 100644
--- a/src/amd/vulkan/radv_formats.c
+++ b/src/amd/vulkan/radv_formats.c
@@ -627,10 +627,10 @@ radv_get_modifier_flags(struct radv_physical_device *pdev, VkFormat format, uint
return 0;

/* Only disable support for STORAGE_IMAGE on modifiers that
- * do not support DCC image stores.
+ * do not support DCC image stores or when explicitly disabled.
*/
if (!ac_modifier_supports_dcc_image_stores(pdev->info.gfx_level, modifier) ||
- radv_is_atomic_format_supported(format))
+ radv_is_atomic_format_supported(format) || instance->drirc.disable_dcc_stores)
features &= ~VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT;

if (instance->debug_flags & (RADV_DEBUG_NO_DCC | RADV_DEBUG_NO_DISPLAY_DCC))
--
2.47.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 4845f1d6d8b0d9ab3213e2af6054cc8f1e65c4b8 Mon Sep 17 00:00:00 2001
From: Hans-Kristian Arntzen <[email protected]>
Date: Thu, 12 Dec 2024 11:59:37 +0100
Subject: [PATCH 6/6] radv: Add radv_invariant_geom=true for Indiana Jones.

Water puddles expect invariant position, but does not declare such in
the vertex shaders, leading to random glitches.

Signed-off-by: Hans-Kristian Arntzen <[email protected]>
Cc: mesa-stable
Reviewed-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32607>
(cherry picked from commit e815d6523c2baa1f7c80d8c25823ac249846bb13)
---
src/util/00-radv-defaults.conf | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/util/00-radv-defaults.conf b/src/util/00-radv-defaults.conf
index d125e24ede8..be85f17453b 100644
--- a/src/util/00-radv-defaults.conf
+++ b/src/util/00-radv-defaults.conf
@@ -113,6 +113,7 @@ Application bugs worked around in this file:
<option name="radv_zero_vram" value="true" />
<option name="radv_legacy_sparse_binding" value="true" />
<option name="radv_disable_dcc_stores" value="true" />
+ <option name="radv_invariant_geom" value="true" />
</application>

<application name="DOOM (2016)" application_name_match="DOOM$">
--
2.47.1

17 changes: 16 additions & 1 deletion mesa/mesa/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pkgname=(
mesa-docs
)
pkgver=24.3.1
pkgrel=4
pkgrel=6
epoch=1
pkgdesc="Open-source OpenGL drivers"
url="https://www.mesa3d.org/"
Expand Down Expand Up @@ -97,6 +97,9 @@ source=(
0001-dri-don-t-fetch-X11-modifiers-if-we-don-t-support-th.patch
0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch
0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch
0004-radv-add-radv_disable_dcc_stores-and-enable-for-Indi.patch
0005-radv-fix-disabling-DCC-for-stores-with-drirc.patch
0006-radv-Add-radv_invariant_geom-true-for-Indiana-Jones.patch
)
validpgpkeys=(
946D09B5E4C9845E63075FF1D961C596A7203456 # Andres Gomez <[email protected]>
Expand Down Expand Up @@ -138,6 +141,9 @@ sha256sums=('9c795900449ce5bc7c526ba0ab3532a22c3c951cab7e0dd9de5fcac41b0843af'
'2c20fee505be9a1f08546b63457b8378b0f1fcff58e60c03378b7de0a87a1e81'
'a58e6d0631da6dd077530136bb44f0233cd279fc75e3b65b495ec90be16db91a'
'606acb4073f46c7ca7edec96b6af06619642f3bbcd6afab2c57bff26266b917f'
'26a94d0d5f04d10570cbcac4cd22a27815485c963ad799b68b5b964faea2dbf9'
'beb02ca314b2e9840a8573d8bf2bbde718372fd60a23ed9905a6b65305edfd1c'
'c92d1089f7b8285031027eacde67519aae33a2bdc0fc75c6702e82fbf0d4e65e'
'ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9'
'a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f'
'168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26'
Expand All @@ -158,6 +164,9 @@ b2sums=('d3efc322388e29f651b15b0396fef8a6acc0cf24881165900845e429dd6cb53d51511f1
'd7a57fefd0ff94bbd88a9433b27b9037c07070f097264027f17026011259f33236a618b645a1a506b377da22f8c887f55f83c6320a8c7b6c3db32d90f60a5e93'
'c1c722b0249808d34863e8b650fd2e60eb7e6168fd9e3948e8d260624a9753ec89332b0831faddf2b4dea388b74f07479ab833d1ad772edd8f20fe55bf5a813b'
'48105e489e06e9ad714cb61e23ef0962c308fb79f263111b6e102f3e8beed479bdd15cee7f3a5876da658ea1f25b1b1369a89f24bf6c6bb3285833b1206d1c29'
'7cd680e61e8cd3295829cff958f6c72005c7b717e6e8b329658279799ab36ef4aa4c8c84c07676e185b00dba7b408179bd94c602d65aece19a383a9210026c8c'
'943c6bfc24e6e973aaf2d887f0a11f3d4f344dd4ed68e51b7f39dc494ecfce7d1eca3a55783644948a85a812b865d876edc0f920a991a4ad4ff0c90abc67f076'
'05d098c77d7aefa85b7d512700f8bed7ede45932fdf41ad25827baf4dba26907d14e60fd4a588c08cffa09abbf184727bc7814478d257cf9d2102973b06d7b38'
'a6d47c903be6094423d89b8ec3ca899d0a84df6dbd6e76632bb6c9b9f40ad9c216f8fa400310753d392f85072756b43ac3892e0a2c4d55f87ab6463002554823'
'9c34f1ab14ad5ae124882513e0f14b1d731d06a43203bdc37fa3b202dd3ce93dbe8ebb554d01bab475689fe6ffd3ec0cbc0d5365c9b984cb83fb34ea3e9e732e'
'fac5cf6339dc3c0a40b100035a5c874cc7b2efeafeb31c51488d25156e392dc9db86a497e76eead351d2126f69d060422faa9c55d73407a0de9f5be18d234123'
Expand Down Expand Up @@ -186,6 +195,12 @@ prepare() {
patch -Np1 -i ../0002-egl-wayland-only-supply-LINEAR-modifier-when-support.patch
patch -Np1 -i ../0003-egl-wayland-fallback-to-implicit-modifiers-if-advert.patch

# Fix Indiana Jones issues
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/12257
patch -Np1 -i ../0004-radv-add-radv_disable_dcc_stores-and-enable-for-Indi.patch
patch -Np1 -i ../0005-radv-fix-disabling-DCC-for-stores-with-drirc.patch
patch -Np1 -i ../0006-radv-Add-radv_invariant_geom-true-for-Indiana-Jones.patch

# Include package release in version string so Chromium invalidates
# its GPU cache; otherwise it can cause pages to render incorrectly.
# https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/2020604
Expand Down

0 comments on commit b28bffd

Please sign in to comment.