ppsspp/android/jni/AndroidJavaGLContext.cpp
Henrik Rydgård dd0409d68c OpenGL ES: Crash as early as possible if things are bad
There's a huge variety of crash report in the Play Console of various
opengl failures. Try to concentrate them to early points in
initialization
2022-11-08 10:43:38 +01:00

40 lines
1.3 KiB
C++

#include "AndroidJavaGLContext.h"
#include "Common/System/Display.h"
#include "Common/GPU/OpenGL/GLFeatures.h"
#include "Common/Log.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
#include "Core/System.h"
AndroidJavaEGLGraphicsContext::AndroidJavaEGLGraphicsContext() {
SetGPUBackend(GPUBackend::OPENGL);
}
bool AndroidJavaEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) {
INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::InitFromRenderThread");
CheckGLExtensions();
// OpenGL handles rotated rendering in the driver.
g_display_rotation = DisplayRotation::ROTATE_0;
g_display_rot_matrix.setIdentity();
draw_ = Draw::T3DCreateGLContext(); // Can't fail
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
if (!draw_->CreatePresets()) {
_assert_msg_(false, "Failed to compile preset shaders");
return false;
}
return true;
}
void AndroidJavaEGLGraphicsContext::ShutdownFromRenderThread() {
INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::Shutdown");
renderManager_->WaitUntilQueueIdle();
renderManager_ = nullptr; // owned by draw_.
delete draw_;
draw_ = nullptr;
}
void AndroidJavaEGLGraphicsContext::Shutdown() {
}