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;
63 SGfxErrorContainer m_Error;
64 SGfxWarningContainer m_Warning;
67 CCommandProcessor_EGL_GL(
EBackendType BackendType,
int GLMajor,
int GLMinor,
int GLPatch);
68 ~CCommandProcessor_EGL_GL()
override;
69 void RunBuffer(CCommandBuffer *pBuffer)
override;
71 const SGfxErrorContainer &GetError()
const override;
72 void ErroneousCleanup()
override;
73 const SGfxWarningContainer &GetWarning()
const override;
81 EGLDisplay m_Display{
nullptr};
82 EGLContext m_Context{
nullptr};
83 EGLSurface m_Surface{
nullptr};
85 ICommandProcessor *m_pProcessor{
nullptr};
86 std::atomic<uint64_t> m_TextureMemoryUsage{0};
87 std::atomic<uint64_t> m_BufferMemoryUsage{0};
88 std::atomic<uint64_t> m_StreamMemoryUsage{0};
89 std::atomic<uint64_t> m_StagingMemoryUsage{0};
94 SBackendCapabilities m_Capabilities;
97 char m_aVendorString[256]{};
98 char m_aVersionString[256]{};
99 char m_aRendererString[256]{};
100 char m_aErrorString[256]{};
102 int InitOpenGL(
int Width,
int Height,
int Flags,
class IStorage *pStorage);
106 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;
107 int Shutdown()
override;
109 uint64_t TextureMemoryUsage()
const override;
110 uint64_t BufferMemoryUsage()
const override;
111 uint64_t StreamedMemoryUsage()
const override;
112 uint64_t StagingMemoryUsage()
const override;
115 int GetNumScreens()
const override {
return 1; }
116 const char *GetScreenName(
int Screen)
const override {
return "EGL Offscreen"; }
118 void GetVideoModes(CVideoMode *pModes,
int MaxModes,
int *pNumModes,
float HiDPIScale,
int MaxWindowWidth,
int MaxWindowHeight,
int ScreenId)
override;
119 void GetCurrentVideoMode(CVideoMode &CurMode,
float HiDPIScale,
int MaxWindowWidth,
int MaxWindowHeight,
int ScreenId)
override;
121 void Minimize()
override {}
122 void SetWindowParams(
int FullscreenMode,
bool IsBorderless)
override {}
123 bool SetWindowScreen(
int Index,
bool MoveToCenter,
ivec2 *pDesktopSize)
override {
return false; }
124 bool UpdateDisplayMode(
int Index,
ivec2 *pDesktopSize)
override {
return false; }
125 int GetWindowScreen()
override {
return 0; }
126 int WindowActive()
override {
return 1; }
127 int WindowOpen()
override {
return 1; }
128 void SetWindowGrab(
bool Grab)
override {}
129 bool ResizeWindow(
int w,
int h,
int RefreshRate)
override {
return false; }
130 void GetViewportSize(
int &w,
int &h)
override
135 void GetDisplayCutoutInsets(
int &Left,
int &Right)
override
140 void NotifyWindow()
override {}
141 bool IsScreenKeyboardShown()
override {
return false; }
142 void WindowDestroyNtf(uint32_t WindowId)
override {}
143 void WindowCreateNtf(uint32_t WindowId)
override {}
146 bool IsConfigModernAPI()
override {
return true; }
148 bool HasTileBuffering()
override {
return m_Capabilities.
m_TileBuffering; }
149 bool HasQuadBuffering()
override {
return m_Capabilities.
m_QuadBuffering; }
150 bool HasTextBuffering()
override {
return m_Capabilities.
m_TextBuffering; }
155 const char *GetErrorString()
override {
return m_aErrorString[0] ? m_aErrorString :
nullptr; }
156 const char *GetVendorString()
override {
return m_aVendorString; }
157 const char *GetVersionString()
override {
return m_aVersionString; }
158 const char *GetRendererString()
override {
return m_aRendererString; }
162 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
@ BACKEND_TYPE_OPENGL
Definition graphics.h:144
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