2018-01-20 20:47:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-10-04 21:24:14 +00:00
|
|
|
#include "Common/GPU/OpenGL/GLRenderManager.h"
|
2018-01-20 20:47:16 +00:00
|
|
|
#include "AndroidGraphicsContext.h"
|
|
|
|
#include "Common/GL/GLInterfaceBase.h"
|
|
|
|
|
|
|
|
class AndroidEGLGraphicsContext : public AndroidGraphicsContext {
|
|
|
|
public:
|
|
|
|
AndroidEGLGraphicsContext() : draw_(nullptr), wnd_(nullptr), gl(nullptr) {}
|
2018-01-20 19:29:18 +00:00
|
|
|
bool InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) override;
|
2018-06-18 04:56:18 +00:00
|
|
|
void ShutdownFromRenderThread() override;
|
2018-01-20 20:47:16 +00:00
|
|
|
void Shutdown() override;
|
|
|
|
void SwapBuffers() override;
|
|
|
|
void SwapInterval(int interval) override {}
|
|
|
|
void Resize() override {}
|
|
|
|
Draw::DrawContext *GetDrawContext() override {
|
|
|
|
return draw_;
|
|
|
|
}
|
2018-02-07 12:11:43 +00:00
|
|
|
bool Initialized() override {
|
|
|
|
return draw_ != nullptr;
|
|
|
|
}
|
2018-01-20 20:47:16 +00:00
|
|
|
|
2018-06-18 04:56:18 +00:00
|
|
|
void ThreadStart() override {
|
2018-12-23 20:46:48 +00:00
|
|
|
renderManager_->ThreadStart(draw_);
|
2018-06-18 04:56:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadFrame() override {
|
|
|
|
return renderManager_->ThreadFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ThreadEnd() override {
|
|
|
|
renderManager_->ThreadEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void StopThread() override {
|
|
|
|
renderManager_->WaitUntilQueueIdle();
|
|
|
|
renderManager_->StopThread();
|
|
|
|
}
|
|
|
|
|
2018-01-20 20:47:16 +00:00
|
|
|
private:
|
|
|
|
Draw::DrawContext *draw_;
|
|
|
|
ANativeWindow *wnd_;
|
|
|
|
cInterfaceBase *gl;
|
2018-06-18 04:56:18 +00:00
|
|
|
GLRenderManager *renderManager_ = nullptr;
|
2018-01-20 20:47:16 +00:00
|
|
|
};
|