Commit Graph

16 Commits

Author SHA1 Message Date
Ken Thomases 47708c2635 winemac: Add a new registry setting, OpenGLSurfaceMode, to control how GL surfaces relate to the window.
The default behavior is that GL surfaces are on top of all non-GL content in
the window.  This maximizes the performance for the common case of games, but
clipping by parents, siblings, and child windows isn't respected.

Setting OpenGLSurfaceMode to "behind" pushes the GL surface to be behind the
Mac window.  The window has transparent holes punched through it so that the GL
surface shows through.  USER32 and the wineserver take care of making sure the
holes are only where the GL windows would be unclipped and unoccluded.  Because
the OS X window server has to composite the GL surface with the window, this
limits the framerate.

Since the Mac driver has no server-side rendering path, GDI rendering to a
window which has a GL surface doesn't work.  As a partial workaround, mostly
for cases where a GL surface is created but never used, setting
OpenGLSurfaceMode to "transparent" allows the GDI rendering to show through the
transparent parts of the GL surface.  The GDI rendering is drawn to the
top-level window's surface as normal.  (The behavior of user32 to exclude the
portion covered by a GL window from GDI rendering is disabled.)  The GL surface
is in front of the window but potentially wholly or partially transparent.  It
is composited with the window behind it.

The GL surface is initially cleared to be completely transparent.  So, if
no GL rendering is done, the window will appear as though the GL surface didn't
exist.
2015-09-15 16:59:03 +09:00
Matteo Bruni e23f70b266 winemac: Make the implementation of clearToBlackIfNeeded compatible with core contexts. 2015-01-08 17:29:04 +01:00
Ken Thomases e21192469d winemac: Make WineOpenGLContext hold a strong reference to its view.
Its superclass, NSOpenGLContext, only holds a weak reference.  The view was
sometimes being deallocated before the context was disposed of, resulting in
crashes.
2014-01-14 11:17:40 +01:00
Ken Thomases 2963a2d4ab winemac: Don't remove an OpenGL context from its view if we're only going to re-add it.
If the context is being made current with its existing view, just update it
before making it current.
2014-01-14 11:17:38 +01:00
Ken Thomases 2cc5337940 winemac: Consolidate code paths for clearing the OpenGL context.
We clear it if the context or the view is NULL.  If the context is non-NULL,
we want to disassociate the views of both the current and passed-in contexts,
if they differ.
2014-01-14 11:17:35 +01:00
Ken Thomases d57a99b482 winemac: When setting a view for an OpenGL context and it is latent, clear any existing view. 2014-01-14 11:17:31 +01:00
Ken Thomases 1896396330 winemac: When clearing the OpenGL context, disassociate it from its view. 2014-01-14 11:17:28 +01:00
Ken Thomases f0c4354a6b winemac: Include the OpenGL headers to fix building on OS X 10.9. 2013-12-03 12:33:44 +01:00
Ken Thomases 4124478b85 winemac: Clear OpenGL views to black the first time a context is attached.
This prevents VRAM garbage from being displayed before the program draws.
2013-11-28 11:16:17 +01:00
Ken Thomases fd04552fe3 winemac: Move test for valid GL drawable into -[WineContentView addGLContext:].
Improves encapsulation.  Avoids a round trip to the main thread.
2013-11-28 11:16:12 +01:00
Ken Thomases 682ed91017 winemac: Defer attaching OpenGL context to a view which is zero-sized or outside its window's bounds.
That fails with the dread "invalid drawable" message.
2013-11-21 13:31:33 +01:00
Ken Thomases 4fba2995b6 winemac: Don't override -[NSOpenGLContext clearDrawable], just use our own method. 2013-03-28 12:19:01 +01:00
Ken Thomases 69e631e04e winemac: Add support for "query" events which wait for synchronous responses. 2013-03-11 10:53:32 +01:00
Ken Thomases 4d51a688e3 winemac: Override -[NSOpenGLContext clearDrawable] to not hide the GL surface.
This fixes a problem with flickering when repeatedly attaching and detaching
a GL context from a window, such as for each WM_PAINT.
2013-03-11 10:44:26 +01:00
Ken Thomases 89a4e5a6d1 winemac: Don't defer attaching OpenGL context to view if it is backed by a window device.
This fixes a problem with certain OpenGL programs which create a context very
briefly before destroying it, like while handling WM_PAINT.
2013-03-11 10:44:13 +01:00
Ken Thomases 3f3ee6393d winemac: Implement OpenGL support. 2013-03-06 12:56:12 +01:00