2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2014-02-10 18:54:46 +00:00
|
|
|
// Refer to the license.txt file included.
|
2012-12-17 21:01:52 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2012-12-17 21:01:52 +00:00
|
|
|
|
2014-03-28 00:26:52 +00:00
|
|
|
#include <EGL/egl.h>
|
2016-01-22 16:58:19 +00:00
|
|
|
#include <EGL/eglext.h>
|
2016-06-24 08:43:46 +00:00
|
|
|
#include <string>
|
2014-02-17 10:18:15 +00:00
|
|
|
|
2015-09-18 16:40:00 +00:00
|
|
|
#include "Common/GL/GLInterfaceBase.h"
|
2012-12-17 21:01:52 +00:00
|
|
|
|
|
|
|
class cInterfaceEGL : public cInterfaceBase
|
|
|
|
{
|
2016-01-10 18:28:05 +00:00
|
|
|
private:
|
2016-06-24 08:43:46 +00:00
|
|
|
EGLConfig m_config;
|
|
|
|
bool m_has_handle;
|
|
|
|
EGLNativeWindowType m_host_window;
|
|
|
|
bool m_supports_surfaceless = false;
|
2016-01-10 18:28:05 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
bool CreateWindowSurface();
|
|
|
|
void DestroyWindowSurface();
|
2016-01-10 18:28:05 +00:00
|
|
|
|
2014-08-09 14:31:27 +00:00
|
|
|
protected:
|
2016-06-24 08:43:46 +00:00
|
|
|
void DetectMode();
|
|
|
|
EGLSurface egl_surf;
|
|
|
|
EGLContext egl_ctx;
|
|
|
|
EGLDisplay egl_dpy;
|
|
|
|
|
|
|
|
virtual EGLDisplay OpenDisplay() { return eglGetDisplay(EGL_DEFAULT_DISPLAY); }
|
|
|
|
virtual EGLNativeWindowType InitializePlatform(EGLNativeWindowType host_window, EGLConfig config)
|
|
|
|
{
|
|
|
|
return (EGLNativeWindowType)EGL_DEFAULT_DISPLAY;
|
|
|
|
}
|
|
|
|
virtual void ShutdownPlatform() {}
|
2012-12-17 21:01:52 +00:00
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
void Swap() override;
|
|
|
|
void SwapInterval(int interval) override;
|
|
|
|
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;
|
2012-12-17 21:01:52 +00:00
|
|
|
};
|