async tasks
This commit is contained in:
@@ -69,6 +69,7 @@ bool egl::Context::create(ANativeWindow* window)
|
||||
if (window)
|
||||
{
|
||||
m_surface = eglCreateWindowSurface(m_display, m_config, window, nullptr);
|
||||
ANativeWindow_acquire(window);
|
||||
m_native_window = window;
|
||||
}
|
||||
if (!eglMakeCurrent(m_display, m_surface, m_surface, m_context))
|
||||
@@ -129,3 +130,34 @@ void egl::Context::swap()
|
||||
{
|
||||
eglSwapBuffers(m_display, m_surface);
|
||||
}
|
||||
|
||||
bool egl::Context::make_current(ANativeWindow* window)
|
||||
{
|
||||
if (window == m_native_window)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (m_surface != EGL_NO_SURFACE)
|
||||
{
|
||||
eglDestroySurface(m_display, m_surface);
|
||||
m_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
if (m_native_window)
|
||||
{
|
||||
ANativeWindow_release(m_native_window);
|
||||
m_native_window = nullptr;
|
||||
}
|
||||
if (window)
|
||||
{
|
||||
m_surface = eglCreateWindowSurface(m_display, m_config, window, nullptr);
|
||||
ANativeWindow_acquire(window);
|
||||
m_native_window = window;
|
||||
if (!eglMakeCurrent(m_display, m_surface, m_surface, m_context))
|
||||
{
|
||||
Logger::Log("eglMakeCurrent failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user