http://bugs.winehq.org/show_bug.cgi?id=33265
Bug #: 33265 Summary: HoMM 3 fails to create wgl context Product: Wine Version: 1.5.26 Platform: x86 OS/Version: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: winemac.drv AssignedTo: wine-bugs@winehq.org ReportedBy: per@morth.org Classification: Unclassified
Created attachment 43997 --> http://bugs.winehq.org/attachment.cgi?id=43997 tail of ddraw,display,d3d,wgl log
Not sure what the most proper fix is so I'm going to leave this as a bug report. Basically HoMM 3 (from gog.com) won't start with the mac driver, due to create_context in dlls/winemac.drv/opengl.c failing. It's trying to create a context with color bits set to 64 and alpha bits set to 16, which obviously fails.
Simply commenting out kCGLPFAColorSize, kCGLPFAAlphaSize and kCGLPFADepthSize will let the game start with no obvious drawbacks, but I don't know if it's a proper fix.
Also tried commenting out kCGLPFAMinimumPolicy, that would let the game start, but with a white screen only.
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #1 from Per Johansson per@morth.org 2013-03-23 16:15:49 CDT --- Created attachment 43998 --> http://bugs.winehq.org/attachment.cgi?id=43998 Workaround patch
http://bugs.winehq.org/show_bug.cgi?id=33265
Per Johansson per@morth.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ken@codeweavers.com
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #2 from Ken Thomases ken@codeweavers.com 2013-03-23 18:15:48 CDT --- (In reply to comment #0)
Created attachment 43997 [details] tail of ddraw,display,d3d,wgl log
Not sure what the most proper fix is so I'm going to leave this as a bug report. Basically HoMM 3 (from gog.com) won't start with the mac driver, due to create_context in dlls/winemac.drv/opengl.c failing. It's trying to create a context with color bits set to 64 and alpha bits set to 16, which obviously fails.
Simply commenting out kCGLPFAColorSize, kCGLPFAAlphaSize and kCGLPFADepthSize will let the game start with no obvious drawbacks, but I don't know if it's a proper fix.
Also tried commenting out kCGLPFAMinimumPolicy, that would let the game start, but with a white screen only.
The problem seems to be that D3D is picking that format:
trace:d3d:context_choose_pixel_format Found iPixelFormat=29 for ColorFormat=WINED3DFMT_B5G6R5_UNORM, DepthStencilFormat=WINED3DFMT_D24_UNORM_S8_UINT
The most likely problem is that the Mac driver has listed the formats in the wrong order or reported the wrong format attributes to D3D when queried. It's also possible that D3D has broken logic for picking a format. I'm afraid I'll need to see part of the log that you've omitted, where the Mac driver enumerates the pixel formats and where opengl32/d3d queries them.
http://bugs.winehq.org/show_bug.cgi?id=33265
Per Johansson per@morth.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #43997|0 |1 is obsolete| |
--- Comment #3 from Per Johansson per@morth.org 2013-03-24 04:20:18 CDT --- Created attachment 44000 --> http://bugs.winehq.org/attachment.cgi?id=44000 full log
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #4 from Ken Thomases ken@codeweavers.com 2013-03-24 05:20:09 CDT --- There seem to be a couple of issues. First, although the Mac driver's OpenGL code finds the pixel format when it's enumerating them, it can't use it later. Second, the order of the formats causes the logic in dlls/wined3d/context.c:context_choose_pixel_format() to pick a format with much bigger color buffers than strictly necessary. The first is a real problem; the second is probably just suboptimal.
As near as I can tell, the array of pixel format attributes built by enum_renderer_pixel_formats() is very similar to the one built by create_context(). The main differences are:
a) enum_renderer_pixel_formats() includes kCGLPFARendererID, renderer.renderer_id, kCGLPFASingleRenderer while create_context() doesn't b) enum_renderer_pixel_formats() includes kCGLPFANoRecovery for accelerated formats while create_context() doesn't
In both cases, I would expect that enum_renderer_pixel_formats() would be more restrictive than create_context(), meaning that create_context() should never fail. But it is.
I'm pretty sure we want to keep kCGLPFARendererID, renderer.renderer_id. enum_renderer_pixel_formats() is, after all, enumerating just those pixel formats for a specific renderer while create_context() can use any renderer.
The docs do discourage the use of kCGLPFASingleRenderer, though.
Can you try three experiments for me?
1) Remove kCGLPFASingleRenderer from the attribute array in enum_renderer_pixel_formats(). Be sure to also change the initial value of "n", too.
2) Remove the use of kCGLPFANoRecovery in enum_renderer_pixel_formats().
3) Use kCGLPFANoRecovery in create_context() when the pixel format is accelerated.
(These are separate experiments, so back out the changes for one before trying the next.)
For experiments 1 and 2, I'm wondering if the 64/16 formats cease being enumerated because enum_renderer_pixel_formats() is now failing in the same way as create_context() has been. For experiment 3, I'm wondering if create_context() now succeeds for the pixel format just as enum_renderer_pixel_formats() has been.
Thanks.
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #5 from Ken Thomases ken@codeweavers.com 2013-03-24 06:04:43 CDT --- Created attachment 44001 --> http://bugs.winehq.org/attachment.cgi?id=44001 Patch for experiment 1
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #6 from Ken Thomases ken@codeweavers.com 2013-03-24 06:05:03 CDT --- Created attachment 44002 --> http://bugs.winehq.org/attachment.cgi?id=44002 Patch for experiment 2
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #7 from Ken Thomases ken@codeweavers.com 2013-03-24 06:06:04 CDT --- Created attachment 44003 --> http://bugs.winehq.org/attachment.cgi?id=44003 Patch for experiment 3
I've attached patches for the three experiments to make it simpler.
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #8 from Per Johansson per@morth.org 2013-03-24 09:57:29 CDT --- Experiment 1: program fails to start, same as no patch. Log is identical. I only have one screen, the laptop one.
Experiment 2 and 3: program starts with white screen only. Difference being that after program exit screen is corrupted with experiment 2. Sound works and I exit by pressing escape then enter in game.
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #9 from Per Johansson per@morth.org 2013-03-24 09:57:52 CDT --- Created attachment 44005 --> http://bugs.winehq.org/attachment.cgi?id=44005 Experiment 2
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #10 from Per Johansson per@morth.org 2013-03-24 09:58:21 CDT --- Created attachment 44006 --> http://bugs.winehq.org/attachment.cgi?id=44006 Experiment 3
http://bugs.winehq.org/show_bug.cgi?id=33265
Per Johansson per@morth.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #44005|0 |1 is obsolete| |
--- Comment #11 from Per Johansson per@morth.org 2013-03-24 09:58:59 CDT --- Created attachment 44007 --> http://bugs.winehq.org/attachment.cgi?id=44007 Correct file for experiment 2
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #12 from Ken Thomases ken@codeweavers.com 2013-03-24 22:04:44 CDT --- Created attachment 44012 --> http://bugs.winehq.org/attachment.cgi?id=44012 Proposed fix
Please give this patch a try. It basically combines experiment 3 with an attempt to get D3D to pick a more sensible pixel format by changing the ordering.
(I'm not sure that using kCGLPFANoRecovery in create_context() is the right solution, as opposed to removing it from enum_renderer_pixel_formats(). I'm surprised that adding kCGLPFANoRecovery enables more pixel formats rather than fewer. I would think "can I use this pixel format with just the hardware?" would be a more restrictive question than "can I use this pixel format with hardware or a software fallback?". Ultimately, I may make enum_renderer_pixel_formats() actually make both requests and only include pixel formats which get "yes" for both.)
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #13 from Per Johansson per@morth.org 2013-03-26 13:11:37 CDT --- Patch seems to work fine. Tell me if you want the log.
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #14 from Ken Thomases ken@codeweavers.com 2013-03-27 07:02:50 CDT --- Thanks. I've submitted patches.
http://bugs.winehq.org/show_bug.cgi?id=33265
--- Comment #15 from Ken Thomases ken@codeweavers.com 2013-03-30 04:46:53 CDT --- Should be fixed by http://source.winehq.org/git/wine.git/?a=commit;h=484cf761fcd75fb14da0d6a9865b6a597b9668d0 and http://source.winehq.org/git/wine.git/?a=commit;h=81d1bfd65d45c6565bce7effaf54aa4507bcd450.
http://bugs.winehq.org/show_bug.cgi?id=33265
Per Johansson per@morth.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #16 from Per Johansson per@morth.org 2013-04-01 08:22:49 CDT --- Yes, works.
http://bugs.winehq.org/show_bug.cgi?id=33265
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #17 from Alexandre Julliard julliard@winehq.org 2013-04-12 13:46:32 CDT --- Closing bugs fixed in 1.5.28.
http://bugs.winehq.org/show_bug.cgi?id=33265
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |484cf761fcd75fb14da0d6a9865 | |b6a597b9668d0