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