2018-01-20 20:47:16 +00:00
|
|
|
#include "AndroidJavaGLContext.h"
|
2020-10-04 08:10:55 +00:00
|
|
|
#include "Common/System/Display.h"
|
2020-10-04 21:24:14 +00:00
|
|
|
#include "Common/GPU/OpenGL/GLFeatures.h"
|
2020-07-28 17:06:29 +00:00
|
|
|
#include "Common/Log.h"
|
2022-01-30 23:49:02 +00:00
|
|
|
#include "Core/Config.h"
|
2018-06-17 01:42:31 +00:00
|
|
|
#include "Core/ConfigValues.h"
|
2018-01-20 20:47:16 +00:00
|
|
|
#include "Core/System.h"
|
|
|
|
|
|
|
|
AndroidJavaEGLGraphicsContext::AndroidJavaEGLGraphicsContext() {
|
2018-01-20 19:29:18 +00:00
|
|
|
SetGPUBackend(GPUBackend::OPENGL);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AndroidJavaEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) {
|
2020-08-15 10:03:39 +00:00
|
|
|
INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::InitFromRenderThread");
|
2018-01-20 20:47:16 +00:00
|
|
|
CheckGLExtensions();
|
2019-06-24 08:30:32 +00:00
|
|
|
// OpenGL handles rotated rendering in the driver.
|
|
|
|
g_display_rotation = DisplayRotation::ROTATE_0;
|
|
|
|
g_display_rot_matrix.setIdentity();
|
2020-07-28 17:06:29 +00:00
|
|
|
draw_ = Draw::T3DCreateGLContext(); // Can't fail
|
2018-01-20 19:29:18 +00:00
|
|
|
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
2020-03-03 03:21:15 +00:00
|
|
|
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
|
2020-07-28 17:06:29 +00:00
|
|
|
draw_->CreatePresets();
|
|
|
|
return true;
|
2018-01-20 20:47:16 +00:00
|
|
|
}
|
|
|
|
|
2018-01-20 19:29:18 +00:00
|
|
|
void AndroidJavaEGLGraphicsContext::ShutdownFromRenderThread() {
|
2020-08-15 10:03:39 +00:00
|
|
|
INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::Shutdown");
|
2018-02-07 12:11:43 +00:00
|
|
|
renderManager_->WaitUntilQueueIdle();
|
2018-01-20 19:29:18 +00:00
|
|
|
renderManager_ = nullptr; // owned by draw_.
|
2018-01-20 20:47:16 +00:00
|
|
|
delete draw_;
|
|
|
|
draw_ = nullptr;
|
2018-01-20 19:29:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AndroidJavaEGLGraphicsContext::Shutdown() {
|
2018-01-20 20:47:16 +00:00
|
|
|
}
|