fixed issue with: [libretro ERROR] [G3D] glewInit() failed

I looked at https://github.com/hrydgard/ppsspp/issues/12145 and used part of the logic from SDL headless -> https://github.com/hrydgard/ppsspp/blob/1ba7e0154882bded821aef1e2e83a6c3b1e609e0/headless/SDLHeadlessHost.cpp and removed the return, as the comment below mentions that glew can fail, as well as the QT code also does not check for the return value: https://github.com/hrydgard/ppsspp/blob/1c8ac05b06047d1559794094f3637b74b202c8fe/Qt/QtMain.cpp#L450
This commit is contained in:
tbocek committed 2020-05-31 11:31:48 +02:00
1 parent 288fe3adeb
commit 8162d0ff66
1 file changed
+19 -11
+19 -11
View File
@@ -16,18 +16,26 @@ bool LibretroGLContext::Init() {
}
void LibretroGLContext::CreateDrawContext() {
if (!glewInitDone) {
#if !defined(IOS) && !defined(USING_GLES2)
if (glewInit() != GLEW_OK) {
ERROR_LOG(G3D, "glewInit() failed.\n");
return;
}
#ifndef USING_GLES2
// Some core profile drivers elide certain extensions from GL_EXTENSIONS/etc.
// glewExperimental allows us to force GLEW to search for the pointers anyway.
if (gl_extensions.IsCoreContext)
glewExperimental = true;
if (GLEW_OK != glewInit()) {
printf("Failed to initialize glew!\n");
}
// Unfortunately, glew will generate an invalid enum error, ignore.
if (gl_extensions.IsCoreContext)
glGetError();
#endif
glewInitDone = true;
CheckGLExtensions();
}
draw_ = Draw::T3DCreateGLContext();
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext();
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
SetGPUBackend(GPUBackend::OPENGL);
draw_->CreatePresets();
}
void LibretroGLContext::DestroyDrawContext() {