Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #9323 from waddlesplash/haiku
Rehabilitate Haiku support.
- Loading branch information
Showing
10 changed files
with
155 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| // Copyright 2017 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include "Common/GL/GLInterface/BGL.h" | ||
|
|
||
| #include <GLView.h> | ||
| #include <Size.h> | ||
| #include <Window.h> | ||
|
|
||
| #include "Common/Assert.h" | ||
|
|
||
| BGLView* GLContextBGL::s_current = nullptr; | ||
|
|
||
| GLContextBGL::~GLContextBGL() | ||
| { | ||
| if (!m_window) | ||
| delete m_gl; | ||
| } | ||
|
|
||
| bool GLContextBGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool core) | ||
| { | ||
| m_window = static_cast<BWindow*>(wsi.render_window); | ||
|
|
||
| m_gl = new BGLView(m_window ? m_window->Bounds() : BRect(), "GLContextBGL", B_FOLLOW_ALL_SIDES, 0, | ||
| BGL_RGB | BGL_DOUBLE | BGL_ALPHA); | ||
| if (m_window) | ||
| m_window->AddChild(m_gl); | ||
|
|
||
| m_opengl_mode = Mode::OpenGL; | ||
|
|
||
| m_gl->LockLooper(); | ||
| BRect size = m_gl->Frame(); | ||
| m_gl->UnlockLooper(); | ||
|
|
||
| m_backbuffer_width = size.IntegerWidth(); | ||
| m_backbuffer_height = size.IntegerHeight(); | ||
|
|
||
| MakeCurrent(); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| bool GLContextBGL::IsHeadless() const | ||
| { | ||
| return m_window == nullptr; | ||
| } | ||
|
|
||
| bool GLContextBGL::MakeCurrent() | ||
| { | ||
| if (s_current) | ||
| s_current->UnlockGL(); | ||
| m_gl->LockGL(); | ||
| s_current = m_gl; | ||
| return true; | ||
| } | ||
|
|
||
| bool GLContextBGL::ClearCurrent() | ||
| { | ||
| if (!s_current) | ||
| return true; | ||
|
|
||
| ASSERT(m_gl == s_current); | ||
| s_current->UnlockGL(); | ||
| s_current = nullptr; | ||
| return true; | ||
| } | ||
|
|
||
| void GLContextBGL::Swap() | ||
| { | ||
| m_gl->SwapBuffers(); | ||
| } | ||
|
|
||
| void GLContextBGL::Update() | ||
| { | ||
| m_gl->LockLooper(); | ||
| BRect size = m_gl->Frame(); | ||
| if (m_backbuffer_width == size.IntegerWidth() && m_backbuffer_height == size.IntegerHeight()) | ||
| { | ||
| m_gl->UnlockLooper(); | ||
| return; | ||
| } | ||
|
|
||
| ClearCurrent(); | ||
| m_gl->FrameResized(size.Width(), size.Height()); | ||
| MakeCurrent(); | ||
| m_gl->UnlockLooper(); | ||
|
|
||
| m_backbuffer_width = size.IntegerWidth(); | ||
| m_backbuffer_height = size.IntegerHeight(); | ||
| } | ||
|
|
||
| void* GLContextBGL::GetFuncAddress(const std::string& name) | ||
| { | ||
| return m_gl->GetGLProcAddress(name.c_str()); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // Copyright 2017 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Common/GL/GLContext.h" | ||
|
|
||
| class BWindow; | ||
| class BGLView; | ||
|
|
||
| class GLContextBGL final : public GLContext | ||
| { | ||
| public: | ||
| ~GLContextBGL() override; | ||
|
|
||
| bool IsHeadless() const override; | ||
|
|
||
| bool MakeCurrent() override; | ||
| bool ClearCurrent() override; | ||
|
|
||
| void Update() override; | ||
|
|
||
| void Swap() override; | ||
|
|
||
| void* GetFuncAddress(const std::string& name) override; | ||
|
|
||
| protected: | ||
| bool Initialize(const WindowSystemInfo& wsi, bool stereo, bool core) override; | ||
|
|
||
| private: | ||
| static BGLView* s_current; | ||
|
|
||
| BWindow* m_window; | ||
| BGLView* m_gl; | ||
| }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,6 +13,7 @@ enum class WindowSystemType | ||
| X11, | ||
| Wayland, | ||
| FBDev, | ||
| Haiku, | ||
| }; | ||
|
|
||
| struct WindowSystemInfo | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters