示例#1
0
        public void Dispose()
        {
            try
            {
                if (needUnbindContext)
                {
                    GL.Flush();

#if SILICONSTUDIO_PLATFORM_ANDROID
                    // On Android, the graphics context was just dummy so unbind the actual one.
                    // Best would be integration within OpenTK but since everything is internal and closed source,
                    // couldn't find a way around that
                    if (androidDeviceCreationContext != null)
                    {
                        androidDeviceCreationContext.MakeCurrent(null);
                    }
#endif

                    // Restore graphics context
                    GraphicsDevice.UnbindGraphicsContext(deviceCreationContext);
                }
            }
            finally
            {
                // Unlock
                if (asyncCreationLockTaken)
                {
#if SILICONSTUDIO_PLATFORM_ANDROID
                    if (tegraWorkaround)
                    {
                        // Notify GraphicsDevice.ExecutePendingTasks() that we are done.
                        Monitor.Pulse(asyncCreationLockObject);
                    }
#endif
                    Monitor.Exit(asyncCreationLockObject);
                }
            }
        }