1#ifdef BACKEND_NO_SDL
2
3#include "backend_egl.h"
4
5#include "backend/opengl/backend_opengl3.h"
6#include "graphics_threaded.h"
7
8#include <base/dbg.h>
9#include <base/log.h>
10#include <base/sphore.h>
11#include <base/str.h>
12
13#include <engine/graphics.h>
14#include <engine/shared/config.h>
15
16#include <GL/glew.h>
17
18// ------------ CCommandProcessorFragment_EGL
19
20void CCommandProcessorFragment_EGL::Cmd_Init(const SCommand_Init *pCommand)
21{
22 m_Display = pCommand->m_Display;
23 m_Context = pCommand->m_Context;
24 m_Surface = pCommand->m_Surface;
25 eglMakeCurrent(m_Display, m_Surface, m_Surface, m_Context);
26}
27
28void CCommandProcessorFragment_EGL::Cmd_Shutdown(const SCommand_Shutdown *pCommand)
29{
30 (void)pCommand;
31 eglMakeCurrent(m_Display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
32}
33
34void CCommandProcessorFragment_EGL::Cmd_Swap(const CCommandBuffer::SCommand_Swap *pCommand)
35{
36 (void)pCommand;
37 eglSwapBuffers(m_Display, m_Surface);
38}
39
40void CCommandProcessorFragment_EGL::Cmd_VSync(const CCommandBuffer::SCommand_VSync *pCommand)
41{
42 *pCommand->m_pRetOk = eglSwapInterval(m_Display, pCommand->m_VSync) == EGL_TRUE;
43}
44
45bool CCommandProcessorFragment_EGL::RunCommand(const CCommandBuffer::SCommand *pBaseCommand)
46{
47 switch(pBaseCommand->m_Cmd)
48 {
49 case CCommandProcessorFragment_GLBase::CMD_PRE_INIT:
50 case CCommandProcessorFragment_GLBase::CMD_POST_SHUTDOWN:
51 break;
52 case CCommandBuffer::CMD_SWAP:
53 Cmd_Swap(static_cast<const CCommandBuffer::SCommand_Swap *>(pBaseCommand));
54 break;
55 case CCommandBuffer::CMD_VSYNC:
56 Cmd_VSync(static_cast<const CCommandBuffer::SCommand_VSync *>(pBaseCommand));
57 break;
58 case CMD_INIT:
59 Cmd_Init(static_cast<const SCommand_Init *>(pBaseCommand));
60 break;
61 case CMD_SHUTDOWN:
62 Cmd_Shutdown(static_cast<const SCommand_Shutdown *>(pBaseCommand));
63 break;
64 default:
65 return false;
66 }
67 return true;
68}
69
70// ------------ CCommandProcessor_EGL_GL
71
72CCommandProcessor_EGL_GL::CCommandProcessor_EGL_GL(EBackendType BackendType, int GLMajor, int GLMinor, int GLPatch)
73{
74 if(BackendType == BACKEND_TYPE_OPENGL)
75 {
76 if(GLMajor < 2)
77 m_pGLBackend = new CCommandProcessorFragment_OpenGL();
78 else if(GLMajor == 2)
79 m_pGLBackend = new CCommandProcessorFragment_OpenGL2();
80 else if(GLMajor == 3 && GLMinor == 0)
81 m_pGLBackend = new CCommandProcessorFragment_OpenGL3();
82 else if((GLMajor == 3 && GLMinor == 3) || GLMajor >= 4)
83 m_pGLBackend = new CCommandProcessorFragment_OpenGL3_3();
84 else
85 m_pGLBackend = new CCommandProcessorFragment_OpenGL3_3();
86 }
87 else
88 {
89 dbg_assert_failed("Unsupported backend type for EGL: %d", (int)BackendType);
90 }
91}
92
93CCommandProcessor_EGL_GL::~CCommandProcessor_EGL_GL()
94{
95 delete m_pGLBackend;
96}
97
98void CCommandProcessor_EGL_GL::RunBuffer(CCommandBuffer *pBuffer)
99{
100 m_pGLBackend->StartCommands(pBuffer->m_CommandCount, pBuffer->m_RenderCallCount);
101
102 for(const CCommandBuffer::SCommand *pCommand = pBuffer->Head(); pCommand; pCommand = pCommand->m_pNext)
103 {
104 auto Res = m_pGLBackend->RunCommand(pCommand);
105 if(Res == ERunCommandReturnTypes::RUN_COMMAND_COMMAND_HANDLED)
106 continue;
107 else if(Res == ERunCommandReturnTypes::RUN_COMMAND_COMMAND_ERROR)
108 {
109 m_Error = m_pGLBackend->GetError();
110 HandleError();
111 return;
112 }
113 else if(Res == ERunCommandReturnTypes::RUN_COMMAND_COMMAND_WARNING)
114 {
115 m_Warning = m_pGLBackend->GetWarning();
116 HandleWarning();
117 return;
118 }
119
120 if(m_EGL.RunCommand(pCommand))
121 continue;
122
123 if(m_General.RunCommand(pCommand))
124 continue;
125
126 dbg_assert_failed("Unknown graphics command %d", pCommand->m_Cmd);
127 }
128
129 m_pGLBackend->EndCommands();
130}
131
132const SGfxErrorContainer &CCommandProcessor_EGL_GL::GetError() const
133{
134 return m_Error;
135}
136
137void CCommandProcessor_EGL_GL::ErroneousCleanup()
138{
139 m_pGLBackend->ErroneousCleanup();
140}
141
142const SGfxWarningContainer &CCommandProcessor_EGL_GL::GetWarning() const
143{
144 return m_Warning;
145}
146
147void CCommandProcessor_EGL_GL::HandleError()
148{
149 m_Error = m_pGLBackend->GetError();
150}
151
152void CCommandProcessor_EGL_GL::HandleWarning()
153{
154 m_Warning = m_pGLBackend->GetWarning();
155}
156
157// ------------ CGraphicsBackend_EGL
158
159CGraphicsBackend_EGL::CGraphicsBackend_EGL(TTranslateFunc &&TranslateFunc) :
160 CGraphicsBackend_Threaded(std::move(TranslateFunc))
161{
162}
163
164static bool BackendInitGlew(int &GlewMajor, int &GlewMinor, int &GlewPatch)
165{
166 glewExperimental = GL_TRUE;
167#ifdef CONF_GLEW_HAS_CONTEXT_INIT
168 const GLenum InitResult = glewContextInit();
169 if(InitResult != GLEW_OK)
170 {
171 log_error("gfx", "Unable to init glew (glewContextInit): %s", glewGetErrorString(InitResult));
172 return false;
173 }
174#else
175 const GLenum InitResult = glewInit();
176 // There is no GLX display when rendering headlessly through EGL, in which case glewInit
177 // has already initialized the context with glewContextInit internally.
178 if(InitResult != GLEW_OK && InitResult != GLEW_ERROR_NO_GLX_DISPLAY)
179 {
180 log_error("gfx", "Unable to init glew (glewInit): %s", glewGetErrorString(InitResult));
181 return false;
182 }
183#endif
184
185#ifdef GLEW_VERSION_4_6
186 if(GLEW_VERSION_4_6)
187 {
188 GlewMajor = 4;
189 GlewMinor = 6;
190 GlewPatch = 0;
191 return true;
192 }
193#endif
194#ifdef GLEW_VERSION_4_5
195 if(GLEW_VERSION_4_5)
196 {
197 GlewMajor = 4;
198 GlewMinor = 5;
199 GlewPatch = 0;
200 return true;
201 }
202#endif
203 if(GLEW_VERSION_4_4)
204 {
205 GlewMajor = 4;
206 GlewMinor = 4;
207 GlewPatch = 0;
208 return true;
209 }
210 if(GLEW_VERSION_4_3)
211 {
212 GlewMajor = 4;
213 GlewMinor = 3;
214 GlewPatch = 0;
215 return true;
216 }
217 if(GLEW_VERSION_4_2)
218 {
219 GlewMajor = 4;
220 GlewMinor = 2;
221 GlewPatch = 0;
222 return true;
223 }
224 if(GLEW_VERSION_4_1)
225 {
226 GlewMajor = 4;
227 GlewMinor = 1;
228 GlewPatch = 0;
229 return true;
230 }
231 if(GLEW_VERSION_4_0)
232 {
233 GlewMajor = 4;
234 GlewMinor = 0;
235 GlewPatch = 0;
236 return true;
237 }
238 if(GLEW_VERSION_3_3)
239 {
240 GlewMajor = 3;
241 GlewMinor = 3;
242 GlewPatch = 0;
243 return true;
244 }
245 if(GLEW_VERSION_3_0)
246 {
247 GlewMajor = 3;
248 GlewMinor = 0;
249 GlewPatch = 0;
250 return true;
251 }
252 if(GLEW_VERSION_2_1)
253 {
254 GlewMajor = 2;
255 GlewMinor = 1;
256 GlewPatch = 0;
257 return true;
258 }
259 if(GLEW_VERSION_2_0)
260 {
261 GlewMajor = 2;
262 GlewMinor = 0;
263 GlewPatch = 0;
264 return true;
265 }
266 if(GLEW_VERSION_1_5)
267 {
268 GlewMajor = 1;
269 GlewMinor = 5;
270 GlewPatch = 0;
271 return true;
272 }
273 if(GLEW_VERSION_1_4)
274 {
275 GlewMajor = 1;
276 GlewMinor = 4;
277 GlewPatch = 0;
278 return true;
279 }
280
281 GlewMajor = 1;
282 GlewMinor = 1;
283 GlewPatch = 0;
284 return true;
285}
286
287int CGraphicsBackend_EGL::InitOpenGL(int Width, int Height, int Flags, IStorage *pStorage)
288{
289 (void)Flags;
290
291 // Initialize EGL
292 m_Display = EGL_NO_DISPLAY;
293
294 // Prefer a surfaceless EGL display when available (works on headless systems).
295 // EGL 1.5
296#if defined(EGL_VERSION_1_5) && defined(EGL_PLATFORM_SURFACELESS_MESA)
297 m_Display = eglGetPlatformDisplay(
298 EGL_PLATFORM_SURFACELESS_MESA,
299 EGL_DEFAULT_DISPLAY,
300 nullptr);
301#endif
302
303 // EGL_EXT_platform_base
304#if defined(EGL_EXT_platform_base) && defined(EGL_PLATFORM_SURFACELESS_MESA)
305 if(m_Display == EGL_NO_DISPLAY)
306 {
307 auto pfnGetPlatformDisplay =
308 (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDisplayEXT");
309
310 if(pfnGetPlatformDisplay)
311 {
312 m_Display = pfnGetPlatformDisplay(
313 EGL_PLATFORM_SURFACELESS_MESA,
314 EGL_DEFAULT_DISPLAY,
315 nullptr);
316 }
317 }
318#endif
319
320 // Fall back to the default display.
321 if(m_Display == EGL_NO_DISPLAY)
322 m_Display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
323
324 if(m_Display == EGL_NO_DISPLAY)
325 {
326 log_error("gfx/egl", "Failed to get EGL display");
327 return -1;
328 }
329
330 EGLint Major, Minor;
331 if(!eglInitialize(m_Display, &Major, &Minor))
332 {
333 log_error("gfx/egl", "Failed to initialize EGL");
334 return -1;
335 }
336 log_info("gfx/egl", "EGL version: %d.%d", Major, Minor);
337
338 // Choose config
339 const EGLint aConfigAttribs[] = {
340 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
341 EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
342 EGL_RED_SIZE, 8,
343 EGL_GREEN_SIZE, 8,
344 EGL_BLUE_SIZE, 8,
345 EGL_ALPHA_SIZE, 8,
346 EGL_DEPTH_SIZE, 24,
347 EGL_STENCIL_SIZE, 8,
348 EGL_NONE};
349
350 EGLint NumConfigs;
351 EGLConfig Config;
352 if(!eglChooseConfig(m_Display, aConfigAttribs, &Config, 1, &NumConfigs) || NumConfigs == 0)
353 {
354 log_error("gfx/egl", "Failed to choose EGL config");
355 eglTerminate(m_Display);
356 m_Display = nullptr;
357 return -1;
358 }
359
360 // Create Pbuffer surface
361 const EGLint aSurfaceAttribs[] = {
362 EGL_WIDTH, Width,
363 EGL_HEIGHT, Height,
364 EGL_NONE};
365
366 m_Surface = eglCreatePbufferSurface(m_Display, Config, aSurfaceAttribs);
367 if(m_Surface == EGL_NO_SURFACE)
368 {
369 log_error("gfx/egl", "Failed to create EGL Pbuffer surface");
370 eglTerminate(m_Display);
371 m_Display = nullptr;
372 return -1;
373 }
374
375 // Create OpenGL context
376 eglBindAPI(EGL_OPENGL_API);
377 const EGLint aContextAttribs[] = {
378 EGL_CONTEXT_MAJOR_VERSION, g_Config.m_GfxGLMajor,
379 EGL_CONTEXT_MINOR_VERSION, g_Config.m_GfxGLMinor,
380 EGL_NONE};
381
382 m_Context = eglCreateContext(m_Display, Config, EGL_NO_CONTEXT, aContextAttribs);
383 if(m_Context == EGL_NO_CONTEXT)
384 {
385 log_error("gfx/egl", "Failed to create EGL context (trying without version)");
386 // Try without specific version
387 const EGLint aFallbackAttribs[] = {EGL_NONE};
388 m_Context = eglCreateContext(m_Display, Config, EGL_NO_CONTEXT, aFallbackAttribs);
389 if(m_Context == EGL_NO_CONTEXT)
390 {
391 log_error("gfx/egl", "Failed to create EGL context");
392 eglDestroySurface(m_Display, m_Surface);
393 eglTerminate(m_Display);
394 m_Display = nullptr;
395 m_Surface = nullptr;
396 return -1;
397 }
398 }
399
400 // Make context current on the main thread for GLEW init
401 if(!eglMakeCurrent(m_Display, m_Surface, m_Surface, m_Context))
402 {
403 log_error("gfx/egl", "Failed to make EGL context current");
404 eglDestroyContext(m_Display, m_Context);
405 eglDestroySurface(m_Display, m_Surface);
406 eglTerminate(m_Display);
407 m_Display = nullptr;
408 m_Context = nullptr;
409 m_Surface = nullptr;
410 return -1;
411 }
412
413 int GlewMajor = 0, GlewMinor = 0, GlewPatch = 0;
414 if(!BackendInitGlew(GlewMajor, GlewMinor, GlewPatch))
415 {
416 eglMakeCurrent(m_Display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
417 eglDestroyContext(m_Display, m_Context);
418 eglDestroySurface(m_Display, m_Surface);
419 eglTerminate(m_Display);
420 m_Display = nullptr;
421 m_Context = nullptr;
422 m_Surface = nullptr;
423 return -1;
424 }
425
426 // Release context from main thread so it can be picked up by render thread
427 eglMakeCurrent(m_Display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
428
429 // Create command processor
430 m_pProcessor = new CCommandProcessor_EGL_GL(BACKEND_TYPE_OPENGL, GlewMajor, GlewMinor, GlewPatch);
431 StartProcessor(m_pProcessor);
432
433 // EGL Init (makes context current in render thread)
434 {
435 CCommandProcessorFragment_EGL::SCommand_Init CmdEGL;
436 CmdEGL.m_Display = m_Display;
437 CmdEGL.m_Context = m_Context;
438 CmdEGL.m_Surface = m_Surface;
439 CCommandBuffer CmdBuffer(1024, 512);
440 CmdBuffer.AddCommandUnsafe(CmdEGL);
441 RunBuffer(&CmdBuffer);
442 WaitForIdle();
443 CmdBuffer.Reset();
444 }
445
446 // Pre-Init
447 {
448 CCommandBuffer CmdBuffer(1024, 512);
449 CCommandProcessorFragment_GLBase::SCommand_PreInit CmdPre;
450 CmdPre.m_pWindow = nullptr;
451 CmdPre.m_Width = Width;
452 CmdPre.m_Height = Height;
453 CmdPre.m_pVendorString = m_aVendorString;
454 CmdPre.m_pVersionString = m_aVersionString;
455 CmdPre.m_pRendererString = m_aRendererString;
456 CmdPre.m_pGpuList = &m_GpuList;
457 CmdBuffer.AddCommandUnsafe(CmdPre);
458 RunBufferSingleThreadedUnsafe(&CmdBuffer);
459 CmdBuffer.Reset();
460 }
461
462 const char *pErrorStr = nullptr;
463 int InitError = 0;
464 {
465 CCommandProcessorFragment_GLBase::SCommand_Init CmdGL;
466 CmdGL.m_pWindow = nullptr;
467 CmdGL.m_Width = Width;
468 CmdGL.m_Height = Height;
469 CmdGL.m_pTextureMemoryUsage = &m_TextureMemoryUsage;
470 CmdGL.m_pBufferMemoryUsage = &m_BufferMemoryUsage;
471 CmdGL.m_pStreamMemoryUsage = &m_StreamMemoryUsage;
472 CmdGL.m_pStagingMemoryUsage = &m_StagingMemoryUsage;
473 CmdGL.m_pGpuList = &m_GpuList;
474 CmdGL.m_pReadPresentedImageDataFunc = &m_ReadPresentedImageDataFunc;
475 CmdGL.m_pStorage = pStorage;
476 CmdGL.m_pCapabilities = &m_Capabilities;
477 CmdGL.m_pInitError = &InitError;
478 CmdGL.m_RequestedMajor = g_Config.m_GfxGLMajor;
479 CmdGL.m_RequestedMinor = g_Config.m_GfxGLMinor;
480 CmdGL.m_RequestedPatch = g_Config.m_GfxGLPatch;
481 CmdGL.m_GlewMajor = GlewMajor;
482 CmdGL.m_GlewMinor = GlewMinor;
483 CmdGL.m_GlewPatch = GlewPatch;
484 CmdGL.m_pErrStringPtr = &pErrorStr;
485 CmdGL.m_pVendorString = m_aVendorString;
486 CmdGL.m_pVersionString = m_aVersionString;
487 CmdGL.m_pRendererString = m_aRendererString;
488 CmdGL.m_RequestedBackend = BACKEND_TYPE_OPENGL;
489
490 CCommandBuffer CmdBuffer(1024, 512);
491 CmdBuffer.AddCommandUnsafe(CmdGL);
492 RunBuffer(&CmdBuffer);
493 WaitForIdle();
494 CmdBuffer.Reset();
495 }
496
497 if(InitError != 0)
498 {
499 CCommandBuffer CmdBuffer(1024, 512);
500 if(InitError != -2)
501 {
502 // shutdown the context, as it might have been initialized
503 CCommandProcessorFragment_GLBase::SCommand_Shutdown CmdShutdown;
504 CmdBuffer.AddCommandUnsafe(CmdShutdown);
505 RunBuffer(&CmdBuffer);
506 WaitForIdle();
507 CmdBuffer.Reset();
508 }
509 StopProcessor();
510 delete m_pProcessor;
511 m_pProcessor = nullptr;
512 return -1;
513 }
514
515 // Viewport update
516 {
517 CCommandBuffer::SCommand_Update_Viewport CmdViewport;
518 CmdViewport.m_X = 0;
519 CmdViewport.m_Y = 0;
520 CmdViewport.m_Width = Width;
521 CmdViewport.m_Height = Height;
522 CmdViewport.m_DrawableWidth = Width;
523 CmdViewport.m_DrawableHeight = Height;
524 CmdViewport.m_ByResize = true;
525 CCommandBuffer CmdBuffer(1024, 512);
526 CmdBuffer.AddCommandUnsafe(CmdViewport);
527 RunBuffer(&CmdBuffer);
528 WaitForIdle();
529 CmdBuffer.Reset();
530 }
531
532 if(pErrorStr != nullptr)
533 {
534 str_copy(m_aErrorString, pErrorStr);
535 }
536
537 return 0;
538}
539
540int CGraphicsBackend_EGL::Init(const char *pName, int *pScreen, int *pWidth, int *pHeight, int *pRefreshRate, int *pFsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight, int *pCurrentWidth, int *pCurrentHeight, IStorage *pStorage)
541{
542 (void)pName;
543 (void)pScreen;
544 (void)pRefreshRate;
545 (void)pFsaaSamples;
546 (void)pDesktopWidth;
547 (void)pDesktopHeight;
548
549 if(*pWidth <= 0 || *pHeight <= 0)
550 {
551 *pWidth = 640;
552 *pHeight = 480;
553 }
554
555 *pCurrentWidth = *pWidth;
556 *pCurrentHeight = *pHeight;
557
558 return InitOpenGL(*pWidth, *pHeight, Flags, pStorage);
559}
560
561int CGraphicsBackend_EGL::Shutdown()
562{
563 if(m_pProcessor != nullptr)
564 {
565 CCommandBuffer CmdBuffer(1024, 512);
566
567 CCommandProcessorFragment_GLBase::SCommand_Shutdown CmdGL;
568 CmdBuffer.AddCommandUnsafe(CmdGL);
569 RunBuffer(&CmdBuffer);
570 WaitForIdle();
571 CmdBuffer.Reset();
572
573 CCommandProcessorFragment_EGL::SCommand_Shutdown CmdEGL;
574 CmdBuffer.AddCommandUnsafe(CmdEGL);
575 RunBuffer(&CmdBuffer);
576 WaitForIdle();
577 CmdBuffer.Reset();
578
579 CCommandProcessorFragment_GLBase::SCommand_PostShutdown CmdPost;
580 CmdBuffer.AddCommandUnsafe(CmdPost);
581 RunBufferSingleThreadedUnsafe(&CmdBuffer);
582 CmdBuffer.Reset();
583
584 StopProcessor();
585 delete m_pProcessor;
586 m_pProcessor = nullptr;
587 }
588
589 if(m_Context != nullptr)
590 {
591 eglDestroyContext(m_Display, m_Context);
592 m_Context = nullptr;
593 }
594 if(m_Surface != nullptr)
595 {
596 eglDestroySurface(m_Display, m_Surface);
597 m_Surface = nullptr;
598 }
599 if(m_Display != nullptr)
600 {
601 eglTerminate(m_Display);
602 m_Display = nullptr;
603 }
604 return 0;
605}
606
607uint64_t CGraphicsBackend_EGL::TextureMemoryUsage() const
608{
609 return m_TextureMemoryUsage;
610}
611
612uint64_t CGraphicsBackend_EGL::BufferMemoryUsage() const
613{
614 return m_BufferMemoryUsage;
615}
616
617uint64_t CGraphicsBackend_EGL::StreamedMemoryUsage() const
618{
619 return m_StreamMemoryUsage;
620}
621
622uint64_t CGraphicsBackend_EGL::StagingMemoryUsage() const
623{
624 return m_StagingMemoryUsage;
625}
626
627const TTwGraphicsGpuList &CGraphicsBackend_EGL::GetGpus() const
628{
629 return m_GpuList;
630}
631
632void CGraphicsBackend_EGL::GetVideoModes(CVideoMode *pModes, int MaxModes, int *pNumModes, float HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int ScreenId)
633{
634 (void)pModes;
635 (void)MaxModes;
636 (void)HiDPIScale;
637 (void)MaxWindowWidth;
638 (void)MaxWindowHeight;
639 (void)ScreenId;
640 *pNumModes = 0;
641}
642
643void CGraphicsBackend_EGL::GetCurrentVideoMode(CVideoMode &CurMode, float HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int ScreenId)
644{
645 (void)HiDPIScale;
646 (void)MaxWindowWidth;
647 (void)MaxWindowHeight;
648 (void)ScreenId;
649 CurMode = CVideoMode{};
650}
651
652bool CGraphicsBackend_EGL::GetDriverVersion(EGraphicsDriverAgeType DriverAgeType, int &Major, int &Minor, int &Patch, const char *&pName, EBackendType BackendType)
653{
654 (void)DriverAgeType;
655 (void)Major;
656 (void)Minor;
657 (void)Patch;
658 (void)pName;
659 (void)BackendType;
660 return false;
661}
662
663TGLBackendReadPresentedImageData &CGraphicsBackend_EGL::GetReadPresentedImageDataFuncUnsafe()
664{
665 return m_ReadPresentedImageDataFunc;
666}
667
668std::optional<int> CGraphicsBackend_EGL::ShowMessageBox(const IGraphics::CMessageBox &MessageBox)
669{
670 log_error("gfx/egl", "Unhandled message box: %s: %s", MessageBox.m_pTitle, MessageBox.m_pMessage);
671 return std::nullopt;
672}
673
674IGraphicsBackend *CreateGraphicsBackend(TTranslateFunc &&TranslateFunc)
675{
676 return new CGraphicsBackend_EGL(std::move(TranslateFunc));
677}
678
679#endif // BACKEND_NO_SDL
680