Skip to content

Commit

Permalink
Merge pull request #13598 from tbocek/master
Browse files Browse the repository at this point in the history
Fix issue in #12145
  • Loading branch information
hrydgard authored Nov 27, 2020
2 parents 0328908 + b009ec8 commit 81bddf2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
30 changes: 19 additions & 11 deletions libretro/LibretroGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 1 addition & 3 deletions libretro/LibretroGraphicsContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ class LibretroHWRenderContext : public LibretroGraphicsContext {
bool Init(bool cache_context);
void SetRenderTarget() override {}
void SwapBuffers() override {
if (gstate_c.skipDrawReason) {
video_cb(NULL, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, 0);
} else {
if (!gstate_c.skipDrawReason) {
video_cb(RETRO_HW_FRAME_BUFFER_VALID, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, 0);
}
}
Expand Down

0 comments on commit 81bddf2

Please sign in to comment.