diff options
author | Jesse Talavera-Greenberg <jesse@jesse.tg> | 2023-11-09 15:54:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 21:54:51 +0100 |
commit | 4558be0d8eb79d276c89392b9410e6edb649db95 (patch) | |
tree | 3e2b37e31b38337adec64c5391e57ddf45af5d23 /src/GPU3D_OpenGL.h | |
parent | 88072a02c523e26390af6bd726608b3e567f996f (diff) |
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
Diffstat (limited to 'src/GPU3D_OpenGL.h')
-rw-r--r-- | src/GPU3D_OpenGL.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/GPU3D_OpenGL.h b/src/GPU3D_OpenGL.h index 02d8303..3657a12 100644 --- a/src/GPU3D_OpenGL.h +++ b/src/GPU3D_OpenGL.h @@ -18,10 +18,15 @@ #pragma once +#ifdef OGLRENDERER_ENABLED #include "GPU3D.h" #include "OpenGLSupport.h" +namespace Melon +{ +class GPU; +} namespace GPU3D { @@ -31,7 +36,7 @@ public: virtual ~GLRenderer() override; virtual void Reset() override; - virtual void SetRenderSettings(GPU::RenderSettings& settings) override; + virtual void SetRenderSettings(const Melon::RenderSettings& settings) noexcept override; virtual void VCount144() override {}; virtual void RenderFrame() override; @@ -40,10 +45,10 @@ public: void SetupAccelFrame(); void PrepareCaptureFrame(); - static std::unique_ptr<GLRenderer> New() noexcept; + static std::unique_ptr<GLRenderer> New(Melon::GPU& gpu) noexcept; private: // Used by New() - GLRenderer() noexcept; + GLRenderer(Melon::GPU& gpu) noexcept; // GL version requirements // * texelFetch: 3.0 (GLSL 1.30) (3.2/1.50 for MS) @@ -63,6 +68,7 @@ private: u32 RenderKey; }; + Melon::GPU& GPU; RendererPolygon PolygonList[2048] {}; bool BuildRenderShader(u32 flags, const char* vs, const char* fs); @@ -151,3 +157,4 @@ private: }; } +#endif
\ No newline at end of file |