mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Fix EGL initialization in applications that don't implment VidExt
This commit is contained in:
parent
7861d14060
commit
d6ad676436
|
@ -50,7 +50,7 @@ DisplayWindow & DisplayWindow::get()
|
|||
|
||||
void DisplayWindowMupen64plus::_setAttributes()
|
||||
{
|
||||
LOG(LOG_VERBOSE, "[gles2GlideN64]: _setAttributes");
|
||||
LOG(LOG_VERBOSE, "_setAttributes");
|
||||
|
||||
FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_PROFILE_MASK, M64P_GL_CONTEXT_PROFILE_CORE);
|
||||
FunctionWrapper::CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
|
@ -77,6 +77,21 @@ bool DisplayWindowMupen64plus::_start()
|
|||
{
|
||||
FunctionWrapper::setThreadedMode(config.video.threadedVideo);
|
||||
|
||||
#ifdef EGL
|
||||
// Normally this is initialized externally through VidExt, but if VidExt is not implemented,
|
||||
// do this here anyways. Calling eglInitialize has no negative effect according to the spec
|
||||
|
||||
EGLDisplay display;
|
||||
if ((display = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY) {
|
||||
LOG(LOG_ERROR, "eglGetDisplay() returned error %d", eglGetError());
|
||||
return false;
|
||||
}
|
||||
if (!eglInitialize(display, nullptr, nullptr)) {
|
||||
LOG(LOG_ERROR, "eglInitialize() returned error %d", eglGetError());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
FunctionWrapper::CoreVideo_Init();
|
||||
_setAttributes();
|
||||
|
||||
|
@ -90,11 +105,11 @@ bool DisplayWindowMupen64plus::_start()
|
|||
const m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING;
|
||||
if (FunctionWrapper::CoreVideo_SetVideoMode(m_screenWidth, m_screenHeight, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags) != M64ERR_SUCCESS) {
|
||||
//printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight);
|
||||
LOG(LOG_ERROR, "[gles2GlideN64]: Error setting videomode %dx%d", m_screenWidth, m_screenHeight);
|
||||
LOG(LOG_ERROR, "Error setting videomode %dx%d", m_screenWidth, m_screenHeight);
|
||||
FunctionWrapper::CoreVideo_Quit();
|
||||
return false;
|
||||
}
|
||||
LOG(LOG_VERBOSE, "[gles2GlideN64]: Create setting videomode %dx%d", m_screenWidth, m_screenHeight);
|
||||
LOG(LOG_VERBOSE, "Create setting videomode %dx%d", m_screenWidth, m_screenHeight);
|
||||
|
||||
char caption[128];
|
||||
# ifdef _DEBUG
|
||||
|
|
|
@ -27,6 +27,10 @@ bool Utils::isExtensionSupported(const opengl::GLInfo & _glinfo, const char *ext
|
|||
return false;
|
||||
|
||||
const GLubyte *extensions = glGetString(GL_EXTENSIONS);
|
||||
if (extensions == nullptr) {
|
||||
LOG(LOG_WARNING, "Could not query GL extensions on this device");
|
||||
return false;
|
||||
}
|
||||
|
||||
const GLubyte *start = extensions;
|
||||
for (;;) {
|
||||
|
@ -52,6 +56,10 @@ bool Utils::isEGLExtensionSupported(const char * extension)
|
|||
return false;
|
||||
|
||||
const char* extensions = eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS);
|
||||
if (extensions == nullptr) {
|
||||
LOG(LOG_WARNING, "Could not query EGL extensions on this device");
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* start = extensions;
|
||||
for (;;) {
|
||||
|
@ -72,7 +80,6 @@ bool Utils::isEGLExtensionSupported(const char * extension)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
const char* GLErrorString(GLenum errorCode)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user