From 4558be0d8eb79d276c89392b9410e6edb649db95 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Thu, 9 Nov 2023 15:54:51 -0500 Subject: Refactor the GPU to be object-oriented (#1873) * Refactor GPU3D to be an object - Who has two thumbs and is the sworn enemy of global state? This guy! * Refactor GPU itself to be an object - Wow, it's used in a lot of places - Also introduce a new `Melon` namespace for a few classes - I expect other classes will be moved into `Melon` over time * Change signature of Renderer3D::SetRenderSettings - Make it noexcept, and its argument const * Remove some stray whitespace --- src/GPU_OpenGL.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/GPU_OpenGL.h') diff --git a/src/GPU_OpenGL.h b/src/GPU_OpenGL.h index 3841df1..3763b6b 100644 --- a/src/GPU_OpenGL.h +++ b/src/GPU_OpenGL.h @@ -23,29 +23,29 @@ #include #include -namespace GPU +namespace Melon { - +class GPU; struct RenderSettings; class GLCompositor { public: - static std::unique_ptr New() noexcept; + static std::unique_ptr New(Melon::GPU& gpu) noexcept; GLCompositor(const GLCompositor&) = delete; GLCompositor& operator=(const GLCompositor&) = delete; ~GLCompositor(); void Reset(); - void SetRenderSettings(RenderSettings& settings); + void SetRenderSettings(const RenderSettings& settings) noexcept; void Stop(); void RenderFrame(); void BindOutputTexture(int buf); private: - GLCompositor(std::array CompShader) noexcept; - + GLCompositor(std::array CompShader, Melon::GPU& gpu) noexcept; + Melon::GPU& GPU; int Scale; int ScreenH, ScreenW; -- cgit v1.2.3