diff --git a/Source/Core/DolphinLib.props b/Source/Core/DolphinLib.props
index 367c347213..2c9437c01c 100644
--- a/Source/Core/DolphinLib.props
+++ b/Source/Core/DolphinLib.props
@@ -615,14 +615,13 @@
-
+
-
@@ -680,6 +679,7 @@
+
@@ -729,7 +729,6 @@
-
@@ -1269,14 +1268,13 @@
-
+
-
@@ -1324,6 +1322,7 @@
+
@@ -1364,7 +1363,6 @@
-
diff --git a/Source/Core/DolphinNoGUI/PlatformMacos.mm b/Source/Core/DolphinNoGUI/PlatformMacos.mm
index c58cf2b05f..b941858013 100644
--- a/Source/Core/DolphinNoGUI/PlatformMacos.mm
+++ b/Source/Core/DolphinNoGUI/PlatformMacos.mm
@@ -8,8 +8,8 @@
#include "Core/Core.h"
#include "Core/State.h"
#include "Core/System.h"
+#include "VideoCommon/EFBInterface.h"
#include "VideoCommon/Present.h"
-#include "VideoCommon/RenderBase.h"
#include
#include
diff --git a/Source/Core/VideoBackends/D3D/DXTexture.h b/Source/Core/VideoBackends/D3D/DXTexture.h
index 57a1165d4c..188908c095 100644
--- a/Source/Core/VideoBackends/D3D/DXTexture.h
+++ b/Source/Core/VideoBackends/D3D/DXTexture.h
@@ -16,7 +16,6 @@
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/AbstractTexture.h"
-#include "VideoCommon/RenderBase.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D12/DX12Texture.h b/Source/Core/VideoBackends/D3D12/DX12Texture.h
index a64c1c9327..19962199a2 100644
--- a/Source/Core/VideoBackends/D3D12/DX12Texture.h
+++ b/Source/Core/VideoBackends/D3D12/DX12Texture.h
@@ -14,7 +14,6 @@
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/AbstractTexture.h"
-#include "VideoCommon/RenderBase.h"
namespace DX12
{
diff --git a/Source/Core/VideoBackends/Null/NullBackend.cpp b/Source/Core/VideoBackends/Null/NullBackend.cpp
index 016613bd48..02b75fe407 100644
--- a/Source/Core/VideoBackends/Null/NullBackend.cpp
+++ b/Source/Core/VideoBackends/Null/NullBackend.cpp
@@ -69,7 +69,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
{
return InitializeShared(std::make_unique(), std::make_unique(),
std::make_unique(), std::make_unique(),
- std::make_unique(), std::make_unique());
+ std::make_unique(), std::make_unique());
}
void VideoBackend::Shutdown()
diff --git a/Source/Core/VideoBackends/Null/NullGfx.cpp b/Source/Core/VideoBackends/Null/NullGfx.cpp
index 72aea0ce50..ab60339d0b 100644
--- a/Source/Core/VideoBackends/Null/NullGfx.cpp
+++ b/Source/Core/VideoBackends/Null/NullGfx.cpp
@@ -3,7 +3,6 @@
#include "VideoBackends/Null/NullGfx.h"
-#include "VideoBackends/Null/NullBoundingBox.h"
#include "VideoBackends/Null/NullTexture.h"
#include "VideoCommon/AbstractPipeline.h"
@@ -92,6 +91,26 @@ NullGfx::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl)
return std::make_unique(vtx_decl);
}
-NullRenderer::~NullRenderer() = default;
+void NullEFBInterface::ReinterpretPixelData(EFBReinterpretType convtype)
+{
+}
+
+void NullEFBInterface::PokeColor(u16 x, u16 y, u32 color)
+{
+}
+
+void NullEFBInterface::PokeDepth(u16 x, u16 y, u32 depth)
+{
+}
+
+u32 NullEFBInterface::PeekColorInternal(u16 x, u16 y)
+{
+ return 0;
+}
+
+u32 NullEFBInterface::PeekDepth(u16 x, u16 y)
+{
+ return 0;
+}
} // namespace Null
diff --git a/Source/Core/VideoBackends/Null/NullGfx.h b/Source/Core/VideoBackends/Null/NullGfx.h
index e174bd241c..43d20a45a2 100644
--- a/Source/Core/VideoBackends/Null/NullGfx.h
+++ b/Source/Core/VideoBackends/Null/NullGfx.h
@@ -4,7 +4,7 @@
#pragma once
#include "VideoCommon/AbstractGfx.h"
-#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/EFBInterface.h"
namespace Null
{
@@ -38,16 +38,15 @@ public:
SurfaceInfo GetSurfaceInfo() const override { return {}; }
};
-class NullRenderer final : public Renderer
+class NullEFBInterface final : public EFBInterfaceBase
{
-public:
- NullRenderer() {}
- ~NullRenderer() override;
+ void ReinterpretPixelData(EFBReinterpretType convtype) override;
- u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override { return 0; }
- void PokeEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override {}
+ void PokeColor(u16 x, u16 y, u32 color) override;
+ void PokeDepth(u16 x, u16 y, u32 depth) override;
- void ReinterpretPixelData(EFBReinterpretType convtype) override {}
+ u32 PeekColorInternal(u16 x, u16 y) override;
+ u32 PeekDepth(u16 x, u16 y) override;
};
} // namespace Null
diff --git a/Source/Core/VideoBackends/Software/CMakeLists.txt b/Source/Core/VideoBackends/Software/CMakeLists.txt
index 7fc904bbf2..1a031c5645 100644
--- a/Source/Core/VideoBackends/Software/CMakeLists.txt
+++ b/Source/Core/VideoBackends/Software/CMakeLists.txt
@@ -4,8 +4,6 @@ add_library(videosoftware
CopyRegion.h
EfbCopy.cpp
EfbCopy.h
- EfbInterface.cpp
- EfbInterface.h
NativeVertexFormat.h
Rasterizer.cpp
Rasterizer.h
@@ -14,12 +12,12 @@ add_library(videosoftware
SWmain.cpp
SWBoundingBox.cpp
SWBoundingBox.h
+ SWEfbInterface.cpp
+ SWEfbInterface.h
SWGfx.cpp
SWGfx.h
SWOGLWindow.cpp
SWOGLWindow.h
- SWRenderer.cpp
- SWRenderer.h
SWTexture.cpp
SWTexture.h
SWVertexLoader.cpp
diff --git a/Source/Core/VideoBackends/Software/EfbCopy.cpp b/Source/Core/VideoBackends/Software/EfbCopy.cpp
index 15a3fb3a02..a4e9d4380b 100644
--- a/Source/Core/VideoBackends/Software/EfbCopy.cpp
+++ b/Source/Core/VideoBackends/Software/EfbCopy.cpp
@@ -6,13 +6,9 @@
#include
#include "Common/CommonTypes.h"
-#include "Common/Logging/Log.h"
-#include "Core/HW/Memmap.h"
-#include "VideoBackends/Software/EfbInterface.h"
-#include "VideoBackends/Software/TextureEncoder.h"
+#include "VideoBackends/Software/SWEfbInterface.h"
#include "VideoCommon/BPMemory.h"
-#include "VideoCommon/Fifo.h"
#include "VideoCommon/VideoCommon.h"
namespace EfbCopy
diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp
index 718f2778b9..fe79958dc0 100644
--- a/Source/Core/VideoBackends/Software/Rasterizer.cpp
+++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp
@@ -10,16 +10,14 @@
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
-#include "VideoBackends/Software/EfbInterface.h"
#include "VideoBackends/Software/NativeVertexFormat.h"
+#include "VideoBackends/Software/SWEfbInterface.h"
#include "VideoBackends/Software/Tev.h"
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/BPMemory.h"
#include "VideoCommon/PerfQueryBase.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/VideoCommon.h"
-#include "VideoCommon/VideoConfig.h"
-#include "VideoCommon/XFMemory.h"
namespace Rasterizer
{
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/SWEfbInterface.cpp
similarity index 97%
rename from Source/Core/VideoBackends/Software/EfbInterface.cpp
rename to Source/Core/VideoBackends/Software/SWEfbInterface.cpp
index 399e0bb57f..e534fab1c5 100644
--- a/Source/Core/VideoBackends/Software/EfbInterface.cpp
+++ b/Source/Core/VideoBackends/Software/SWEfbInterface.cpp
@@ -1,11 +1,10 @@
// Copyright 2009 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/SWEfbInterface.h"
#include
#include
-#include
#include
#include
@@ -717,3 +716,35 @@ void IncPerfCounterQuadCount(PerfQueryType type)
++perf_values[type];
}
} // namespace EfbInterface
+
+namespace SW
+{
+
+void SWEFBInterface::ReinterpretPixelData(EFBReinterpretType convtype)
+{
+}
+
+void SWEFBInterface::PokeColor(u16 x, u16 y, u32 color)
+{
+}
+
+void SWEFBInterface::PokeDepth(u16 x, u16 y, u32 depth)
+{
+}
+
+u32 SWEFBInterface::PeekColorInternal(u16 x, u16 y)
+{
+ const u32 color = EfbInterface::GetColor(x, y);
+
+ // rgba to argb
+ u32 value = (color >> 8) | (color & 0xff) << 24;
+
+ return value;
+}
+
+u32 SWEFBInterface::PeekDepth(u16 x, u16 y)
+{
+ return EfbInterface::GetDepth(x, y);
+}
+
+} // namespace SW
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.h b/Source/Core/VideoBackends/Software/SWEfbInterface.h
similarity index 76%
rename from Source/Core/VideoBackends/Software/EfbInterface.h
rename to Source/Core/VideoBackends/Software/SWEfbInterface.h
index 968d6f32fd..5f866ad227 100644
--- a/Source/Core/VideoBackends/Software/EfbInterface.h
+++ b/Source/Core/VideoBackends/Software/SWEfbInterface.h
@@ -5,6 +5,7 @@
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"
+#include "VideoCommon/EFBInterface.h"
#include "VideoCommon/PerfQueryBase.h"
namespace EfbInterface
@@ -48,9 +49,6 @@ bool ZCompare(u16 x, u16 y, u32 z);
void SetColor(u16 x, u16 y, u8* color);
void SetDepth(u16 x, u16 y, u32 depth);
-u32 GetColor(u16 x, u16 y);
-u32 GetDepth(u16 x, u16 y);
-
u8* GetPixelPointer(u16 x, u16 y, bool depth);
void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle& source_rect,
@@ -60,3 +58,17 @@ u32 GetPerfQueryResult(PerfQueryType type);
void ResetPerfQuery();
void IncPerfCounterQuadCount(PerfQueryType type);
} // namespace EfbInterface
+
+namespace SW
+{
+class SWEFBInterface final : public EFBInterfaceBase
+{
+ void ReinterpretPixelData(EFBReinterpretType convtype) override;
+
+ void PokeColor(u16 x, u16 y, u32 color) override;
+ void PokeDepth(u16 x, u16 y, u32 depth) override;
+
+ u32 PeekColorInternal(u16 x, u16 y) override;
+ u32 PeekDepth(u16 x, u16 y) override;
+};
+} // namespace SW
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp
deleted file mode 100644
index d537820c95..0000000000
--- a/Source/Core/VideoBackends/Software/SWRenderer.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2009 Dolphin Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "VideoBackends/Software/SWRenderer.h"
-
-#include
-
-#include "Common/CommonTypes.h"
-#include "Common/MsgHandler.h"
-
-#include "Core/HW/Memmap.h"
-#include "Core/System.h"
-
-#include "VideoBackends/Software/EfbInterface.h"
-
-#include "VideoCommon/PixelEngine.h"
-#include "VideoCommon/VideoBackendBase.h"
-
-namespace SW
-{
-u32 SWRenderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
-{
- u32 value = 0;
-
- switch (type)
- {
- case EFBAccessType::PeekZ:
- {
- value = EfbInterface::GetDepth(x, y);
- break;
- }
- case EFBAccessType::PeekColor:
- {
- const u32 color = EfbInterface::GetColor(x, y);
-
- // rgba to argb
- value = (color >> 8) | (color & 0xff) << 24;
-
- // check what to do with the alpha channel (GX_PokeAlphaRead)
- PixelEngine::AlphaReadMode alpha_read_mode =
- Core::System::GetInstance().GetPixelEngine().GetAlphaReadMode();
-
- if (alpha_read_mode == PixelEngine::AlphaReadMode::ReadNone)
- {
- // value is OK as it is
- }
- else if (alpha_read_mode == PixelEngine::AlphaReadMode::ReadFF)
- {
- value |= 0xFF000000;
- }
- else
- {
- if (alpha_read_mode != PixelEngine::AlphaReadMode::Read00)
- {
- PanicAlertFmt("Invalid PE alpha read mode: {}", static_cast(alpha_read_mode));
- }
- value &= 0x00FFFFFF;
- }
-
- break;
- }
- default:
- break;
- }
-
- return value;
-}
-
-} // namespace SW
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.h b/Source/Core/VideoBackends/Software/SWRenderer.h
deleted file mode 100644
index c9b4ae1b57..0000000000
--- a/Source/Core/VideoBackends/Software/SWRenderer.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2008 Dolphin Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "Common/CommonTypes.h"
-
-#include "VideoCommon/RenderBase.h"
-
-namespace SW
-{
-class SWRenderer final : public Renderer
-{
-public:
- u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override;
- void PokeEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override {}
-
- void ReinterpretPixelData(EFBReinterpretType convtype) override {}
-};
-} // namespace SW
diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
index 2e6e748a38..b655a3143b 100644
--- a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
+++ b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
@@ -14,7 +14,6 @@
#include "VideoBackends/Software/NativeVertexFormat.h"
#include "VideoBackends/Software/Rasterizer.h"
-#include "VideoBackends/Software/SWRenderer.h"
#include "VideoBackends/Software/Tev.h"
#include "VideoBackends/Software/TransformUnit.h"
diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp
index e33c00fe7c..6878075dad 100644
--- a/Source/Core/VideoBackends/Software/SWmain.cpp
+++ b/Source/Core/VideoBackends/Software/SWmain.cpp
@@ -10,23 +10,16 @@
#include "Common/Common.h"
#include "Common/CommonTypes.h"
-#include "Common/GL/GLContext.h"
-#include "Common/MsgHandler.h"
#include "VideoBackends/Software/Clipper.h"
-#include "VideoBackends/Software/EfbInterface.h"
#include "VideoBackends/Software/Rasterizer.h"
#include "VideoBackends/Software/SWBoundingBox.h"
+#include "VideoBackends/Software/SWEfbInterface.h"
#include "VideoBackends/Software/SWGfx.h"
#include "VideoBackends/Software/SWOGLWindow.h"
-#include "VideoBackends/Software/SWRenderer.h"
-#include "VideoBackends/Software/SWTexture.h"
#include "VideoBackends/Software/SWVertexLoader.h"
#include "VideoBackends/Software/TextureCache.h"
-#include "VideoCommon/FramebufferManager.h"
-#include "VideoCommon/Present.h"
-#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoConfig.h"
@@ -108,7 +101,7 @@ bool VideoSoftware::Initialize(const WindowSystemInfo& wsi)
return InitializeShared(std::make_unique(std::move(window)),
std::make_unique(), std::make_unique(),
- std::make_unique(), std::make_unique(),
+ std::make_unique(), std::make_unique(),
std::make_unique());
}
diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp
index 674c545759..51fbd11f5e 100644
--- a/Source/Core/VideoBackends/Software/Tev.cpp
+++ b/Source/Core/VideoBackends/Software/Tev.cpp
@@ -7,20 +7,18 @@
#include
#include
-#include "Common/ChunkFile.h"
+#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Core/System.h"
-#include "VideoBackends/Software/EfbInterface.h"
#include "VideoBackends/Software/SWBoundingBox.h"
+#include "VideoBackends/Software/SWEfbInterface.h"
#include "VideoBackends/Software/TextureSampler.h"
-#include "VideoCommon/PerfQueryBase.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/VideoCommon.h"
-#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/XFMemory.h"
static inline s16 Clamp255(s16 in)
diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.cpp b/Source/Core/VideoBackends/Software/TextureEncoder.cpp
index 19880312ac..9f99cdf274 100644
--- a/Source/Core/VideoBackends/Software/TextureEncoder.cpp
+++ b/Source/Core/VideoBackends/Software/TextureEncoder.cpp
@@ -5,12 +5,11 @@
#include "Common/Align.h"
#include "Common/Assert.h"
-#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
#include "Common/MsgHandler.h"
#include "Common/Swap.h"
-#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/SWEfbInterface.h"
#include "VideoBackends/Software/SWTexture.h"
#include "VideoCommon/BPMemory.h"
diff --git a/Source/Core/VideoCommon/AbstractGfx.cpp b/Source/Core/VideoCommon/AbstractGfx.cpp
index 06524d04b4..27424b25f5 100644
--- a/Source/Core/VideoCommon/AbstractGfx.cpp
+++ b/Source/Core/VideoCommon/AbstractGfx.cpp
@@ -9,7 +9,6 @@
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/FramebufferManager.h"
-#include "VideoCommon/RenderBase.h"
#include "VideoCommon/ShaderCache.h"
#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VideoConfig.h"
diff --git a/Source/Core/VideoCommon/AsyncRequests.cpp b/Source/Core/VideoCommon/AsyncRequests.cpp
index 0bb916d9b6..e79ba51482 100644
--- a/Source/Core/VideoCommon/AsyncRequests.cpp
+++ b/Source/Core/VideoCommon/AsyncRequests.cpp
@@ -8,9 +8,9 @@
#include "Core/System.h"
#include "VideoCommon/BoundingBox.h"
+#include "VideoCommon/EFBInterface.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/Present.h"
-#include "VideoCommon/RenderBase.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VideoBackendBase.h"
@@ -102,26 +102,25 @@ void AsyncRequests::HandleEvent(const AsyncRequests::Event& e)
case Event::EFB_POKE_COLOR:
{
INCSTAT(g_stats.this_frame.num_efb_pokes);
- g_renderer->PokeEFB(EFBAccessType::PokeColor, e.efb_poke.x, e.efb_poke.y, e.efb_poke.data);
+ g_efb_interface->PokeColor(e.efb_poke.x, e.efb_poke.y, e.efb_poke.data);
}
break;
case Event::EFB_POKE_Z:
{
INCSTAT(g_stats.this_frame.num_efb_pokes);
- g_renderer->PokeEFB(EFBAccessType::PokeZ, e.efb_poke.x, e.efb_poke.y, e.efb_poke.data);
+ g_efb_interface->PokeDepth(e.efb_poke.x, e.efb_poke.y, e.efb_poke.data);
}
break;
case Event::EFB_PEEK_COLOR:
INCSTAT(g_stats.this_frame.num_efb_peeks);
- *e.efb_peek.data =
- g_renderer->AccessEFB(EFBAccessType::PeekColor, e.efb_peek.x, e.efb_peek.y, 0);
+ *e.efb_peek.data = g_efb_interface->PeekColor(e.efb_peek.x, e.efb_peek.y);
break;
case Event::EFB_PEEK_Z:
INCSTAT(g_stats.this_frame.num_efb_peeks);
- *e.efb_peek.data = g_renderer->AccessEFB(EFBAccessType::PeekZ, e.efb_peek.x, e.efb_peek.y, 0);
+ *e.efb_peek.data = g_efb_interface->PeekDepth(e.efb_peek.x, e.efb_peek.y);
break;
case Event::SWAP_EVENT:
diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp
index d813d8b6e3..0b20bcfd8a 100644
--- a/Source/Core/VideoCommon/BPFunctions.cpp
+++ b/Source/Core/VideoCommon/BPFunctions.cpp
@@ -15,8 +15,8 @@
#include "VideoCommon/AbstractFramebuffer.h"
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/EFBInterface.h"
#include "VideoCommon/FramebufferManager.h"
-#include "VideoCommon/RenderBase.h"
#include "VideoCommon/RenderState.h"
#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VertexShaderManager.h"
@@ -369,12 +369,12 @@ void OnPixelFormatChange()
if (new_format == PixelFormat::RGBA6_Z24)
{
- g_renderer->ReinterpretPixelData(EFBReinterpretType::RGB8ToRGBA6);
+ g_efb_interface->ReinterpretPixelData(EFBReinterpretType::RGB8ToRGBA6);
return;
}
else if (new_format == PixelFormat::RGB565_Z16)
{
- g_renderer->ReinterpretPixelData(EFBReinterpretType::RGB8ToRGB565);
+ g_efb_interface->ReinterpretPixelData(EFBReinterpretType::RGB8ToRGB565);
return;
}
}
@@ -384,12 +384,12 @@ void OnPixelFormatChange()
{
if (new_format == PixelFormat::RGB8_Z24 || new_format == PixelFormat::Z24)
{
- g_renderer->ReinterpretPixelData(EFBReinterpretType::RGBA6ToRGB8);
+ g_efb_interface->ReinterpretPixelData(EFBReinterpretType::RGBA6ToRGB8);
return;
}
else if (new_format == PixelFormat::RGB565_Z16)
{
- g_renderer->ReinterpretPixelData(EFBReinterpretType::RGBA6ToRGB565);
+ g_efb_interface->ReinterpretPixelData(EFBReinterpretType::RGBA6ToRGB565);
return;
}
}
@@ -399,12 +399,12 @@ void OnPixelFormatChange()
{
if (new_format == PixelFormat::RGB8_Z24 || new_format == PixelFormat::Z24)
{
- g_renderer->ReinterpretPixelData(EFBReinterpretType::RGB565ToRGB8);
+ g_efb_interface->ReinterpretPixelData(EFBReinterpretType::RGB565ToRGB8);
return;
}
else if (new_format == PixelFormat::RGBA6_Z24)
{
- g_renderer->ReinterpretPixelData(EFBReinterpretType::RGB565ToRGBA6);
+ g_efb_interface->ReinterpretPixelData(EFBReinterpretType::RGB565ToRGBA6);
return;
}
}
diff --git a/Source/Core/VideoCommon/CMakeLists.txt b/Source/Core/VideoCommon/CMakeLists.txt
index e24680185e..6361e639c4 100644
--- a/Source/Core/VideoCommon/CMakeLists.txt
+++ b/Source/Core/VideoCommon/CMakeLists.txt
@@ -49,6 +49,8 @@ add_library(videocommon
CPUCullImpl.h
DriverDetails.cpp
DriverDetails.h
+ EFBInterface.cpp
+ EFBInterface.h
Fifo.cpp
Fifo.h
FramebufferManager.cpp
@@ -134,8 +136,6 @@ add_library(videocommon
PostProcessing.h
Present.cpp
Present.h
- RenderBase.cpp
- RenderBase.h
RenderState.cpp
RenderState.h
ShaderCache.cpp
diff --git a/Source/Core/VideoCommon/EFBInterface.cpp b/Source/Core/VideoCommon/EFBInterface.cpp
new file mode 100644
index 0000000000..9b88a58d0d
--- /dev/null
+++ b/Source/Core/VideoCommon/EFBInterface.cpp
@@ -0,0 +1,126 @@
+// Copyright 2025 Dolphin Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "VideoCommon/EFBInterface.h"
+
+#include
+#include
+#include
+
+#include
+
+#include "Common/MsgHandler.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/System.h"
+
+#include "VideoCommon/FramebufferManager.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/VideoBackendBase.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
+
+std::unique_ptr g_efb_interface;
+
+EFBInterfaceBase::~EFBInterfaceBase() = default;
+
+void HardwareEFBInterface::ReinterpretPixelData(EFBReinterpretType convtype)
+{
+ g_framebuffer_manager->ReinterpretPixelData(convtype);
+}
+
+u32 HardwareEFBInterface::PeekColorInternal(u16 x, u16 y)
+{
+ u32 color = g_framebuffer_manager->PeekEFBColor(x, y);
+
+ // a little-endian value is expected to be returned
+ color = ((color & 0xFF00FF00) | ((color >> 16) & 0xFF) | ((color << 16) & 0xFF0000));
+
+ if (bpmem.zcontrol.pixel_format == PixelFormat::RGBA6_Z24)
+ {
+ color = RGBA8ToRGBA6ToRGBA8(color);
+ }
+ else if (bpmem.zcontrol.pixel_format == PixelFormat::RGB565_Z16)
+ {
+ color = RGBA8ToRGB565ToRGBA8(color);
+ }
+ if (bpmem.zcontrol.pixel_format != PixelFormat::RGBA6_Z24)
+ {
+ color |= 0xFF000000;
+ }
+
+ return color;
+}
+
+u32 EFBInterfaceBase::PeekColor(u16 x, u16 y)
+{
+ u32 color = PeekColorInternal(x, y);
+
+ // check what to do with the alpha channel (GX_PokeAlphaRead)
+ PixelEngine::AlphaReadMode alpha_read_mode =
+ Core::System::GetInstance().GetPixelEngine().GetAlphaReadMode();
+
+ if (alpha_read_mode == PixelEngine::AlphaReadMode::ReadNone)
+ {
+ return color;
+ }
+ else if (alpha_read_mode == PixelEngine::AlphaReadMode::ReadFF)
+ {
+ return color | 0xFF000000;
+ }
+ else
+ {
+ if (alpha_read_mode != PixelEngine::AlphaReadMode::Read00)
+ {
+ PanicAlertFmt("Invalid PE alpha read mode: {}", static_cast(alpha_read_mode));
+ }
+ return color & 0x00FFFFFF;
+ }
+}
+
+u32 HardwareEFBInterface::PeekDepth(u16 x, u16 y)
+{
+ // Depth buffer is inverted for improved precision near far plane
+ float depth = g_framebuffer_manager->PeekEFBDepth(x, y);
+ if (!g_backend_info.bSupportsReversedDepthRange)
+ depth = 1.0f - depth;
+
+ // Convert to 24bit depth
+ u32 z24depth = std::clamp(static_cast(depth * 16777216.0f), 0, 0xFFFFFF);
+
+ if (bpmem.zcontrol.pixel_format == PixelFormat::RGB565_Z16)
+ {
+ // When in RGB565_Z16 mode, EFB Z peeks return a 16bit value, which is presumably a
+ // resolved sample from the MSAA buffer.
+ // Dolphin doesn't currently emulate the 3 sample MSAA mode (and potentially never will)
+ // it just transparently upgrades the framebuffer to 24bit depth and color and whatever
+ // level of MSAA and higher Internal Resolution the user has configured.
+
+ // This is mostly transparent, unless the game does an EFB read.
+ // But we can simply convert the 24bit depth on the fly to the 16bit depth the game expects.
+
+ return CompressZ16(z24depth, bpmem.zcontrol.zformat);
+ }
+
+ return z24depth;
+}
+
+void HardwareEFBInterface::PokeColor(u16 x, u16 y, u32 poke_data)
+{
+ // Convert to expected format (BGRA->RGBA)
+ // TODO: Check alpha, depending on mode?
+ const u32 color =
+ ((poke_data & 0xFF00FF00) | ((poke_data >> 16) & 0xFF) | ((poke_data << 16) & 0xFF0000));
+
+ g_framebuffer_manager->PokeEFBColor(x, y, color);
+}
+
+void HardwareEFBInterface::PokeDepth(u16 x, u16 y, u32 poke_data)
+{
+ // Convert to floating-point depth.
+ float depth = float(poke_data & 0xFFFFFF) / 16777216.0f;
+ if (!g_backend_info.bSupportsReversedDepthRange)
+ depth = 1.0f - depth;
+
+ g_framebuffer_manager->PokeEFBDepth(x, y, depth);
+}
diff --git a/Source/Core/VideoCommon/EFBInterface.h b/Source/Core/VideoCommon/EFBInterface.h
new file mode 100644
index 0000000000..a3ee947dd9
--- /dev/null
+++ b/Source/Core/VideoCommon/EFBInterface.h
@@ -0,0 +1,40 @@
+// Copyright 2025 Dolphin Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include
+
+#include "Common/CommonTypes.h"
+
+enum class EFBReinterpretType;
+
+class EFBInterfaceBase
+{
+public:
+ virtual ~EFBInterfaceBase();
+
+ virtual void ReinterpretPixelData(EFBReinterpretType convtype) = 0;
+
+ virtual void PokeColor(u16 x, u16 y, u32 color) = 0;
+ virtual void PokeDepth(u16 x, u16 y, u32 depth) = 0;
+
+ u32 PeekColor(u16 x, u16 y);
+ virtual u32 PeekDepth(u16 x, u16 y) = 0;
+
+protected:
+ virtual u32 PeekColorInternal(u16 x, u16 y) = 0;
+};
+
+class HardwareEFBInterface final : public EFBInterfaceBase
+{
+ void ReinterpretPixelData(EFBReinterpretType convtype) override;
+
+ void PokeColor(u16 x, u16 y, u32 color) override;
+ void PokeDepth(u16 x, u16 y, u32 depth) override;
+
+ u32 PeekColorInternal(u16 x, u16 y) override;
+ u32 PeekDepth(u16 x, u16 y) override;
+};
+
+extern std::unique_ptr g_efb_interface;
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
deleted file mode 100644
index 61b059e86d..0000000000
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2010 Dolphin Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-// ---------------------------------------------------------------------------------------------
-// GC graphics pipeline
-// ---------------------------------------------------------------------------------------------
-// 3d commands are issued through the fifo. The GPU draws to the 2MB EFB.
-// The efb can be copied back into ram in two forms: as textures or as XFB.
-// The XFB is the region in RAM that the VI chip scans out to the television.
-// So, after all rendering to EFB is done, the image is copied into one of two XFBs in RAM.
-// Next frame, that one is scanned out and the other one gets the copy. = double buffering.
-// ---------------------------------------------------------------------------------------------
-
-#include "VideoCommon/RenderBase.h"
-
-#include
-#include
-#include
-#include
-
-#include
-
-#include "Common/Logging/Log.h"
-#include "Common/MsgHandler.h"
-
-#include "Core/ConfigManager.h"
-#include "Core/System.h"
-
-#include "VideoCommon/FramebufferManager.h"
-#include "VideoCommon/PixelEngine.h"
-#include "VideoCommon/VideoBackendBase.h"
-#include "VideoCommon/VideoCommon.h"
-#include "VideoCommon/VideoConfig.h"
-
-std::unique_ptr g_renderer;
-
-Renderer::~Renderer() = default;
-
-void Renderer::ReinterpretPixelData(EFBReinterpretType convtype)
-{
- g_framebuffer_manager->ReinterpretPixelData(convtype);
-}
-
-u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
-{
- if (type == EFBAccessType::PeekColor)
- {
- u32 color = g_framebuffer_manager->PeekEFBColor(x, y);
-
- // a little-endian value is expected to be returned
- color = ((color & 0xFF00FF00) | ((color >> 16) & 0xFF) | ((color << 16) & 0xFF0000));
-
- if (bpmem.zcontrol.pixel_format == PixelFormat::RGBA6_Z24)
- {
- color = RGBA8ToRGBA6ToRGBA8(color);
- }
- else if (bpmem.zcontrol.pixel_format == PixelFormat::RGB565_Z16)
- {
- color = RGBA8ToRGB565ToRGBA8(color);
- }
- if (bpmem.zcontrol.pixel_format != PixelFormat::RGBA6_Z24)
- {
- color |= 0xFF000000;
- }
-
- // check what to do with the alpha channel (GX_PokeAlphaRead)
- PixelEngine::AlphaReadMode alpha_read_mode =
- Core::System::GetInstance().GetPixelEngine().GetAlphaReadMode();
-
- if (alpha_read_mode == PixelEngine::AlphaReadMode::ReadNone)
- {
- return color;
- }
- else if (alpha_read_mode == PixelEngine::AlphaReadMode::ReadFF)
- {
- return color | 0xFF000000;
- }
- else
- {
- if (alpha_read_mode != PixelEngine::AlphaReadMode::Read00)
- {
- PanicAlertFmt("Invalid PE alpha read mode: {}", static_cast(alpha_read_mode));
- }
- return color & 0x00FFFFFF;
- }
- }
- else // if (type == EFBAccessType::PeekZ)
- {
- // Depth buffer is inverted for improved precision near far plane
- float depth = g_framebuffer_manager->PeekEFBDepth(x, y);
- if (!g_backend_info.bSupportsReversedDepthRange)
- depth = 1.0f - depth;
-
- // Convert to 24bit depth
- u32 z24depth = std::clamp(static_cast(depth * 16777216.0f), 0, 0xFFFFFF);
-
- if (bpmem.zcontrol.pixel_format == PixelFormat::RGB565_Z16)
- {
- // When in RGB565_Z16 mode, EFB Z peeks return a 16bit value, which is presumably a
- // resolved sample from the MSAA buffer.
- // Dolphin doesn't currently emulate the 3 sample MSAA mode (and potentially never will)
- // it just transparently upgrades the framebuffer to 24bit depth and color and whatever
- // level of MSAA and higher Internal Resolution the user has configured.
-
- // This is mostly transparent, unless the game does an EFB read.
- // But we can simply convert the 24bit depth on the fly to the 16bit depth the game expects.
-
- return CompressZ16(z24depth, bpmem.zcontrol.zformat);
- }
-
- return z24depth;
- }
-}
-
-void Renderer::PokeEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
-{
- if (type == EFBAccessType::PokeColor)
- {
- // Convert to expected format (BGRA->RGBA)
- // TODO: Check alpha, depending on mode?
- const u32 color =
- ((poke_data & 0xFF00FF00) | ((poke_data >> 16) & 0xFF) | ((poke_data << 16) & 0xFF0000));
- g_framebuffer_manager->PokeEFBColor(x, y, color);
- }
- else // if (type == EFBAccessType::PokeZ)
- {
- // Convert to floating-point depth.
- float depth = float(poke_data & 0xFFFFFF) / 16777216.0f;
- if (!g_backend_info.bSupportsReversedDepthRange)
- depth = 1.0f - depth;
-
- g_framebuffer_manager->PokeEFBDepth(x, y, depth);
- }
-}
diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h
deleted file mode 100644
index c6345f4953..0000000000
--- a/Source/Core/VideoCommon/RenderBase.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2010 Dolphin Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include
-
-#include "Common/CommonTypes.h"
-
-enum class EFBAccessType;
-enum class EFBReinterpretType;
-
-// Renderer really isn't a very good name for this class - it's more like "Misc".
-// It used to be a massive mess, but almost everything has been refactored out.
-//
-// All that's left is a thin abstraction layer for VideoSoftware to intercept EFB accesses.
-class Renderer
-{
-public:
- virtual ~Renderer();
-
- virtual void ReinterpretPixelData(EFBReinterpretType convtype);
-
- virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data);
- virtual void PokeEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data);
-};
-
-extern std::unique_ptr g_renderer;
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp
index a7a322eab3..ba63b335de 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.cpp
+++ b/Source/Core/VideoCommon/VideoBackendBase.cpp
@@ -13,7 +13,6 @@
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
-#include "Common/Event.h"
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
@@ -46,18 +45,16 @@
#include "VideoCommon/BoundingBox.h"
#include "VideoCommon/CPMemory.h"
#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/EFBInterface.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/FrameDumper.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/GeometryShaderManager.h"
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.h"
-#include "VideoCommon/IndexGenerator.h"
#include "VideoCommon/OnScreenDisplay.h"
-#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/Present.h"
-#include "VideoCommon/RenderBase.h"
#include "VideoCommon/TMEM.h"
#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/VertexLoaderManager.h"
@@ -325,11 +322,11 @@ bool VideoBackendBase::InitializeShared(std::unique_ptr gfx,
std::unique_ptr perf_query,
std::unique_ptr bounding_box)
{
- // All hardware backends use the default RendererBase and TextureCacheBase.
+ // All hardware backends use the default EFBInterface and TextureCacheBase.
// Only Null and Software backends override them
return InitializeShared(std::move(gfx), std::move(vertex_manager), std::move(perf_query),
- std::move(bounding_box), std::make_unique(),
+ std::move(bounding_box), std::make_unique(),
std::make_unique());
}
@@ -337,7 +334,7 @@ bool VideoBackendBase::InitializeShared(std::unique_ptr gfx,
std::unique_ptr vertex_manager,
std::unique_ptr perf_query,
std::unique_ptr bounding_box,
- std::unique_ptr renderer,
+ std::unique_ptr efb_interface,
std::unique_ptr texture_cache)
{
memset(reinterpret_cast(&g_main_cp_state), 0, sizeof(g_main_cp_state));
@@ -352,9 +349,9 @@ bool VideoBackendBase::InitializeShared(std::unique_ptr gfx,
g_perf_query = std::move(perf_query);
g_bounding_box = std::move(bounding_box);
- // Null and Software Backends supply their own derived Renderer and Texture Cache
+ // Null and Software Backends supply their own derived EFBInterface and TextureCache
g_texture_cache = std::move(texture_cache);
- g_renderer = std::move(renderer);
+ g_efb_interface = std::move(efb_interface);
g_presenter = std::make_unique();
g_frame_dumper = std::make_unique();
@@ -418,7 +415,7 @@ void VideoBackendBase::ShutdownShared()
g_framebuffer_manager.reset();
g_shader_cache.reset();
g_vertex_manager.reset();
- g_renderer.reset();
+ g_efb_interface.reset();
g_widescreen.reset();
g_presenter.reset();
g_gfx.reset();
diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h
index 770b6f3631..0f594a9793 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.h
+++ b/Source/Core/VideoCommon/VideoBackendBase.h
@@ -20,9 +20,9 @@ class PointerWrap;
class AbstractGfx;
class BoundingBox;
-class Renderer;
class TextureCacheBase;
class VertexManagerBase;
+class EFBInterfaceBase;
enum class FieldType
{
@@ -80,12 +80,12 @@ protected:
std::unique_ptr perf_query,
std::unique_ptr bounding_box);
- // For software and null backends. Allows overriding the default Renderer and Texture Cache
+ // For software and null backends. Allows overriding the default EFBInterface and TextureCache
bool InitializeShared(std::unique_ptr gfx,
std::unique_ptr vertex_manager,
std::unique_ptr perf_query,
std::unique_ptr bounding_box,
- std::unique_ptr renderer,
+ std::unique_ptr efb_interface,
std::unique_ptr texture_cache);
void ShutdownShared();