2018-01-20 21:47:16 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <android/native_window_jni.h>
|
|
|
|
|
|
2020-10-04 23:24:14 +02:00
|
|
|
#include "Common/GPU/thin3d.h"
|
2018-01-20 21:47:16 +01:00
|
|
|
#include "Common/GraphicsContext.h"
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
ANDROID_VERSION_GINGERBREAD = 9,
|
|
|
|
|
ANDROID_VERSION_ICS = 14,
|
|
|
|
|
ANDROID_VERSION_JELLYBEAN = 16,
|
|
|
|
|
ANDROID_VERSION_KITKAT = 19,
|
|
|
|
|
ANDROID_VERSION_LOLLIPOP = 21,
|
|
|
|
|
ANDROID_VERSION_MARSHMALLOW = 23,
|
|
|
|
|
ANDROID_VERSION_NOUGAT = 24,
|
|
|
|
|
ANDROID_VERSION_NOUGAT_1 = 25,
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-22 23:07:30 +01:00
|
|
|
enum class GraphicsContextState {
|
|
|
|
|
PENDING,
|
|
|
|
|
INITIALIZED,
|
|
|
|
|
FAILED_INIT,
|
|
|
|
|
SHUTDOWN,
|
|
|
|
|
};
|
|
|
|
|
|
2018-01-20 21:47:16 +01:00
|
|
|
class AndroidGraphicsContext : public GraphicsContext {
|
|
|
|
|
public:
|
2018-01-20 20:29:18 +01:00
|
|
|
// This is different than the base class function since on
|
|
|
|
|
// Android (EGL, Vulkan) we do have all this info on the render thread.
|
2018-01-28 17:27:23 +01:00
|
|
|
virtual bool InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) = 0;
|
2018-10-06 13:24:50 +02:00
|
|
|
virtual void BeginAndroidShutdown() {}
|
2022-12-22 23:07:30 +01:00
|
|
|
virtual GraphicsContextState GetState() const { return state_; }
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
GraphicsContextState state_ = GraphicsContextState::PENDING;
|
2018-04-14 11:25:15 -07:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
using GraphicsContext::InitFromRenderThread;
|
2018-01-20 21:47:16 +01:00
|
|
|
};
|