Intial Wayland EGL integration.

This commit is contained in:
James Grogan 2022-11-11 09:14:41 +00:00
parent a4d3019f04
commit 6af296409a
20 changed files with 278 additions and 44 deletions

View file

@ -21,12 +21,11 @@
XcbInterface::XcbInterface()
: mUseOpenGl(true),
mConnection(nullptr),
mX11Display(),
mGlxInterface(),
mXcbEventInterface(XcbEventInterface::Create()),
mXcbWindowInterface(XcbWindowInterface::Create())
: mConnection(nullptr),
mX11Display(),
mGlxInterface(),
mXcbEventInterface(XcbEventInterface::Create()),
mXcbWindowInterface(XcbWindowInterface::Create())
{
}
@ -36,17 +35,12 @@ XcbInterface::~XcbInterface()
}
void XcbInterface::SetUseOpenGl(bool use)
{
mUseOpenGl = use;
}
void XcbInterface::initialize(DesktopManager* desktopManager)
{
Connect();
UpdateScreen(desktopManager);
CreateGraphicsContext(desktopManager);
if (mUseOpenGl)
if (mUseHardwareRendering)
{
InitializeOpenGl();
}
@ -54,7 +48,7 @@ void XcbInterface::initialize(DesktopManager* desktopManager)
void XcbInterface::Connect()
{
if (mUseOpenGl)
if (mUseHardwareRendering)
{
mX11Display = XOpenDisplay(0);
if (!mX11Display)
@ -84,7 +78,7 @@ void XcbInterface::UpdateScreen(DesktopManager* desktopManager)
return;
}
auto screen_iter = xcb_setup_roots_iterator(xcb_get_setup(mConnection));
if (mUseOpenGl)
if (mUseHardwareRendering)
{
if (!mX11Display)
{
@ -109,7 +103,7 @@ void XcbInterface::InitializeOpenGl()
void XcbInterface::CreateOpenGlDrawable(mt::Window* window)
{
if (!mUseOpenGl or !window or !window->GetPlatformWindow())
if (!mUseHardwareRendering or !window or !window->GetPlatformWindow())
{
return;
}
@ -181,7 +175,7 @@ void XcbInterface::onPaint(DesktopManager* desktopManager)
void XcbInterface::OnExposeEvent(xcb_expose_event_t* event, DesktopManager* desktopManager)
{
// Update the window
if (mUseOpenGl)
if (mUseHardwareRendering)
{
mGlxInterface->Draw();
mGlxInterface->SwapBuffers(mX11Display);
@ -247,7 +241,7 @@ void XcbInterface::loop(DesktopManager* desktopManager)
void XcbInterface::OnLoopCompleted(DesktopManager* desktopManagers)
{
if (mUseOpenGl)
if (mUseHardwareRendering)
{
mGlxInterface->DestroyWindow(mX11Display);
mGlxInterface->DestroyContext(mX11Display);