mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] egl: move context init to lock function
This commit is contained in:
parent
01bfd2e090
commit
756b57400b
@ -300,20 +300,6 @@ bool egl_on_mouse_event(void * opaque, const bool visible, const int x, const in
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void egl_lock(void * opaque)
|
|
||||||
{
|
|
||||||
struct Inst * this = (struct Inst *)opaque;
|
|
||||||
LG_LOCK(this->lock);
|
|
||||||
eglMakeCurrent(this->display, this->surface, this->surface, this->frameContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
void egl_unlock(void * opaque)
|
|
||||||
{
|
|
||||||
struct Inst * this = (struct Inst *)opaque;
|
|
||||||
eglMakeCurrent(this->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
||||||
LG_UNLOCK(this->lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool egl_on_frame_event(void * opaque, const LG_RendererFormat format, const FrameBuffer * frame)
|
bool egl_on_frame_event(void * opaque, const LG_RendererFormat format, const FrameBuffer * frame)
|
||||||
{
|
{
|
||||||
struct Inst * this = (struct Inst *)opaque;
|
struct Inst * this = (struct Inst *)opaque;
|
||||||
@ -329,20 +315,6 @@ bool egl_on_frame_event(void * opaque, const LG_RendererFormat format, const Fra
|
|||||||
|
|
||||||
this->useNearest = this->width < format.width || this->height < format.height;
|
this->useNearest = this->width < format.width || this->height < format.height;
|
||||||
|
|
||||||
if (!this->frameContext)
|
|
||||||
{
|
|
||||||
static EGLint attrs[] = {
|
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
|
||||||
EGL_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!(this->frameContext = eglCreateContext(this->display, this->configs, this->context, attrs)))
|
|
||||||
{
|
|
||||||
DEBUG_ERROR("Failed to create the frame context");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!egl_desktop_update(this->desktop, sourceChanged, format, frame))
|
if (!egl_desktop_update(this->desktop, sourceChanged, format, frame))
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Failed to to update the desktop");
|
DEBUG_INFO("Failed to to update the desktop");
|
||||||
@ -534,6 +506,32 @@ bool egl_render_startup(void * opaque, SDL_Window * window)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void egl_lock(void * opaque)
|
||||||
|
{
|
||||||
|
struct Inst * this = (struct Inst *)opaque;
|
||||||
|
|
||||||
|
if (!this->frameContext)
|
||||||
|
{
|
||||||
|
static EGLint attrs[] = {
|
||||||
|
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||||
|
EGL_NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!(this->frameContext = eglCreateContext(this->display, this->configs, this->context, attrs)))
|
||||||
|
DEBUG_ERROR("Failed to create the frame context");
|
||||||
|
}
|
||||||
|
|
||||||
|
LG_LOCK(this->lock);
|
||||||
|
eglMakeCurrent(this->display, this->surface, this->surface, this->frameContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
void egl_unlock(void * opaque)
|
||||||
|
{
|
||||||
|
struct Inst * this = (struct Inst *)opaque;
|
||||||
|
eglMakeCurrent(this->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
LG_UNLOCK(this->lock);
|
||||||
|
}
|
||||||
|
|
||||||
bool egl_render_begin(void * opaque, SDL_Window * window)
|
bool egl_render_begin(void * opaque, SDL_Window * window)
|
||||||
{
|
{
|
||||||
struct Inst * this = (struct Inst *)opaque;
|
struct Inst * this = (struct Inst *)opaque;
|
||||||
|
Loading…
Reference in New Issue
Block a user