예제 #1
0
        protected IGlPlatformSurfaceRenderingSession BeginDraw(EglSurface surface,
                                                               EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo info, Action onFinish = null, bool isYFlipped = false)
        {
            var restoreContext = _egl.PrimaryEglContext.MakeCurrent(surface);
            var success        = false;

            try
            {
                var egli = _egl.Display.EglInterface;
                egli.WaitClient();
                egli.WaitGL();
                egli.WaitNative(EglConsts.EGL_CORE_NATIVE_ENGINE);

                _egl.PrimaryContext.GlInterface.BindFramebuffer(GlConsts.GL_FRAMEBUFFER, 0);

                success = true;
                return(new Session(_egl.Display, _egl.PrimaryEglContext, surface, info, restoreContext, onFinish, isYFlipped));
            }
            finally
            {
                if (!success)
                {
                    restoreContext.Dispose();
                }
            }
        }
예제 #2
0
 public GlRenderTarget(
     EglPlatformOpenGlInterface egl,
     EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo info,
     EglSurface surface)
     : base(egl)
 {
     _info    = info;
     _surface = surface;
 }
예제 #3
0
 public Session(EglDisplay display, EglContext context,
                EglSurface glSurface, EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo info,
                IDisposable restoreContext, Action onFinish, bool isYFlipped)
 {
     IsYFlipped      = isYFlipped;
     _context        = context;
     _display        = display;
     _glSurface      = glSurface;
     _info           = info;
     _restoreContext = restoreContext;
     _onFinish       = onFinish;
 }
예제 #4
0
        protected IGlPlatformSurfaceRenderingSession BeginDraw(EglSurface surface,
                                                               EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo info, Action onFinish = null, bool isYFlipped = false)
        {
            var l = _context.Lock();

            try
            {
                if (IsCorrupted)
                {
                    throw new RenderTargetCorruptedException();
                }
                var restoreContext = _context.MakeCurrent(surface);
                _display.EglInterface.WaitClient();
                _display.EglInterface.WaitGL();
                _display.EglInterface.WaitNative(EglConsts.EGL_CORE_NATIVE_ENGINE);

                return(new Session(_display, _context, surface, info, l, restoreContext, onFinish, isYFlipped));
            }
            catch
            {
                l.Dispose();
                throw;
            }
        }
예제 #5
0
 public WinUiCompositedWindowSurface(WinUICompositorConnection connection, IEglWindowGlPlatformSurfaceInfo info) : base()
 {
     _connection = connection;
     _egl        = connection.Egl;
     _info       = info;
 }