1#ifndef ENGINE_CLIENT_BACKEND_EGL_H
2#define ENGINE_CLIENT_BACKEND_EGL_H
12#include <EGL/eglext.h>
17class CCommandProcessorFragment_EGL
19 EGLDisplay m_Display =
nullptr;
20 EGLContext m_Context =
nullptr;
21 EGLSurface m_Surface =
nullptr;
30 struct SCommand_Init :
public CCommandBuffer::SCommand
39 struct SCommand_Shutdown :
public CCommandBuffer::SCommand
42 SCommand(CMD_SHUTDOWN) {}
45 CCommandProcessorFragment_EGL() =
default;
47 bool RunCommand(
const CCommandBuffer::SCommand *pBaseCommand);
50 void Cmd_Init(
const SCommand_Init *pCommand);
51 void Cmd_Shutdown(
const SCommand_Shutdown *pCommand);
52 void Cmd_Swap(
const CCommandBuffer::SCommand_Swap *pCommand);
53 void Cmd_VSync(
const CCommandBuffer::SCommand_VSync *pCommand);
58 CCommandProcessorFragment_GLBase *m_pGLBackend;
59 CCommandProcessorFragment_EGL m_EGL;
60 CCommandProcessorFragment_General m_General;
62 SGfxErrorContainer m_Error;
63 SGfxWarningContainer m_Warning;
66 CCommandProcessor_EGL_GL(
EBackendType BackendType,
int GLMajor,
int GLMinor,
int GLPatch);
67 ~CCommandProcessor_EGL_GL()
override;
68 void RunBuffer(CCommandBuffer *pBuffer)
override;
70 const SGfxErrorContainer &GetError()
const override;
71 void ErroneousCleanup()
override;
72 const SGfxWarningContainer &GetWarning()
const override;
80 EGLDisplay m_Display{
nullptr};
81 EGLContext m_Context{
nullptr};
82 EGLSurface m_Surface{
nullptr};
84 ICommandProcessor *m_pProcessor{
nullptr};
85 std::atomic<uint64_t> m_TextureMemoryUsage{0};
86 std::atomic<uint64_t> m_BufferMemoryUsage{0};
87 std::atomic<uint64_t> m_StreamMemoryUsage{0};
88 std::atomic<uint64_t> m_StagingMemoryUsage{0};
93 SBackendCapabilities m_Capabilities;
95 char m_aVendorString[256]{};
96 char m_aVersionString[256]{};
97 char m_aRendererString[256]{};
98 char m_aErrorString[256]{};
100 int InitOpenGL(
int Width,
int Height,
int Flags,
class IStorage *pStorage);
104 int Init(
const char *pName,
int *pScreen,
int *pWidth,
int *pHeight,
int *pRefreshRate,
int *pFsaaSamples,
int Flags,
int *pDesktopWidth,
int *pDesktopHeight,
int *pCurrentWidth,
int *pCurrentHeight,
class IStorage *pStorage)
override;
105 int Shutdown()
override;
107 uint64_t TextureMemoryUsage()
const override;
108 uint64_t BufferMemoryUsage()
const override;
109 uint64_t StreamedMemoryUsage()
const override;
110 uint64_t StagingMemoryUsage()
const override;
113 int GetNumScreens()
const override {
return 1; }
114 const char *GetScreenName(
int Screen)
const override {
return "EGL Offscreen"; }
116 void GetVideoModes(CVideoMode *pModes,
int MaxModes,
int *pNumModes,
float HiDPIScale,
int MaxWindowWidth,
int MaxWindowHeight,
int ScreenId)
override;
117 void GetCurrentVideoMode(CVideoMode &CurMode,
float HiDPIScale,
int MaxWindowWidth,
int MaxWindowHeight,
int ScreenId)
override;
119 void Minimize()
override {}
120 void SetWindowParams(
int FullscreenMode,
bool IsBorderless)
override {}
121 bool SetWindowScreen(
int Index,
bool MoveToCenter,
ivec2 *pDesktopSize)
override {
return false; }
122 bool UpdateDisplayMode(
int Index,
ivec2 *pDesktopSize)
override {
return false; }
123 int GetWindowScreen()
override {
return 0; }
124 int WindowActive()
override {
return 1; }
125 int WindowOpen()
override {
return 1; }
126 void SetWindowGrab(
bool Grab)
override {}
127 bool ResizeWindow(
int w,
int h,
int RefreshRate)
override {
return false; }
128 void GetViewportSize(
int &w,
int &h)
override
133 void GetDisplayCutoutInsets(
int &Left,
int &Right)
override
138 void NotifyWindow()
override {}
139 bool IsScreenKeyboardShown()
override {
return false; }
140 void WindowDestroyNtf(uint32_t WindowId)
override {}
141 void WindowCreateNtf(uint32_t WindowId)
override {}
144 bool IsConfigModernAPI()
override {
return true; }
146 bool HasTileBuffering()
override {
return m_Capabilities.
m_TileBuffering; }
147 bool HasQuadBuffering()
override {
return m_Capabilities.
m_QuadBuffering; }
148 bool HasTextBuffering()
override {
return m_Capabilities.
m_TextBuffering; }
153 const char *GetErrorString()
override {
return m_aErrorString[0] ? m_aErrorString :
nullptr; }
154 const char *GetVendorString()
override {
return m_aVendorString; }
155 const char *GetVersionString()
override {
return m_aVersionString; }
156 const char *GetRendererString()
override {
return m_aRendererString; }
160 std::optional<int> ShowMessageBox(
const IGraphics::CMessageBox &MessageBox)
override;
@ CMDGROUP_PLATFORM_SDL
Definition graphics_threaded.h:113
Definition backend_sdl.h:61
Definition backend_sdl.h:52
EBackendType
Definition graphics.h:143
EGraphicsDriverAgeType
Definition graphics.h:134
std::function< bool(uint32_t &Width, uint32_t &Height, CImageInfo::EImageFormat &Format, std::vector< uint8_t > &vDstData)> TGLBackendReadPresentedImageData
Definition graphics.h:181
STWGraphicGpu TTwGraphicsGpuList
Definition graphics.h:176
std::function< const char *(const char *, const char *)> TTranslateFunc
Definition graphics_threaded.h:1278
bool m_3DTextures
Definition backend_sdl.h:126
bool m_QuadBuffering
Definition backend_sdl.h:120
bool m_QuadContainerBuffering
Definition backend_sdl.h:122
bool m_TileBuffering
Definition backend_sdl.h:119
bool m_TrianglesAsQuads
Definition backend_sdl.h:132
bool m_2DArrayTextures
Definition backend_sdl.h:127
bool m_TextBuffering
Definition backend_sdl.h:121
vector2_base< int > ivec2
Definition vmath.h:170