Merge pull request #13418 from jordan-woyak/efb-interface

VideoCommon: Rename Renderer to EFBInterface.
This commit is contained in:
JMC47
2025-03-13 14:20:34 -04:00
committed by GitHub
28 changed files with 281 additions and 333 deletions
+4 -6
View File
@@ -615,14 +615,13 @@
<ClInclude Include="VideoBackends\Software\Clipper.h" />
<ClInclude Include="VideoBackends\Software\CopyRegion.h" />
<ClInclude Include="VideoBackends\Software\EfbCopy.h" />
<ClInclude Include="VideoBackends\Software\EfbInterface.h" />
<ClInclude Include="VideoBackends\Software\NativeVertexFormat.h" />
<ClInclude Include="VideoBackends\Software\Rasterizer.h" />
<ClInclude Include="VideoBackends\Software\SetupUnit.h" />
<ClInclude Include="VideoBackends\Software\SWBoundingBox.h" />
<ClInclude Include="VideoBackends\Software\SWEfbInterface.h" />
<ClInclude Include="VideoBackends\Software\SWGfx.h" />
<ClInclude Include="VideoBackends\Software\SWOGLWindow.h" />
<ClInclude Include="VideoBackends\Software\SWRenderer.h" />
<ClInclude Include="VideoBackends\Software\SWTexture.h" />
<ClInclude Include="VideoBackends\Software\SWVertexLoader.h" />
<ClInclude Include="VideoBackends\Software\Tev.h" />
@@ -680,6 +679,7 @@
<ClInclude Include="VideoCommon\CPUCullImpl.h" />
<ClInclude Include="VideoCommon\DataReader.h" />
<ClInclude Include="VideoCommon\DriverDetails.h" />
<ClInclude Include="VideoCommon\EFBInterface.h" />
<ClInclude Include="VideoCommon\Fifo.h" />
<ClInclude Include="VideoCommon\FramebufferManager.h" />
<ClInclude Include="VideoCommon\FramebufferShaderGen.h" />
@@ -729,7 +729,6 @@
<ClInclude Include="VideoCommon\PixelShaderManager.h" />
<ClInclude Include="VideoCommon\PostProcessing.h" />
<ClInclude Include="VideoCommon\Present.h" />
<ClInclude Include="VideoCommon\RenderBase.h" />
<ClInclude Include="VideoCommon\RenderState.h" />
<ClInclude Include="VideoCommon\ShaderCache.h" />
<ClInclude Include="VideoCommon\ShaderGenCommon.h" />
@@ -1269,14 +1268,13 @@
<ClCompile Include="VideoBackends\OGL\SamplerCache.cpp" />
<ClCompile Include="VideoBackends\Software\Clipper.cpp" />
<ClCompile Include="VideoBackends\Software\EfbCopy.cpp" />
<ClCompile Include="VideoBackends\Software\EfbInterface.cpp" />
<ClCompile Include="VideoBackends\Software\Rasterizer.cpp" />
<ClCompile Include="VideoBackends\Software\SetupUnit.cpp" />
<ClCompile Include="VideoBackends\Software\SWmain.cpp" />
<ClCompile Include="VideoBackends\Software\SWBoundingBox.cpp" />
<ClCompile Include="VideoBackends\Software\SWEfbInterface.cpp" />
<ClCompile Include="VideoBackends\Software\SWGfx.cpp" />
<ClCompile Include="VideoBackends\Software\SWOGLWindow.cpp" />
<ClCompile Include="VideoBackends\Software\SWRenderer.cpp" />
<ClCompile Include="VideoBackends\Software\SWTexture.cpp" />
<ClCompile Include="VideoBackends\Software\SWVertexLoader.cpp" />
<ClCompile Include="VideoBackends\Software\Tev.cpp" />
@@ -1324,6 +1322,7 @@
<ClCompile Include="VideoCommon\CPMemory.cpp" />
<ClCompile Include="VideoCommon\CPUCull.cpp" />
<ClCompile Include="VideoCommon\DriverDetails.cpp" />
<ClCompile Include="VideoCommon\EFBInterface.cpp" />
<ClCompile Include="VideoCommon\Fifo.cpp" />
<ClCompile Include="VideoCommon\FramebufferManager.cpp" />
<ClCompile Include="VideoCommon\FramebufferShaderGen.cpp" />
@@ -1364,7 +1363,6 @@
<ClCompile Include="VideoCommon\PixelShaderManager.cpp" />
<ClCompile Include="VideoCommon\PostProcessing.cpp" />
<ClCompile Include="VideoCommon\Present.cpp" />
<ClCompile Include="VideoCommon\RenderBase.cpp" />
<ClCompile Include="VideoCommon\RenderState.cpp" />
<ClCompile Include="VideoCommon\ShaderCache.cpp" />
<ClCompile Include="VideoCommon\ShaderGenCommon.cpp" />
+1 -1
View File
@@ -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 <AppKit/AppKit.h>
#include <Carbon/Carbon.h>
@@ -16,7 +16,6 @@
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/RenderBase.h"
namespace DX11
{
@@ -14,7 +14,6 @@
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/RenderBase.h"
namespace DX12
{
@@ -69,7 +69,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
{
return InitializeShared(std::make_unique<NullGfx>(), std::make_unique<VertexManager>(),
std::make_unique<PerfQuery>(), std::make_unique<NullBoundingBox>(),
std::make_unique<NullRenderer>(), std::make_unique<TextureCache>());
std::make_unique<NullEFBInterface>(), std::make_unique<TextureCache>());
}
void VideoBackend::Shutdown()
+21 -2
View File
@@ -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<NativeVertexFormat>(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
+7 -8
View File
@@ -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
@@ -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
@@ -6,13 +6,9 @@
#include <algorithm>
#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
@@ -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
{
@@ -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 <algorithm>
#include <array>
#include <cstddef>
#include <cstring>
#include <vector>
@@ -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
@@ -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<int>& 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
@@ -1,69 +0,0 @@
// Copyright 2009 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "VideoBackends/Software/SWRenderer.h"
#include <string>
#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<u16>(alpha_read_mode));
}
value &= 0x00FFFFFF;
}
break;
}
default:
break;
}
return value;
}
} // namespace SW
@@ -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
@@ -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"
@@ -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<SWGfx>(std::move(window)),
std::make_unique<SWVertexLoader>(), std::make_unique<PerfQuery>(),
std::make_unique<SWBoundingBox>(), std::make_unique<SWRenderer>(),
std::make_unique<SWBoundingBox>(), std::make_unique<SWEFBInterface>(),
std::make_unique<TextureCache>());
}
+2 -4
View File
@@ -7,20 +7,18 @@
#include <cmath>
#include <cstring>
#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)
@@ -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"
-1
View File
@@ -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"
+5 -6
View File
@@ -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:

Some files were not shown because too many files have changed in this diff Show More