| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <EGL/egl.h> |
| 7 |
#include <EGL/eglext.h> |
| 8 |
#include <string> |
| 9 |
#include <vector> |
| 10 |
|
| 11 |
#include "Common/GL/GLContext.h" |
| 12 |
|
| 13 |
class GLContextEGL : public GLContext |
| 14 |
{ |
| 15 |
public: |
| 16 |
virtual ~GLContextEGL() override; |
| 17 |
|
| 18 |
bool IsHeadless() const override; |
| 19 |
|
| 20 |
std::unique_ptr<GLContext> CreateSharedContext() override; |
| 21 |
|
| 22 |
bool MakeCurrent() override; |
| 23 |
bool ClearCurrent() override; |
| 24 |
|
| 25 |
void UpdateSurface(void* window_handle) override; |
| 26 |
|
| 27 |
void Swap() override; |
| 28 |
void SwapInterval(int interval) override; |
| 29 |
|
| 30 |
void* GetFuncAddress(const std::string& name) override; |
| 31 |
|
| 32 |
protected: |
| 33 |
virtual EGLDisplay OpenEGLDisplay(); |
| 34 |
virtual EGLNativeWindowType GetEGLNativeWindow(EGLConfig config); |
| 35 |
|
| 36 |
bool Initialize(const WindowSystemInfo& wsi, bool stereo, bool core) override; |
| 37 |
|
| 38 |
bool CreateWindowSurface(); |
| 39 |
void DestroyWindowSurface(); |
| 40 |
void DetectMode(); |
| 41 |
void DestroyContext(); |
| 42 |
|
| 43 |
WindowSystemInfo m_wsi = {}; |
| 44 |
|
| 45 |
EGLConfig m_config; |
| 46 |
bool m_supports_surfaceless = false; |
| 47 |
std::vector<int> m_attribs; |
| 48 |
|
| 49 |
EGLSurface m_egl_surface = EGL_NO_SURFACE; |
| 50 |
EGLContext m_egl_context = EGL_NO_CONTEXT; |
| 51 |
EGLDisplay m_egl_display = EGL_NO_DISPLAY; |
| 52 |
}; |