2018-03-24 12:44:53 +01:00
|
|
|
|
|
|
|
#include "Common/Log.h"
|
|
|
|
#include "Core/Config.h"
|
2018-06-16 18:42:31 -07:00
|
|
|
#include "Core/ConfigValues.h"
|
2018-03-24 12:44:53 +01:00
|
|
|
#include "Core/System.h"
|
|
|
|
#include "gfx_es2/gpu_features.h"
|
|
|
|
|
|
|
|
#include "libretro/LibretroGLContext.h"
|
|
|
|
|
2018-03-26 17:37:34 +01:00
|
|
|
bool LibretroGLContext::Init() {
|
2018-03-26 17:21:11 +01:00
|
|
|
if (!LibretroHWRenderContext::Init(true))
|
2018-03-24 12:44:53 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-03-26 17:37:34 +01:00
|
|
|
void LibretroGLContext::CreateDrawContext() {
|
|
|
|
if (!glewInitDone) {
|
2018-03-24 12:44:53 +01:00
|
|
|
#if !defined(IOS) && !defined(USING_GLES2)
|
2018-03-26 17:37:34 +01:00
|
|
|
if (glewInit() != GLEW_OK) {
|
2018-03-24 12:44:53 +01:00
|
|
|
ERROR_LOG(G3D, "glewInit() failed.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
glewInitDone = true;
|
|
|
|
CheckGLExtensions();
|
|
|
|
}
|
|
|
|
draw_ = Draw::T3DCreateGLContext();
|
|
|
|
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
|
|
|
}
|
2018-03-26 17:21:11 +01:00
|
|
|
|
2018-03-26 17:37:34 +01:00
|
|
|
void LibretroGLContext::DestroyDrawContext() {
|
2018-03-24 12:44:53 +01:00
|
|
|
LibretroHWRenderContext::DestroyDrawContext();
|
|
|
|
renderManager_ = nullptr;
|
|
|
|
}
|