Video Backends: Split texture cache code out into separate files, introduce 'AbstractTexture'

This commit is contained in:
iwubcode
2017-04-22 23:44:34 -05:00
parent 77c0539b5e
commit 2cdc93f4ab
48 changed files with 1822 additions and 1397 deletions

View File

@ -6,6 +6,7 @@ set(SRCS
Rasterizer.cpp
SWOGLWindow.cpp
SWRenderer.cpp
SWTexture.cpp
SWVertexLoader.cpp
SWmain.cpp
SetupUnit.cpp

View File

@ -0,0 +1,28 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "VideoBackends/Software/SWTexture.h"
namespace SW
{
SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config)
{
}
void SWTexture::Bind(unsigned int stage)
{
}
void SWTexture::CopyRectangleFromTexture(const AbstractTexture* source,
const MathUtil::Rectangle<int>& srcrect,
const MathUtil::Rectangle<int>& dstrect)
{
}
void SWTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
size_t buffer_size)
{
}
} // namespace SW

View File

@ -0,0 +1,29 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/CommonTypes.h"
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/VideoCommon.h"
namespace SW
{
class SWTexture final : public AbstractTexture
{
public:
explicit SWTexture(const TextureConfig& tex_config);
~SWTexture() = default;
void Bind(unsigned int stage) override;
void CopyRectangleFromTexture(const AbstractTexture* source,
const MathUtil::Rectangle<int>& srcrect,
const MathUtil::Rectangle<int>& dstrect) override;
void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
size_t buffer_size) override;
};
} // namespace SW

View File

@ -15,6 +15,7 @@
#include "VideoBackends/Software/Rasterizer.h"
#include "VideoBackends/Software/SWOGLWindow.h"
#include "VideoBackends/Software/SWRenderer.h"
#include "VideoBackends/Software/SWTexture.h"
#include "VideoBackends/Software/SWVertexLoader.h"
#include "VideoBackends/Software/VideoBackend.h"
@ -49,7 +50,7 @@ class TextureCache : public TextureCacheBase
public:
bool CompileShaders() override { return true; }
void DeleteShaders() override {}
void ConvertTexture(TCacheEntryBase* entry, TCacheEntryBase* unconverted, void* palette,
void ConvertTexture(TCacheEntry* entry, TCacheEntry* unconverted, void* palette,
TlutFormat format) override
{
}
@ -61,33 +62,15 @@ public:
}
private:
struct TCacheEntry : TCacheEntryBase
std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config) override
{
TCacheEntry(const TCacheEntryConfig& _config) : TCacheEntryBase(_config) {}
~TCacheEntry() {}
void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
size_t buffer_size) override
{
}
void FromRenderTarget(bool is_depth_copy, const EFBRectangle& srcRect, bool scaleByHalf,
unsigned int cbufid, const float* colmat) override
{
EfbCopy::CopyEfb();
}
return std::make_unique<SWTexture>(config);
}
void CopyRectangleFromTexture(const TCacheEntryBase* source,
const MathUtil::Rectangle<int>& srcrect,
const MathUtil::Rectangle<int>& dstrect) override
{
}
void Bind(unsigned int stage) override {}
bool Save(const std::string& filename, unsigned int level) override { return false; }
};
TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) override
void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, const EFBRectangle& src_rect,
bool scale_by_half, unsigned int cbuf_id, const float* colmat) override
{
return new TCacheEntry(config);
EfbCopy::CopyEfb();
}
};

View File

@ -45,6 +45,7 @@
<ClCompile Include="SWmain.cpp" />
<ClCompile Include="SWOGLWindow.cpp" />
<ClCompile Include="SWRenderer.cpp" />
<ClCompile Include="SWTexture.cpp" />
<ClCompile Include="SWVertexLoader.cpp" />
<ClCompile Include="Tev.cpp" />
<ClCompile Include="TextureEncoder.cpp" />
@ -61,6 +62,7 @@
<ClInclude Include="SetupUnit.h" />
<ClInclude Include="SWOGLWindow.h" />
<ClInclude Include="SWRenderer.h" />
<ClInclude Include="SWTexture.h" />
<ClInclude Include="SWVertexLoader.h" />
<ClInclude Include="Tev.h" />
<ClInclude Include="TextureEncoder.h" />