ppsspp/libretro/LibretroGLCoreContext.cpp

40 lines
1.0 KiB
C++
Raw Permalink Normal View History

2021-03-03 04:57:25 +00:00
#include "ppsspp_config.h"
2020-09-27 13:24:17 +00:00
#include "Common/Log.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
#include "Core/System.h"
#include "Common/GPU/OpenGL/GLFeatures.h"
2020-09-27 13:24:17 +00:00
#include "libretro/LibretroGLCoreContext.h"
bool LibretroGLCoreContext::Init() {
2024-05-28 05:07:20 +00:00
if (!LibretroHWRenderContext::Init(false))
2020-09-27 13:24:17 +00:00
return false;
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
return true;
}
void LibretroGLCoreContext::CreateDrawContext() {
if (!glewInitDone) {
2021-03-03 04:57:25 +00:00
#if !PPSSPP_PLATFORM(IOS) && !defined(USING_GLES2)
2020-09-27 13:24:17 +00:00
if (glewInit() != GLEW_OK) {
ERROR_LOG(Log::G3D, "glewInit() failed.\n");
2020-09-27 13:24:17 +00:00
return;
}
#endif
glewInitDone = true;
CheckGLExtensions();
}
draw_ = Draw::T3DCreateGLContext(false);
2020-09-27 13:24:17 +00:00
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
SetGPUBackend(GPUBackend::OPENGL);
draw_->CreatePresets();
2020-09-27 13:24:17 +00:00
}
void LibretroGLCoreContext::DestroyDrawContext() {
LibretroHWRenderContext::DestroyDrawContext();
renderManager_ = nullptr;
}