https://bugs.winehq.org/show_bug.cgi?id=43246
Bug ID: 43246 Summary: King's Bounty: The Legend suffers from performance issues Product: Wine Version: 2.1 Hardware: x86 URL: https://www.fileplanet.com/191666/190000/fileinfo/King 's-Bounty:-The-Legend-Updated-Demo OS: Linux Status: NEW Keywords: download, regression Severity: normal Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: gyebro69@gmail.com CC: hverbeet@gmail.com Regression SHA1: 15d53761a5fbfc12fc5f9974c029dace00eab33d Distribution: ---
Created attachment 58554 --> https://bugs.winehq.org/attachment.cgi?id=58554 terminal output
The game runs much slower than it used to: animations, character and mouse movement are way too slow. Reproduced the issue with nouveau/mesa 17.1.3 and nvidia binary drivers 381.22. Disabling anti-aliasing and lowering detail level to the minimum doesn't help.
According to my testing the commit which caused the slowdown is
commit 15d53761a5fbfc12fc5f9974c029dace00eab33d Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Jan 31 15:47:10 2017 +0100
wined3d: Do not pin system memory in wined3d_buffer_load_location().
Maybe a duplicate of bug #42588, although the symptoms are different. With the previous commit the game runs much smoothly. For comparison, in Wine 2.11 I'm getting only 4-5 fps when using nvidia 381.22. Before the regression Wine gave me 32-36 fps.
Steps to reproduce the issue with the demo: 1. download and install the demo, install native d3dx9_33.dll before launching the game. 2. in the main menu start a new game, click <Next> on the character selection screen, press <Skip>. You are in a training chamber: run around in the room, rotate the camera using the right mouse button and observe how sluggish the game is. You can save the game here so you can reproduce the issue more easily the next time you enter the game.
KingsBounty_TheLegend_Demo2.exe (682 MB) sha1: 7b60066a63cd4ee8a242347ebc1802a60453d9b2
Wine 2.11 OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GT 730/PCIe/SSE2 OpenGL core profile version string: 4.5.0 NVIDIA 381.22
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #1 from Béla Gyebrószki gyebro69@gmail.com --- Would like to add that enabling CSMT makes things worse in the game: loading times are terrible, in the main menu when you click on a button it takes 5-10 seconds to activate. In-game performance is worse than without CSMT.
https://bugs.winehq.org/show_bug.cgi?id=43246
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |performance
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #2 from Henri Verbeet hverbeet@gmail.com --- Created attachment 58717 --> https://bugs.winehq.org/attachment.cgi?id=58717 hack
The issue seems to be that the application uses buffers without D3DUSAGE_DYNAMIC as if they're dynamic. The attached hack fixes the performance for me, but doesn't strike me as correct.
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #3 from Béla Gyebrószki gyebro69@gmail.com --- (In reply to Henri Verbeet from comment #2)
Created attachment 58717 [details] hack
The issue seems to be that the application uses buffers without D3DUSAGE_DYNAMIC as if they're dynamic. The attached hack fixes the performance for me, but doesn't strike me as correct.
The patch fixes the issue for me as well.
https://bugs.winehq.org/show_bug.cgi?id=43246
Chris W cwadge@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |cwadge@gmail.com
--- Comment #4 from Chris W cwadge@gmail.com --- Can confirm that King's Bounty is affected. Additionally, this bug seems to affect Jade Empire as well.
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #5 from Béla Gyebrószki gyebro69@gmail.com --- Still present in wine-3.0-rc5 regarding King's Bounty: The Legend. I don't have such issue in Jade Empire, game works fine here.
OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GT 730/PCIe/SSE2 OpenGL core profile version string: 4.5.0 NVIDIA 387.34
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #6 from Chris W cwadge@gmail.com --- (In reply to Béla Gyebrószki from comment #5)
Still present in wine-3.0-rc5 regarding King's Bounty: The Legend.
Seems to be resolved (for me) in 3.0 final, clean prefix. Can you confirm?
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #7 from Béla Gyebrószki gyebro69@gmail.com --- (In reply to Chris W from comment #6)
(In reply to Béla Gyebrószki from comment #5)
Still present in wine-3.0-rc5 regarding King's Bounty: The Legend.
Seems to be resolved (for me) in 3.0 final, clean prefix. Can you confirm?
I can hardly see any improvement in Wine 3.0 or wine-3.0-124-gd877dce7a2. Performance is abysmal even on the lowest settings.
https://bugs.winehq.org/show_bug.cgi?id=43246
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=43246
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #8 from joaopa jeremielapuree@yahoo.fr --- Is still a bug in current wine(3.20)?
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #9 from Béla Gyebrószki gyebro69@gmail.com --- Still present in Wine 3.20.
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #10 from Matteo Bruni matteo.mystral@gmail.com --- (In reply to Henri Verbeet from comment #2)
Created attachment 58717 [details] hack
The issue seems to be that the application uses buffers without D3DUSAGE_DYNAMIC as if they're dynamic. The attached hack fixes the performance for me, but doesn't strike me as correct.
I tested non-dynamic D3DPOOL_DEFAULT buffers on Windows. It looks like there is no "consensus" wrt NOOVERWRITE maps (the flag is ignored on Nvidia but not on AMD) but DISCARD does in fact work as you'd expect, i.e. the second map returns a different memory address from the first and it doesn't block waiting for the buffer to become idle.
I'll probably have a look at the actual game soon.
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #11 from Matteo Bruni matteo.mystral@gmail.com --- (In reply to Matteo Bruni from comment #10)
I'll probably have a look at the actual game soon.
Obviously that was wishful thinking on my part. I managed to have a look, finally, and the result is... interesting.
I basically confirm comment 2: the game does a lot of buffer maps with DISCARD and NOOVERWRITE with non-DYNAMIC buffers and expects them to work as if they were DYNAMIC.
Problem is, they are not supposed to be fast with that kind of usage, as I described in detail in https://www.winehq.org/pipermail/wine-devel/2018-November/135071.html, especially for Nvidia. So I brought back the test from that email to investigate this even further on Windows.
Nothing new came up from that: non-DYNAMIC DEFAULT buffers simply ignore the NOOVERWRITE map flag on Nvidia and are thus very slow in those cases. Then I had the idea of renaming the test executable to kb.exe (which is the name of the game's executable): sure enough, non-DYNAMIC buffers started to perform exactly like DYNAMIC buffers...
I also tried to "break" the game by renaming the executable but that wasn't enough. I suspect it's still recognized somehow.
Bottom line: the game is broken, either the driver or the d3d9 runtime have a quirk for the game to workaround the breakage. Not sure what we should do, if anything.
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #12 from Henri Verbeet hverbeet@gmail.com --- (In reply to Matteo Bruni from comment #11)
Bottom line: the game is broken, either the driver or the d3d9 runtime have a quirk for the game to workaround the breakage. Not sure what we should do, if anything.
We could conceivably introduce a registry setting to allow DISCARD/NOOVERWRITE on static buffers.
https://bugs.winehq.org/show_bug.cgi?id=43246
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #13 from Zebediah Figura z.figura12@gmail.com --- I can't seem to reproduce this with current upstream wine + nouveau, with a GTX 750 and mesa version 21.3.0. FPS is inconsistent, but seems to hover around 15-25, either with the hack enabled or without it, and regardless of whether CSMT is enabled.
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #14 from Béla Gyebrószki gyebro69@gmail.com --- The problem remains on Nvidia 470.63.01. wine-6.15-241-gf33bf35d9a3
https://bugs.winehq.org/show_bug.cgi?id=43246
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=44863
https://bugs.winehq.org/show_bug.cgi?id=43246
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alexhenrie24@gmail.com See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=42588
https://bugs.winehq.org/show_bug.cgi?id=43246
Jaka registracije+winebugs@lynxlynx.info changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |registracije+winebugs@lynxl | |ynx.info
--- Comment #15 from Jaka registracije+winebugs@lynxlynx.info --- Just dropping by to say it's still an issue on 8.19.
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #16 from Ken Sharp imwellcushtymelike@gmail.com --- What about Wine 9.7?
https://bugs.winehq.org/show_bug.cgi?id=43246
--- Comment #17 from Jaka registracije+winebugs@lynxlynx.info --- Sorry, don't have easy access to it yet. Considering it's a game bug, I don't expect much to have changed though.