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>
|
2017-07-27 01:57:32 +00:00
|
|
|
#include <vector>
|
2014-02-17 10:18:15 +00:00
|
|
|
|
2018-10-03 13:02:45 +00:00
|
|
|
#include "Common/GL/GLContext.h"
|
2012-12-17 21:01:52 +00:00
|
|
|
|
2018-10-03 13:02:45 +00:00
|
|
|
class GLContextEGL : public GLContext
|
2012-12-17 21:01:52 +00:00
|
|
|
{
|
2018-10-03 13:02:45 +00:00
|
|
|
public:
|
2018-10-03 13:03:33 +00:00
|
|
|
virtual ~GLContextEGL() override;
|
2016-01-10 18:28:05 +00:00
|
|
|
|
2018-10-03 13:02:45 +00:00
|
|
|
bool IsHeadless() const override;
|
2016-01-10 18:28:05 +00:00
|
|
|
|
2018-10-03 13:02:45 +00:00
|
|
|
std::unique_ptr<GLContext> CreateSharedContext() override;
|
|
|
|
|
|
|
|
bool MakeCurrent() override;
|
|
|
|
bool ClearCurrent() override;
|
|
|
|
|
|
|
|
void UpdateSurface(void* window_handle) override;
|
2018-04-12 12:18:04 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void Swap() override;
|
|
|
|
void SwapInterval(int interval) override;
|
2018-10-03 13:02:45 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void* GetFuncAddress(const std::string& name) override;
|
2018-10-03 13:02:45 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual EGLDisplay OpenEGLDisplay();
|
|
|
|
virtual EGLNativeWindowType GetEGLNativeWindow(EGLConfig config);
|
|
|
|
|
2018-10-03 13:03:19 +00:00
|
|
|
bool Initialize(void* display_handle, void* window_handle, bool stereo, bool core) override;
|
2018-10-03 13:02:45 +00:00
|
|
|
|
|
|
|
bool CreateWindowSurface();
|
|
|
|
void DestroyWindowSurface();
|
|
|
|
void DetectMode(bool has_handle);
|
2018-10-03 13:03:33 +00:00
|
|
|
void DestroyContext();
|
2018-10-03 13:02:45 +00:00
|
|
|
|
2018-10-03 13:03:19 +00:00
|
|
|
void* m_host_display = nullptr;
|
2018-10-03 13:02:45 +00:00
|
|
|
void* m_host_window = nullptr;
|
|
|
|
|
|
|
|
EGLConfig m_config;
|
|
|
|
bool m_supports_surfaceless = false;
|
|
|
|
std::vector<int> m_attribs;
|
|
|
|
|
2018-10-03 13:03:33 +00:00
|
|
|
EGLSurface m_egl_surface = EGL_NO_SURFACE;
|
|
|
|
EGLContext m_egl_context = EGL_NO_CONTEXT;
|
|
|
|
EGLDisplay m_egl_display = EGL_NO_DISPLAY;
|
2012-12-17 21:01:52 +00:00
|
|
|
};
|