ppsspp/libretro/LibretroGLContext.cpp

45 lines
1.3 KiB
C++
Raw Normal View History

2018-03-24 11:44:53 +00:00
#include "Common/Log.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
2018-03-24 11:44:53 +00:00
#include "Core/System.h"
#include "Common/GPU/OpenGL/GLFeatures.h"
2018-03-24 11:44:53 +00:00
#include "libretro/LibretroGLContext.h"
2018-03-26 16:37:34 +00:00
bool LibretroGLContext::Init() {
if (!LibretroHWRenderContext::Init(true))
2018-03-24 11:44:53 +00:00
return false;
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
return true;
}
2018-03-26 16:37:34 +00:00
void LibretroGLContext::CreateDrawContext() {
#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();
2018-03-24 11:44:53 +00:00
#endif
CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext();
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
SetGPUBackend(GPUBackend::OPENGL);
draw_->CreatePresets();
2018-03-24 11:44:53 +00:00
}
2018-03-26 16:37:34 +00:00
void LibretroGLContext::DestroyDrawContext() {
2018-03-24 11:44:53 +00:00
LibretroHWRenderContext::DestroyDrawContext();
renderManager_ = nullptr;
}