Skip to content

Commit

Permalink
call Reset on 3D renderer object
Browse files Browse the repository at this point in the history
RSDuck committed Dec 21, 2023
1 parent fd3c349 commit ed650f2
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/GPU3D.cpp
Original file line number Diff line number Diff line change
@@ -146,6 +146,12 @@ GPU3D::GPU3D(melonDS::NDS& nds, std::unique_ptr<Renderer3D>&& renderer) noexcept
{
}

void GPU3D::SetCurrentRenderer(std::unique_ptr<Renderer3D>&& renderer) noexcept
{
CurrentRenderer = std::move(renderer);
CurrentRenderer->Reset(NDS.GPU);
}

void GPU3D::ResetRenderingState() noexcept
{
RenderNumPolygons = 0;
@@ -282,6 +288,9 @@ void GPU3D::Reset() noexcept
FlushAttributes = 0;

RenderXPos = 0;

if (CurrentRenderer)
CurrentRenderer->Reset(NDS.GPU);
}

void GPU3D::DoSavestate(Savestate* file) noexcept
2 changes: 1 addition & 1 deletion src/GPU3D.h
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ class GPU3D
[[nodiscard]] bool IsRendererAccelerated() const noexcept;
[[nodiscard]] Renderer3D& GetCurrentRenderer() noexcept { return *CurrentRenderer; }
[[nodiscard]] const Renderer3D& GetCurrentRenderer() const noexcept { return *CurrentRenderer; }
void SetCurrentRenderer(std::unique_ptr<Renderer3D>&& renderer) noexcept { CurrentRenderer = std::move(renderer); }
void SetCurrentRenderer(std::unique_ptr<Renderer3D>&& renderer) noexcept;

u8 Read8(u32 addr) noexcept;
u16 Read16(u32 addr) noexcept;

0 comments on commit ed650f2

Please sign in to comment.