Implement shared contexts in the EGL context.

This is being implemented here first under EGL since the infrastructure is already in place for this due to the Android code requiring some bits.
The rest of the interfaces will come in a little bit.

This will be required for threaded shader compiling in the near future.
This commit is contained in:
Ryan Houdek
2016-01-21 19:03:58 -06:00
parent fdf6fb47e0
commit aed693eded
3 changed files with 102 additions and 30 deletions

View File

@ -17,7 +17,7 @@ private:
EGLNativeWindowType m_host_window;
bool m_supports_surfaceless = false;
void CreateWindowSurface();
bool CreateWindowSurface();
void DestroyWindowSurface();
protected:
@ -26,9 +26,9 @@ protected:
EGLContext egl_ctx;
EGLDisplay egl_dpy;
virtual EGLDisplay OpenDisplay() = 0;
virtual EGLNativeWindowType InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) = 0;
virtual void ShutdownPlatform() = 0;
virtual EGLDisplay OpenDisplay() { return EGL_NO_DISPLAY; }
virtual EGLNativeWindowType InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) { return (EGLNativeWindowType)EGL_DEFAULT_DISPLAY; }
virtual void ShutdownPlatform() {}
public:
void Swap() override;
@ -36,9 +36,11 @@ public:
void SetMode(GLInterfaceMode mode) override { s_opengl_mode = mode; }
void* GetFuncAddress(const std::string& name) override;
bool Create(void* window_handle, bool core) override;
bool Create(cInterfaceBase* main_context) override;
bool MakeCurrent() override;
bool ClearCurrent() override;
void Shutdown() override;
void UpdateHandle(void* window_handle) override;
void UpdateSurface() override;
std::unique_ptr<cInterfaceBase> CreateSharedContext() override;
};