mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-26 07:39:56 -06:00
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:

committed by
GitHub

parent
88072a02c5
commit
4558be0d8e
@ -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
|
Reference in New Issue
Block a user