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
This commit is contained in:
Jesse Talavera-Greenberg
2023-11-09 15:54:51 -05:00
committed by GitHub
parent 88072a02c5
commit 4558be0d8e
25 changed files with 1513 additions and 1490 deletions

View File

@ -23,29 +23,29 @@
#include <array>
#include <memory>
namespace GPU
namespace Melon
{
class GPU;
struct RenderSettings;
class GLCompositor
{
public:
static std::unique_ptr<GLCompositor> New() noexcept;
static std::unique_ptr<GLCompositor> 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<GLuint, 3> CompShader) noexcept;
GLCompositor(std::array<GLuint, 3> CompShader, Melon::GPU& gpu) noexcept;
Melon::GPU& GPU;
int Scale;
int ScreenH, ScreenW;