mirror of https://github.com/PCSX2/pcsx2.git
GS: Purge GSTexture::Swap()
Was only used for texture replacements, and that can just be a pointer swap instead.
This commit is contained in:
parent
7c62b86ed9
commit
a4b40ab9e1
|
@ -62,17 +62,6 @@ bool GSTexture::Save(const std::string& fn)
|
|||
return GSPng::Save(format, fn, dl->GetMapPointer(), m_size.x, m_size.y, dl->GetMapPitch(), compression, g_gs_device->IsRBSwapped());
|
||||
}
|
||||
|
||||
void GSTexture::Swap(GSTexture* tex)
|
||||
{
|
||||
std::swap(m_size, tex->m_size);
|
||||
std::swap(m_mipmap_levels, tex->m_mipmap_levels);
|
||||
std::swap(m_type, tex->m_type);
|
||||
std::swap(m_format, tex->m_format);
|
||||
std::swap(m_state, tex->m_state);
|
||||
std::swap(m_needs_mipmaps_generated, tex->m_needs_mipmaps_generated);
|
||||
std::swap(m_last_frame_used, tex->m_last_frame_used);
|
||||
}
|
||||
|
||||
u32 GSTexture::GetCompressedBytesPerBlock() const
|
||||
{
|
||||
return GetCompressedBytesPerBlock(m_format);
|
||||
|
|
|
@ -80,7 +80,6 @@ public:
|
|||
virtual void Unmap() = 0;
|
||||
virtual void GenerateMipmap() {}
|
||||
virtual bool Save(const std::string& fn);
|
||||
virtual void Swap(GSTexture* tex);
|
||||
|
||||
__fi int GetWidth() const { return m_size.x; }
|
||||
__fi int GetHeight() const { return m_size.y; }
|
||||
|
|
|
@ -85,16 +85,6 @@ void GSTexture11::GenerateMipmap()
|
|||
GSDevice11::GetInstance()->GetD3DContext()->GenerateMips(operator ID3D11ShaderResourceView*());
|
||||
}
|
||||
|
||||
void GSTexture11::Swap(GSTexture* tex)
|
||||
{
|
||||
GSTexture::Swap(tex);
|
||||
std::swap(m_texture, static_cast<GSTexture11*>(tex)->m_texture);
|
||||
std::swap(m_srv, static_cast<GSTexture11*>(tex)->m_srv);
|
||||
std::swap(m_rtv, static_cast<GSTexture11*>(tex)->m_rtv);
|
||||
std::swap(m_desc, static_cast<GSTexture11*>(tex)->m_desc);
|
||||
std::swap(m_mapped_subresource, static_cast<GSTexture11*>(tex)->m_mapped_subresource);
|
||||
}
|
||||
|
||||
GSTexture11::operator ID3D11Texture2D*()
|
||||
{
|
||||
return m_texture.get();
|
||||
|
@ -163,11 +153,6 @@ GSTexture11::operator ID3D11UnorderedAccessView*()
|
|||
return m_uav.get();
|
||||
}
|
||||
|
||||
bool GSTexture11::Equal(GSTexture11* tex)
|
||||
{
|
||||
return tex && m_texture == tex->m_texture;
|
||||
}
|
||||
|
||||
GSDownloadTexture11::GSDownloadTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> tex, u32 width, u32 height, GSTexture::Format format)
|
||||
: GSDownloadTexture(width, height, format)
|
||||
, m_texture(std::move(tex))
|
||||
|
|
|
@ -32,8 +32,6 @@ public:
|
|||
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) override;
|
||||
void Unmap() override;
|
||||
void GenerateMipmap() override;
|
||||
void Swap(GSTexture* tex) override;
|
||||
bool Equal(GSTexture11* tex);
|
||||
|
||||
operator ID3D11Texture2D*();
|
||||
operator ID3D11ShaderResourceView*();
|
||||
|
|
|
@ -601,22 +601,6 @@ void GSTexture12::GenerateMipmap()
|
|||
SetUseFenceCounter(GSDevice12::GetInstance()->GetCurrentFenceValue());
|
||||
}
|
||||
|
||||
void GSTexture12::Swap(GSTexture* tex)
|
||||
{
|
||||
GSTexture::Swap(tex);
|
||||
std::swap(m_resource, static_cast<GSTexture12*>(tex)->m_resource);
|
||||
std::swap(m_allocation, static_cast<GSTexture12*>(tex)->m_allocation);
|
||||
std::swap(m_srv_descriptor, static_cast<GSTexture12*>(tex)->m_srv_descriptor);
|
||||
std::swap(m_write_descriptor, static_cast<GSTexture12*>(tex)->m_write_descriptor);
|
||||
std::swap(m_write_descriptor_type, static_cast<GSTexture12*>(tex)->m_write_descriptor_type);
|
||||
std::swap(m_dxgi_format, static_cast<GSTexture12*>(tex)->m_dxgi_format);
|
||||
std::swap(m_resource_state, static_cast<GSTexture12*>(tex)->m_resource_state);
|
||||
std::swap(m_use_fence_counter, static_cast<GSTexture12*>(tex)->m_use_fence_counter);
|
||||
std::swap(m_clear_value, static_cast<GSTexture12*>(tex)->m_clear_value);
|
||||
std::swap(m_map_level, static_cast<GSTexture12*>(tex)->m_map_level);
|
||||
std::swap(m_map_area, static_cast<GSTexture12*>(tex)->m_map_area);
|
||||
}
|
||||
|
||||
void GSTexture12::TransitionToState(D3D12_RESOURCE_STATES state)
|
||||
{
|
||||
TransitionToState(GSDevice12::GetInstance()->GetCommandList(), state);
|
||||
|
|
|
@ -41,7 +41,6 @@ public:
|
|||
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) override;
|
||||
void Unmap() override;
|
||||
void GenerateMipmap() override;
|
||||
void Swap(GSTexture* tex) override;
|
||||
|
||||
void TransitionToState(D3D12_RESOURCE_STATES state);
|
||||
void CommitClear();
|
||||
|
|
|
@ -6261,8 +6261,8 @@ void GSTextureCache::InjectHashCacheTexture(const HashCacheKey& key, GSTexture*
|
|||
m_hash_cache_replacement_memory_usage -= it->second.texture->GetMemUsage();
|
||||
|
||||
it->second.is_replacement = true;
|
||||
it->second.texture->Swap(tex);
|
||||
g_gs_device->Recycle(tex);
|
||||
g_gs_device->Recycle(it->second.texture);
|
||||
it->second.texture = tex;
|
||||
}
|
||||
|
||||
// GSTextureCache::Palette
|
||||
|
|
|
@ -39,7 +39,6 @@ public:
|
|||
void* MapWithPitch(const GSVector4i& r, int pitch, int layer);
|
||||
void Unmap() override;
|
||||
void GenerateMipmap() override;
|
||||
void Swap(GSTexture* tex) override;
|
||||
id<MTLTexture> GetTexture() { return m_texture; }
|
||||
};
|
||||
|
||||
|
|
|
@ -128,18 +128,6 @@ void GSTextureMTL::GenerateMipmap()
|
|||
}
|
||||
}}
|
||||
|
||||
void GSTextureMTL::Swap(GSTexture* other)
|
||||
{
|
||||
GSTexture::Swap(other);
|
||||
|
||||
GSTextureMTL* mtex = static_cast<GSTextureMTL*>(other);
|
||||
pxAssert(m_dev == mtex->m_dev);
|
||||
#define SWAP(x) std::swap(x, mtex->x)
|
||||
SWAP(m_texture);
|
||||
SWAP(m_has_mipmaps);
|
||||
#undef SWAP
|
||||
}
|
||||
|
||||
GSDownloadTextureMTL::GSDownloadTextureMTL(GSDeviceMTL* dev, MRCOwned<id<MTLBuffer>> buffer,
|
||||
u32 width, u32 height, GSTexture::Format format)
|
||||
: GSDownloadTexture(width, height, format)
|
||||
|
|
|
@ -316,21 +316,6 @@ void GSTextureOGL::GenerateMipmap()
|
|||
glGenerateTextureMipmap(m_texture_id);
|
||||
}
|
||||
|
||||
void GSTextureOGL::Swap(GSTexture* tex)
|
||||
{
|
||||
GSTexture::Swap(tex);
|
||||
|
||||
std::swap(m_texture_id, static_cast<GSTextureOGL*>(tex)->m_texture_id);
|
||||
std::swap(m_r_x, static_cast<GSTextureOGL*>(tex)->m_r_x);
|
||||
std::swap(m_r_x, static_cast<GSTextureOGL*>(tex)->m_r_y);
|
||||
std::swap(m_r_w, static_cast<GSTextureOGL*>(tex)->m_r_w);
|
||||
std::swap(m_r_h, static_cast<GSTextureOGL*>(tex)->m_r_h);
|
||||
std::swap(m_layer, static_cast<GSTextureOGL*>(tex)->m_layer);
|
||||
std::swap(m_int_format, static_cast<GSTextureOGL*>(tex)->m_int_format);
|
||||
std::swap(m_int_type, static_cast<GSTextureOGL*>(tex)->m_int_type);
|
||||
std::swap(m_int_shift, static_cast<GSTextureOGL*>(tex)->m_int_shift);
|
||||
}
|
||||
|
||||
GSDownloadTextureOGL::GSDownloadTextureOGL(u32 width, u32 height, GSTexture::Format format)
|
||||
: GSDownloadTexture(width, height, format)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,6 @@ public:
|
|||
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) final;
|
||||
void Unmap() final;
|
||||
void GenerateMipmap() final;
|
||||
void Swap(GSTexture* tex) final;
|
||||
|
||||
bool IsIntegerFormat() const
|
||||
{
|
||||
|
|
|
@ -82,11 +82,3 @@ bool GSTextureSW::Save(const std::string& fn)
|
|||
int compression = GSConfig.PNGCompressionLevel;
|
||||
return GSPng::Save(fmt, fn, static_cast<u8*>(m_data), m_size.x, m_size.y, m_pitch, compression);
|
||||
}
|
||||
|
||||
void GSTextureSW::Swap(GSTexture* tex)
|
||||
{
|
||||
GSTexture::Swap(tex);
|
||||
std::swap(m_pitch, static_cast<GSTextureSW*>(tex)->m_pitch);
|
||||
std::swap(m_data, static_cast<GSTextureSW*>(tex)->m_data);
|
||||
// std::swap(m_mapped, static_cast<GSTextureSW*>(tex)->m_mapped);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,5 @@ public:
|
|||
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) override;
|
||||
void Unmap() override;
|
||||
bool Save(const std::string& fn) override;
|
||||
void Swap(GSTexture* tex) override;
|
||||
void* GetNativeHandle() const override;
|
||||
};
|
||||
|
|
|
@ -517,21 +517,6 @@ void GSTextureVK::GenerateMipmap()
|
|||
}
|
||||
}
|
||||
|
||||
void GSTextureVK::Swap(GSTexture* tex)
|
||||
{
|
||||
GSTexture::Swap(tex);
|
||||
std::swap(m_image, static_cast<GSTextureVK*>(tex)->m_image);
|
||||
std::swap(m_allocation, static_cast<GSTextureVK*>(tex)->m_allocation);
|
||||
std::swap(m_view, static_cast<GSTextureVK*>(tex)->m_view);
|
||||
std::swap(m_vk_format, static_cast<GSTextureVK*>(tex)->m_vk_format);
|
||||
std::swap(m_layout, static_cast<GSTextureVK*>(tex)->m_layout);
|
||||
std::swap(m_use_fence_counter, static_cast<GSTextureVK*>(tex)->m_use_fence_counter);
|
||||
std::swap(m_clear_value, static_cast<GSTextureVK*>(tex)->m_clear_value);
|
||||
std::swap(m_map_area, static_cast<GSTextureVK*>(tex)->m_map_area);
|
||||
std::swap(m_map_level, static_cast<GSTextureVK*>(tex)->m_map_level);
|
||||
std::swap(m_framebuffers, static_cast<GSTextureVK*>(tex)->m_framebuffers);
|
||||
}
|
||||
|
||||
void GSTextureVK::CommitClear()
|
||||
{
|
||||
if (m_state != GSTexture::State::Cleared)
|
||||
|
|
|
@ -52,7 +52,6 @@ public:
|
|||
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) override;
|
||||
void Unmap() override;
|
||||
void GenerateMipmap() override;
|
||||
void Swap(GSTexture* tex) override;
|
||||
|
||||
void TransitionToLayout(Layout layout);
|
||||
void CommitClear();
|
||||
|
|
Loading…
Reference in New Issue