mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-21 19:47:32 +01:00
EGLInterface: Create shared context with same attributes as main context
This commit is contained in:
parent
aff44684a4
commit
447aeb8f77
@ -212,14 +212,18 @@ bool cInterfaceEGL::Create(void* window_handle, bool stereo, bool core)
|
|||||||
|
|
||||||
egl_ctx = eglCreateContext(egl_dpy, m_config, EGL_NO_CONTEXT, &core_attribs[0]);
|
egl_ctx = eglCreateContext(egl_dpy, m_config, EGL_NO_CONTEXT, &core_attribs[0]);
|
||||||
if (egl_ctx)
|
if (egl_ctx)
|
||||||
|
{
|
||||||
|
m_attribs = std::move(core_attribs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!egl_ctx)
|
if (!egl_ctx)
|
||||||
{
|
{
|
||||||
m_core = false;
|
m_core = false;
|
||||||
egl_ctx = eglCreateContext(egl_dpy, m_config, EGL_NO_CONTEXT, &ctx_attribs[0]);
|
egl_ctx = eglCreateContext(egl_dpy, m_config, EGL_NO_CONTEXT, &ctx_attribs[0]);
|
||||||
|
m_attribs = std::move(ctx_attribs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!egl_ctx)
|
if (!egl_ctx)
|
||||||
@ -255,31 +259,13 @@ bool cInterfaceEGL::Create(cInterfaceBase* main_context)
|
|||||||
m_is_shared = true;
|
m_is_shared = true;
|
||||||
m_has_handle = false;
|
m_has_handle = false;
|
||||||
|
|
||||||
EGLint ctx_attribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
|
|
||||||
|
|
||||||
switch (egl_context->GetMode())
|
|
||||||
{
|
|
||||||
case GLInterfaceMode::MODE_OPENGL:
|
|
||||||
ctx_attribs[0] = EGL_NONE;
|
|
||||||
break;
|
|
||||||
case GLInterfaceMode::MODE_OPENGLES2:
|
|
||||||
ctx_attribs[1] = 2;
|
|
||||||
break;
|
|
||||||
case GLInterfaceMode::MODE_OPENGLES3:
|
|
||||||
ctx_attribs[1] = 3;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
INFO_LOG(VIDEO, "Unknown opengl mode set");
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (egl_context->GetMode() == GLInterfaceMode::MODE_OPENGL)
|
if (egl_context->GetMode() == GLInterfaceMode::MODE_OPENGL)
|
||||||
eglBindAPI(EGL_OPENGL_API);
|
eglBindAPI(EGL_OPENGL_API);
|
||||||
else
|
else
|
||||||
eglBindAPI(EGL_OPENGL_ES_API);
|
eglBindAPI(EGL_OPENGL_ES_API);
|
||||||
|
|
||||||
egl_ctx = eglCreateContext(egl_dpy, m_config, egl_context->egl_ctx, ctx_attribs);
|
egl_ctx =
|
||||||
|
eglCreateContext(egl_dpy, m_config, egl_context->egl_ctx, egl_context->m_attribs.data());
|
||||||
if (!egl_ctx)
|
if (!egl_ctx)
|
||||||
{
|
{
|
||||||
INFO_LOG(VIDEO, "Error: eglCreateContext failed 0x%04x", eglGetError());
|
INFO_LOG(VIDEO, "Error: eglCreateContext failed 0x%04x", eglGetError());
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <EGL/eglext.h>
|
#include <EGL/eglext.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "Common/GL/GLInterfaceBase.h"
|
#include "Common/GL/GLInterfaceBase.h"
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ private:
|
|||||||
bool m_has_handle;
|
bool m_has_handle;
|
||||||
EGLNativeWindowType m_host_window;
|
EGLNativeWindowType m_host_window;
|
||||||
bool m_supports_surfaceless = false;
|
bool m_supports_surfaceless = false;
|
||||||
|
std::vector<int> m_attribs;
|
||||||
|
|
||||||
bool CreateWindowSurface();
|
bool CreateWindowSurface();
|
||||||
void DestroyWindowSurface();
|
void DestroyWindowSurface();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user