Make the initial 3D renderer configurable via NDSArgs (#1913)

* Allow 3D renderers to be created without passing `GPU` to the constructor

* Make the initial 3D renderer configurable via `NDSArgs`

* Fix a compiler error
This commit is contained in:
Jesse Talavera
2023-12-15 08:53:31 -05:00
committed by GitHub
parent 6f47c9ed4c
commit c867a7f1c0
12 changed files with 259 additions and 246 deletions

View File

@ -31,7 +31,7 @@ class GLRenderer : public Renderer3D
{
public:
~GLRenderer() override;
void Reset() override;
void Reset(GPU& gpu) override;
void SetRenderSettings(bool betterpolygons, int scale) noexcept;
void SetBetterPolygons(bool betterpolygons) noexcept;
@ -39,22 +39,22 @@ public:
[[nodiscard]] bool GetBetterPolygons() const noexcept { return BetterPolygons; }
[[nodiscard]] int GetScaleFactor() const noexcept { return ScaleFactor; }
void VCount144() override {};
void RenderFrame() override;
void Stop() override;
void VCount144(GPU& gpu) override {};
void RenderFrame(GPU& gpu) override;
void Stop(const GPU& gpu) override;
u32* GetLine(int line) override;
void SetupAccelFrame();
void PrepareCaptureFrame() override;
void Blit() override;
void Blit(const GPU& gpu) override;
[[nodiscard]] const GLCompositor& GetCompositor() const noexcept { return CurGLCompositor; }
GLCompositor& GetCompositor() noexcept { return CurGLCompositor; }
static std::unique_ptr<GLRenderer> New(melonDS::GPU& gpu) noexcept;
static std::unique_ptr<GLRenderer> New() noexcept;
private:
// Used by New()
GLRenderer(GLCompositor&& compositor, GPU& gpu) noexcept;
GLRenderer(GLCompositor&& compositor) noexcept;
// GL version requirements
// * texelFetch: 3.0 (GLSL 1.30) (3.2/1.50 for MS)
@ -74,7 +74,6 @@ private:
u32 RenderKey;
};
melonDS::GPU& GPU;
GLCompositor CurGLCompositor;
RendererPolygon PolygonList[2048] {};
@ -86,7 +85,7 @@ private:
int RenderSinglePolygon(int i) const;
int RenderPolygonBatch(int i) const;
int RenderPolygonEdgeBatch(int i) const;
void RenderSceneChunk(int y, int h);
void RenderSceneChunk(const GPU3D& gpu3d, int y, int h);
enum
{