dolphin/Source/Core/Common/GL/GLInterface/EGLX11.cpp

51 lines
1.4 KiB
C++
Raw Normal View History

// Copyright 2014 Dolphin Emulator Project
2015-05-17 23:08:10 +00:00
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/GL/GLInterface/EGLX11.h"
GLContextEGLX11::~GLContextEGLX11()
{
// The context must be destroyed before the window.
DestroyWindowSurface();
DestroyContext();
m_render_window.reset();
}
void GLContextEGLX11::Update()
{
m_render_window->UpdateDimensions();
m_backbuffer_width = m_render_window->GetWidth();
m_backbuffer_height = m_render_window->GetHeight();
}
EGLDisplay GLContextEGLX11::OpenEGLDisplay()
{
return eglGetDisplay(static_cast<Display*>(m_host_display));
}
EGLNativeWindowType GLContextEGLX11::GetEGLNativeWindow(EGLConfig config)
{
EGLint vid;
eglGetConfigAttrib(m_egl_display, config, EGL_NATIVE_VISUAL_ID, &vid);
XVisualInfo visTemplate = {};
visTemplate.visualid = vid;
int nVisuals;
XVisualInfo* vi =
XGetVisualInfo(static_cast<Display*>(m_host_display), VisualIDMask, &visTemplate, &nVisuals);
if (m_render_window)
m_render_window.reset();
m_render_window = GLX11Window::Create(static_cast<Display*>(m_host_display),
reinterpret_cast<Window>(m_host_window), vi);
m_backbuffer_width = m_render_window->GetWidth();
m_backbuffer_height = m_render_window->GetHeight();
XFree(vi);
return reinterpret_cast<EGLNativeWindowType>(m_render_window->GetWindow());
}