From: Jonas Boesch Date: Tue, 21 Apr 2015 14:09:48 +0000 (+0200) Subject: Bugfix: Creating a second GraphicsContext forced context sharing. X-Git-Tag: v3.0.0~113^2~3^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84a210bda5e0eec8e52e0581d547789dcb5f0c7c;p=platform%2Fcore%2Fcsapi%2Fopentk.git Bugfix: Creating a second GraphicsContext forced context sharing. This fix will keep existing behavior (forced sharing) in the default case, but adds a new constructor that allows explicitly specifying the shared context. A user can now explicitly specify null for the shared context to get a new non-shared context. --- diff --git a/src/OpenTK/Graphics/GraphicsContext.cs b/src/OpenTK/Graphics/GraphicsContext.cs index da3c9f6..62613c7 100644 --- a/src/OpenTK/Graphics/GraphicsContext.cs +++ b/src/OpenTK/Graphics/GraphicsContext.cs @@ -97,6 +97,23 @@ namespace OpenTK.Graphics /// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored. /// public GraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags) + : this(mode, window, FindSharedContext(), major, minor, flags) + { + } + + /// + /// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window. + /// + /// The OpenTK.Graphics.GraphicsMode of the GraphicsContext. + /// The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to. + /// The GraphicsContext to share resources with, or null for explicit non-sharing. + /// The major version of the new GraphicsContext. + /// The minor version of the new GraphicsContext. + /// The GraphicsContextFlags for the GraphicsContext. + /// + /// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored. + /// + public GraphicsContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, int major, int minor, GraphicsContextFlags flags) { lock (SyncRoot) { @@ -133,8 +150,6 @@ namespace OpenTK.Graphics Debug.Print("GraphicsContextFlags: {0}", flags); Debug.Print("Requested version: {0}.{1}", major, minor); - IGraphicsContext shareContext = FindSharedContext(); - // Todo: Add a DummyFactory implementing IPlatformFactory. if (designMode) {