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"
|
2020-10-04 21:24:14 +00:00
|
|
|
#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) {
|
2024-07-14 12:42:59 +00:00
|
|
|
ERROR_LOG(Log::G3D, "glewInit() failed.\n");
|
2020-09-27 13:24:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
glewInitDone = true;
|
|
|
|
CheckGLExtensions();
|
|
|
|
}
|
2023-08-13 11:33:38 +00:00
|
|
|
draw_ = Draw::T3DCreateGLContext(false);
|
2020-09-27 13:24:17 +00:00
|
|
|
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
2021-09-11 18:05:34 +00:00
|
|
|
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;
|
|
|
|
}
|