VideoCommon: Rename Renderer to EFBInterface.

This commit is contained in:
Jordan Woyak
2025-03-11 21:12:06 -05:00
parent de997d616f
commit 5b36c13bfb
28 changed files with 281 additions and 333 deletions

View File

@ -16,7 +16,6 @@
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/RenderBase.h"
namespace DX11
{

View File

@ -14,7 +14,6 @@
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/RenderBase.h"
namespace DX12
{

View File

@ -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()

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

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

View File

@ -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

View File

@ -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

View File

@ -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
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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>());
}

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)

View File

@ -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"