diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 2145838814..21b8ad1c02 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -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 ) diff --git a/pcsx2/GS/GSLocalMemory.cpp b/pcsx2/GS/GSLocalMemory.cpp index 6a3864a2cc..557d894fbc 100644 --- a/pcsx2/GS/GSLocalMemory.cpp +++ b/pcsx2/GS/GSLocalMemory.cpp @@ -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; diff --git a/pcsx2/GS/Renderers/Common/GSTexture.h b/pcsx2/GS/Renderers/Common/GSTexture.h index d1c9793f31..e22176e01f 100644 --- a/pcsx2/GS/Renderers/Common/GSTexture.h +++ b/pcsx2/GS/Renderers/Common/GSTexture.h @@ -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; } diff --git a/pcsx2/GS/Renderers/SW/GSRendererSW.cpp b/pcsx2/GS/Renderers/SW/GSRendererSW.cpp index 62907ba380..6447691a31 100644 --- a/pcsx2/GS/Renderers/SW/GSRendererSW.cpp +++ b/pcsx2/GS/Renderers/SW/GSRendererSW.cpp @@ -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" diff --git a/pcsx2/GS/Renderers/SW/GSTextureSW.cpp b/pcsx2/GS/Renderers/SW/GSTextureSW.cpp deleted file mode 100644 index 28f2e2bb1b..0000000000 --- a/pcsx2/GS/Renderers/SW/GSTextureSW.cpp +++ /dev/null @@ -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(m_data), m_size.x, m_size.y, m_pitch, compression); -} diff --git a/pcsx2/GS/Renderers/SW/GSTextureSW.h b/pcsx2/GS/Renderers/SW/GSTextureSW.h deleted file mode 100644 index 8ce236826d..0000000000 --- a/pcsx2/GS/Renderers/SW/GSTextureSW.h +++ /dev/null @@ -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 - -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; -}; diff --git a/pcsx2/pcsx2.vcxproj b/pcsx2/pcsx2.vcxproj index 494f691ac9..aeb183f1fb 100644 --- a/pcsx2/pcsx2.vcxproj +++ b/pcsx2/pcsx2.vcxproj @@ -317,7 +317,6 @@ - @@ -654,7 +653,6 @@ - diff --git a/pcsx2/pcsx2.vcxproj.filters b/pcsx2/pcsx2.vcxproj.filters index 467cf54fc3..45e0e4b9e0 100644 --- a/pcsx2/pcsx2.vcxproj.filters +++ b/pcsx2/pcsx2.vcxproj.filters @@ -1067,9 +1067,6 @@ System\Ps2\GS\Renderers\Software - - System\Ps2\GS\Renderers\Software - System\Ps2\GS\Renderers\Software @@ -1985,9 +1982,6 @@ System\Ps2\GS\Renderers\Software - - System\Ps2\GS\Renderers\Software - System\Ps2\GS\Renderers\Software