GS: Purge GSTextureSW

Everything uses hardware device textures now.
This commit is contained in:
Stenzek 2023-12-30 18:53:11 +10:00 committed by Connor McLaughlin
parent d020ea8f63
commit 46a68e2118
8 changed files with 2 additions and 125 deletions

View File

@ -498,7 +498,6 @@ set(pcsx2GSSources
GS/Renderers/HW/GSTextureReplacementLoaders.cpp
GS/Renderers/HW/GSTextureReplacements.cpp
GS/Renderers/SW/GSTextureCacheSW.cpp
GS/Renderers/SW/GSTextureSW.cpp
)
# GS headers
@ -554,7 +553,6 @@ set(pcsx2GSHeaders
GS/Renderers/SW/GSSetupPrimCodeGenerator.h
GS/Renderers/SW/GSSetupPrimCodeGenerator.all.h
GS/Renderers/SW/GSTextureCacheSW.h
GS/Renderers/SW/GSTextureSW.h
GS/Renderers/SW/GSVertexSW.h
)

View File

@ -631,8 +631,6 @@ void GSLocalMemory::ReadTexture(const GSOffset& off, const GSVector4i& r, u8* ds
//
#include "Renderers/SW/GSTextureSW.h"
void GSLocalMemory::SaveBMP(const std::string& fn, u32 bp, u32 bw, u32 psm, int w, int h)
{
int pitch = w * 4;

View File

@ -79,7 +79,8 @@ public:
virtual bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) = 0;
virtual void Unmap() = 0;
virtual void GenerateMipmap() {}
virtual bool Save(const std::string& fn);
bool Save(const std::string& fn);
__fi int GetWidth() const { return m_size.x; }
__fi int GetHeight() const { return m_size.y; }

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: LGPL-3.0+
#include "GS/Renderers/SW/GSRendererSW.h"
#include "GS/Renderers/SW/GSTextureSW.h"
#include "GS/GSGL.h"
#include "GS/GSPng.h"

View File

@ -1,84 +0,0 @@
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
// SPDX-License-Identifier: LGPL-3.0+
#include "GS/Renderers/SW/GSTextureSW.h"
#include "GS/GSExtra.h"
#include "GS/GSPng.h"
GSTextureSW::GSTextureSW(Type type, int width, int height)
{
m_mapped.clear(std::memory_order_release);
m_size = GSVector2i(width, height);
m_type = type;
m_format = Format::Invalid;
m_pitch = ((width << 2) + 31) & ~31;
m_data = _aligned_malloc(m_pitch * height, VECTOR_ALIGNMENT);
}
GSTextureSW::~GSTextureSW()
{
_aligned_free(m_data);
}
void* GSTextureSW::GetNativeHandle() const
{
return nullptr;
}
bool GSTextureSW::Update(const GSVector4i& r, const void* data, int pitch, int layer)
{
GSMap m;
if (m_data != NULL && Map(m, &r))
{
u8* RESTRICT src = (u8*)data;
u8* RESTRICT dst = m.bits;
int rowbytes = r.width() << 2;
for (int h = r.height(); h > 0; h--, src += pitch, dst += m.pitch)
{
memcpy(dst, src, rowbytes);
}
Unmap();
return true;
}
return false;
}
bool GSTextureSW::Map(GSMap& m, const GSVector4i* r, int layer)
{
GSVector4i r2 = r != NULL ? *r : GSVector4i(0, 0, m_size.x, m_size.y);
if (m_data != NULL && r2.left >= 0 && r2.right <= m_size.x && r2.top >= 0 && r2.bottom <= m_size.y)
{
if (!m_mapped.test_and_set(std::memory_order_acquire))
{
m.bits = (u8*)m_data + m_pitch * r2.top + (r2.left << 2);
m.pitch = m_pitch;
return true;
}
}
return false;
}
void GSTextureSW::Unmap()
{
m_mapped.clear(std::memory_order_release);
}
bool GSTextureSW::Save(const std::string& fn)
{
#ifdef PCSX2_DEVBUILD
GSPng::Format fmt = GSPng::RGB_A_PNG;
#else
GSPng::Format fmt = GSPng::RGB_PNG;
#endif
int compression = GSConfig.PNGCompressionLevel;
return GSPng::Save(fmt, fn, static_cast<u8*>(m_data), m_size.x, m_size.y, m_pitch, compression);
}

View File

@ -1,27 +0,0 @@
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
// SPDX-License-Identifier: LGPL-3.0+
#pragma once
#include "GS/Renderers/Common/GSTexture.h"
#include <atomic>
class GSTextureSW final : public GSTexture
{
// mem texture, always 32-bit rgba (might add 8-bit for palette if needed)
int m_pitch;
void* m_data;
std::atomic_flag m_mapped;
public:
GSTextureSW(Type type, int width, int height);
~GSTextureSW() override;
bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0) override;
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) override;
void Unmap() override;
bool Save(const std::string& fn) override;
void* GetNativeHandle() const override;
};

View File

@ -317,7 +317,6 @@
<ClCompile Include="GS\Renderers\OpenGL\GSTextureOGL.cpp" />
<ClCompile Include="GS\Renderers\HW\GSTextureCache.cpp" />
<ClCompile Include="GS\Renderers\SW\GSTextureCacheSW.cpp" />
<ClCompile Include="GS\Renderers\SW\GSTextureSW.cpp" />
<ClCompile Include="GS\GSUtil.cpp" />
<ClCompile Include="GS\GSVector.cpp" />
<ClCompile Include="GS\Renderers\Common\GSVertexTrace.cpp" />
@ -654,7 +653,6 @@
<ClInclude Include="GS\Renderers\OpenGL\GSTextureOGL.h" />
<ClInclude Include="GS\Renderers\HW\GSTextureCache.h" />
<ClInclude Include="GS\Renderers\SW\GSTextureCacheSW.h" />
<ClInclude Include="GS\Renderers\SW\GSTextureSW.h" />
<ClInclude Include="GS\GSJobQueue.h" />
<ClInclude Include="GS\GSUtil.h" />
<ClInclude Include="GS\GSVector.h" />

View File

@ -1067,9 +1067,6 @@
<ClCompile Include="GS\Renderers\SW\GSTextureCacheSW.cpp">
<Filter>System\Ps2\GS\Renderers\Software</Filter>
</ClCompile>
<ClCompile Include="GS\Renderers\SW\GSTextureSW.cpp">
<Filter>System\Ps2\GS\Renderers\Software</Filter>
</ClCompile>
<ClCompile Include="GS\Renderers\SW\GSRasterizer.cpp">
<Filter>System\Ps2\GS\Renderers\Software</Filter>
</ClCompile>
@ -1985,9 +1982,6 @@
<ClInclude Include="GS\Renderers\SW\GSTextureCacheSW.h">
<Filter>System\Ps2\GS\Renderers\Software</Filter>
</ClInclude>
<ClInclude Include="GS\Renderers\SW\GSTextureSW.h">
<Filter>System\Ps2\GS\Renderers\Software</Filter>
</ClInclude>
<ClInclude Include="GS\Renderers\SW\GSVertexSW.h">
<Filter>System\Ps2\GS\Renderers\Software</Filter>
</ClInclude>