http://bugs.winehq.org/show_bug.cgi?id=14724
Summary: Max Payne 2: PP effect performance (ORM=fbo) Product: Wine Version: CVS/GIT Platform: PC-x86-64 URL: http://www.rockstargames.com/maxpayne2/mp2_downloads.htm l OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: liquid.acid@gmx.net CC: onety-three@gmx.net
Hi,
this bug is about performance issues with post-processing (PP) effects in the demo of the game "Max Payne 2".
This bug is only about issues that happen when OffscreenRenderingMode is set to fbo. Please don't report issues with backbuffer or pbuffer mode here.
This is a split from this bug: http://bugs.winehq.org/show_bug.cgi?id=14038
Furthermore the bug should only focus on performance issues, since there are a lot more issues with PP effects, which are not related to performance.
The problem mostly seems to happen on nvidia Geforce FX 5xxx series cards.
Where are PP effect used in the game: - Bullettime mode is using a sepia tone filter - Cutscenes are motion blurred
What is BAD performance: One frame rendered every 5 seconds, which makes the game essentially unplayable. While cutscenes can be skipped, bullettime is crucial for the game and I'm sure there is noone out there who has finished it without using the feat.
There are two PP effect modes selectable ingame: (i) medium (which is the better working one) (ii) high (this is the more problematic one)
The issue itself: PP effects used in the game lead to severe slowdowns, resulting in BAD performance (as described above).
People confirming the problem: (i) Me, with a Geforce FX 5900 (ii) Frank Roscher, with a GeForce FX 5700
Driver versions: (i) Currently I have version 173.14.09 installed, but the problem also existed with nvidia-drivers-100.14.19 (ii) Frank has reported the problem with driver version 169.12
Possible reasons for the slowdown: The nvidia Geforce FX 5xxx series does report OpenGL 2.0 capabilities in the glxinfo, but does NOT explicitly advertise the GL_ARB_npot in the extension string. The only NPOT-like extension advertised is the texture_rectangle one.
OpenGL 2.0 support however implies support of GL_ARB_npot, since this one is now in core. Stefan Dösinger comments on that behaviour in http://bugs.winehq.org/show_bug.cgi?id=14038#c28 According to him the FX hits a (slower) software fallback as soon as the ARB_npot/"unconditional NP2 support" extension is used.
That also seems to be the core of the problem. Wine should not use unconditional NP2 for the FX and instead of the (conditional) texture_rectangle support, which should be supported by the FX in hardware.
New problems arise in latest git master when disabling usage of NP2 in directx.c (by commenting out the line with the extension). I will comment on these (new) problems later.
----------------------------------------------------------------------------
But first, some HISTORY about the problem:
With PPE (PP effects) = medium (and a resolution of 800x600):
wine-0.9.25: Performance in bullettime is OK, but visuals are suffering from cropping bug (*) and room-disconnection errors (**)
---- somewhere here the cropping bug is solved for fbo ----
wine-0.9.45: Performance in bullettime is OK, visuals are also OK (no cropping, no room-disconnections) But there is a problem with intro and outro videos (those are not rendered fullscreen and leave a lot of black borders around them)
wine-0.9.56: Performance in bullettime is OK, visuals also OK No problems with intro/outro videos
---- somewhere here is currently the best version to play MP2 ----
wine-1.0.0: Performance in bullettime is OK, visuals also OK texture_shader FIXMEs flooding the console (not only in scenes with PP effects)
wine-1.1.0: Same like wine-1.0.0
wine-1.1.1: Same like wine-1.0.0, furthermore in scenes with PP effects (not only bullettime) these FIXMEs flood the console (I filtered the ones about nvts): fixme:d3d_surface:read_from_framebuffer_texture >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from glReadBuffer @ surface.c / 913 fixme:d3d_shader:shader_arb_deselect_depth_blt >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION (0x502) from glDisable(GL_VERTEX_PROGRAM_ARB) @ arb_program_shader.c / 1840
wine-1.1.2: Performance in bullettime is BAD (same applies to PP effects in cutscenes), visuals however are OK nvts FIXMEs are gone, but there are new ones which are generated while PP effects are displayed on screen: fixme:d3d_surface:read_from_framebuffer_texture >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from glReadBuffer @ surface.c / 920
wine git master from 2.8.2008: Performance like wine-1.1.2, visuals are now completly broken - the screen goes black after going into bullettime, returns to normal view after bullettime is over (takes some time after pressing the bt key again). The FIXMEs from wine-1.1.2 are still there.
We see here that MP2 is gradually broken.
(*): For the cropping bug see: http://bugs.winehq.org/show_bug.cgi?id=14686 (**): A screenshot is going to be attached
----------------------------------------------------------------------------
With PPE (PP effects) = high (and a resolution of 800x600):
wine-0.9.25: Performance is BAD, sepia filter is correctly applied, but game suffers again from the room-disconnection bug, no cropping issue here. Cutscenes however are rendered incorrectly, looks like some sort of zooming is going on.
wine-0.9.45: Performance is OK, both bullettime and cutscenes are rendered correctly (no room-disconnections, sepia filter correct, motion blur working), BUT: As soon as PP effects are used the used screen content is shrinked to a subarea of the original screen. Note that this is NOT a cropping effect, it's just that the rendered pictures are now confined in the subarea. Like with PPE=medium the intro/outro videos are rendered incorrectly. Apart from that this is the best version if you wanna use high PP effects.
---- rendering breaks by introducing commit d09cbcec91561186bee77aaba55b29cbf2d7e7ef ----
wine-0.9.56: This one has broken rendering. Performance is still OK, but as soon as bullettime is enabled the screen is filled with a solid color. HOWEVER cutscenes (which also use postprocessing) work without problems. Cutscenes are rendered with motion blur, no cropping and GOOD performance.
wine-1.0.0: Like wine-0.9.56 but the nvts FIXME flooding is introduced. Cutscenes still working perfectly, but bt is broken.
wine-1.1.0: Same like wine-1.0.0
wine-1.1.1: Same like wine-1.0.0, but now these FIXMEs flood the console as soon as PP effects are used: fixme:d3d_surface:read_from_framebuffer_texture >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from glReadBuffer @ surface.c / 913 fixme:d3d_shader:shader_arb_deselect_depth_blt >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION (0x502) from glDisable(GL_VERTEX_PROGRAM_ARB) @ arb_program_shader.c / 1840
---- commit c088edeae7fed4645fa3f34fb5bacc1eeaa87706 from Stefan Dösinger fixes the bt sepia filter but introduces the major slowdowns ----
wine-1.1.2: Bullettime PP is restored, but performance is BAD now. Cutscene PP has the same issues now, it suffers from major slowdown. As soon as PP effects are used I see these FIXMEs on console: fixme:d3d_surface:read_from_framebuffer_texture >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from glReadBuffer @ surface.c / 920 The nvts FIXMEs are gone with this version.
wine git master from 2.8.2008: Breaks even more, as soon as PP effects are on screen the screen goes black. Leaving bt restores the scene, but when canceling cutscenes the scenes stays black. I have to enter bt and leave it again to restore the view. Very strange.
----------------------------------------------------------------------------
This concludes my current research (for now).
Greets, Tobias
http://bugs.winehq.org/show_bug.cgi?id=14724
--- Comment #1 from Tobias Jakobi liquid.acid@gmx.net 2008-08-01 20:07:41 --- Created an attachment (id=15214) --> (http://bugs.winehq.org/attachment.cgi?id=15214) the room disconnect bug
Illustrates the visual error that i named "room disconnect bug". Seems like mp2 uses some sort of portal system between rooms and in bt mode this (rendering) system breaks a bit. However it's not that interesting for the bug because it was fixed long ago.
http://bugs.winehq.org/show_bug.cgi?id=14724
Tobias Jakobi liquid.acid@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alexd4@inbox.lv
http://bugs.winehq.org/show_bug.cgi?id=14724
Tobias Jakobi liquid.acid@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |stefandoesinger@gmx.at Keywords| |download, regression
http://bugs.winehq.org/show_bug.cgi?id=14724
Tobias Jakobi liquid.acid@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |hverbeet@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=14724
Tobias Jakobi liquid.acid@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jb.faq@gmx.de
http://bugs.winehq.org/show_bug.cgi?id=14724
--- Comment #2 from Stefan Dösinger stefandoesinger@gmx.at 2008-08-02 08:38:59 --- I think you can't separate the issues. They're all related to conditional non power of two textures. I think its likely that the performance and rendering bugs are related. FBO-specific problems could be a separate issue though
http://bugs.winehq.org/show_bug.cgi?id=14724
--- Comment #3 from Tobias Jakobi liquid.acid@gmx.net 2008-08-02 08:51:07 --- (In reply to comment #2)
I think you can't separate the issues. They're all related to conditional non power of two textures. I think its likely that the performance and rendering bugs are related. FBO-specific problems could be a separate issue though
That's the reason for this report only to include information about the issues when ORM=fbo.
http://bugs.winehq.org/show_bug.cgi?id=14724
--- Comment #4 from Tobias Jakobi liquid.acid@gmx.net 2008-08-02 09:45:01 --- Update: http://www.opengl.org/wiki/index.php/NPOT_Textures
Quoting from the link: With GL 2.0, you can make textures of any type (2D, 3D, cubemap), with any dimension, any filter mode, mipmaps, anisotropy, any wrap mode. It may however run in software mode. If GL_ARB_texture_non_power_of_two is present, it should always run in hw mode. GL_ARB_texture_non_power_of_two is thus an indicator extension. If you don't have GL_ARB_texture_non_power_of_two, then you can make NPOT texture, just that follow the same limitation as for GL_ARB_texture_rectangle (no mipmaps, GL_CLAMP_TO_EDGE, etc) and it will be hw accelerated. Geforce FX is an exception. It will always do software rendering. You have to use GL_ARB_texture_rectangle for this GPU.
@Stefan: So we should add the FX series to the fixup list and disable unconditional NP2 support completly, right?
Leaves us with the question: Why does bullettime PP effects stop working after enabling the texture_rectangle extension?
Greets, Tobias
http://bugs.winehq.org/show_bug.cgi?id=14724
--- Comment #5 from Tobias Jakobi liquid.acid@gmx.net 2008-08-02 10:52:22 --- Sorry, I first thought that adding the FX series to the second fixup in fixup_extensions (directx.c, around line 3688 in current git) would be enough.
But after reading the comment there it doesn't seem to be a correct fix. According to the comment on OpenGL.org the driver falls back to software as soon as ARB_texture_npot is used, even if we're staying inside the limitations of the tex_rect extension. So we need a different fixup here that just removes ARB_tex_npot from the supported list of extensions. Something that does the same like removing the ext from the array in directx.c...
http://bugs.winehq.org/show_bug.cgi?id=14724
--- Comment #6 from Tobias Jakobi liquid.acid@gmx.net 2008-08-02 14:53:33 --- Created an attachment (id=15222) --> (http://bugs.winehq.org/attachment.cgi?id=15222) simple test application for NPOT/POT texture performance
Very simple test application to verify the claim that the Geforce FX series falls back to a software path as soon as the ARB_tex_npot extension is used (and not only when more features than the ones from ARB_tex_rect are used).
Tarball includes a script to compile, the source itself and two raw textures (one POT size, the other one NPOT).
App needs GL and GLUT libraries to compile. Maybe you have to edit the compile.sh
Control the app with the 'f' key, which changes from NPOT mode to POT and vice-versa. Each time the mode is changed a FPS value is computed, so you can check performance.
http://bugs.winehq.org/show_bug.cgi?id=14724
--- Comment #7 from Frank Roscher onety-three@gmx.net 2008-08-03 02:30:25 --- (In reply to comment #6) Here's the output on my system:
buffer swaps: 1413 time passed: 0.370000 seconds fps: 3818.918870 switching to NPOT texture buffer swaps: 500 time passed: 19.969999 seconds fps: 25.037557
(It seems the time passed in the POT case is calculated wrongly. I let it run for 20 seconds in both cases) Further runs yield similar numbers.
http://bugs.winehq.org/show_bug.cgi?id=14724
--- Comment #8 from Tobias Jakobi liquid.acid@gmx.net 2008-08-03 09:36:02 --- Hmm, I though I had the init code correct by now. Probably it's still not working, but the app should output correct values after the first mode switch. However the NPOT performance speaks for itself, considering this is a single quad with a lowres texture.
Gonna post my patch to the ml in a few hours.
Cheers, Tobias
http://bugs.winehq.org/show_bug.cgi?id=14724
Tobias Jakobi liquid.acid@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #9 from Tobias Jakobi liquid.acid@gmx.net 2008-08-04 09:01:22 --- Patch is in wine git master, resolving to FIXED.
I'm opening separate bugs for the remaining issues.
http://bugs.winehq.org/show_bug.cgi?id=14724
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #10 from Alexandre Julliard julliard@winehq.org 2008-08-22 10:48:48 --- Closing bugs fixed in 1.1.3.
http://bugs.winehq.org/show_bug.cgi?id=14724
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|CVS/GIT |unspecified