CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/libretro/LibretroGLContext.cpp
Views: 1401
1
2
#include "Common/Log.h"
3
#include "Core/Config.h"
4
#include "Core/ConfigValues.h"
5
#include "Core/System.h"
6
#include "Common/GPU/OpenGL/GLFeatures.h"
7
8
#include "libretro/LibretroGLContext.h"
9
10
bool LibretroGLContext::Init() {
11
if (!LibretroHWRenderContext::Init(false))
12
return false;
13
14
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
15
return true;
16
}
17
18
void LibretroGLContext::CreateDrawContext() {
19
20
#ifndef USING_GLES2
21
// Some core profile drivers elide certain extensions from GL_EXTENSIONS/etc.
22
// glewExperimental allows us to force GLEW to search for the pointers anyway.
23
if (gl_extensions.IsCoreContext)
24
glewExperimental = true;
25
if (GLEW_OK != glewInit()) {
26
printf("Failed to initialize glew!\n");
27
}
28
// Unfortunately, glew will generate an invalid enum error, ignore.
29
if (gl_extensions.IsCoreContext)
30
glGetError();
31
#endif
32
33
CheckGLExtensions();
34
draw_ = Draw::T3DCreateGLContext(false);
35
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
36
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
37
SetGPUBackend(GPUBackend::OPENGL);
38
draw_->CreatePresets();
39
}
40
41
void LibretroGLContext::DestroyDrawContext() {
42
LibretroHWRenderContext::DestroyDrawContext();
43
renderManager_ = nullptr;
44
}
45
46