Files
ppsspp/Common/GPU/OpenGL/OpenGLGraphicsContext.cpp
T

42 lines
1.4 KiB
C++

#include "OpenGLGraphicsContext.h"
#include "Common/System/Display.h"
#include "Common/GPU/OpenGL/GLFeatures.h"
#include "Common/Log.h"
#include "Core/ConfigValues.h"
#include "Core/System.h"
#include "Core/Config.h"
OpenGLGraphicsContext::OpenGLGraphicsContext() {
SetGPUBackend(GPUBackend::OPENGL);
// OpenGL handles rotated rendering in the driver.
g_display.rotation = DisplayRotation::ROTATE_0;
g_display.rot_matrix.setIdentity();
}
bool OpenGLGraphicsContext::InitSurface(WindowSystem winsys, void *data1, void *data2, std::string *errorMessage) {
INFO_LOG(Log::G3D, "OpenGLGraphicsContext::InitSurface");
if (!CheckGLExtensions()) {
*errorMessage = "CheckExtensions failed";
ERROR_LOG(Log::G3D, "CheckGLExtensions failed - not gonna attempt starting up.");
return false;
}
draw_ = Draw::T3DCreateGLContext(false); // Can't fail
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
if (!draw_->CreatePresets()) {
// This can't really happen now that compilation is async - they're only really queued for compile here.
_assert_msg_(false, "Failed to compile preset shaders");
return false;
}
return true;
}
void OpenGLGraphicsContext::ShutdownSurface() {
INFO_LOG(Log::G3D, "OpenGLGraphicsContext::Shutdown");
renderManager_ = nullptr; // owned by draw_.
delete draw_;
draw_ = nullptr;
}