summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/DXTexture.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-11-19 17:46:00 +1000
committerStenzek <stenzek@gmail.com>2017-11-22 18:49:33 +1000
commitdb1d9de933a914ff0c35a179d3ba1112fb0bcab1 (patch)
treee1f7be8dc4d4b8f48f50a82ad81ad7f95076ea66 /Source/Core/VideoBackends/D3D/DXTexture.cpp
parent193763ca3ab62086c5a2f09870ffdc84cbd8ee00 (diff)
AbstractTexture: Drop slow map readback path
Diffstat (limited to 'Source/Core/VideoBackends/D3D/DXTexture.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/DXTexture.cpp69
1 files changed, 0 insertions, 69 deletions
diff --git a/Source/Core/VideoBackends/D3D/DXTexture.cpp b/Source/Core/VideoBackends/D3D/DXTexture.cpp
index 722db73a5f..2c37c61ffe 100644
--- a/Source/Core/VideoBackends/D3D/DXTexture.cpp
+++ b/Source/Core/VideoBackends/D3D/DXTexture.cpp
@@ -84,7 +84,6 @@ DXTexture::DXTexture(const TextureConfig& tex_config) : AbstractTexture(tex_conf
DXTexture::~DXTexture()
{
m_texture->Release();
- SAFE_RELEASE(m_staging_texture);
}
D3DTexture2D* DXTexture::GetRawTexIdentifier() const
@@ -97,74 +96,6 @@ void DXTexture::Bind(unsigned int stage)
D3D::stateman->SetTexture(stage, m_texture->GetSRV());
}
-std::optional<AbstractTexture::RawTextureInfo> DXTexture::MapFullImpl()
-{
- CD3D11_TEXTURE2D_DESC staging_texture_desc(DXGI_FORMAT_R8G8B8A8_UNORM, m_config.width,
- m_config.height, 1, 1, 0, D3D11_USAGE_STAGING,
- D3D11_CPU_ACCESS_READ);
-
- HRESULT hr = D3D::device->CreateTexture2D(&staging_texture_desc, nullptr, &m_staging_texture);
- if (FAILED(hr))
- {
- WARN_LOG(VIDEO, "Failed to create texture dumping readback texture: %X", static_cast<u32>(hr));
- return {};
- }
-
- // Copy the selected data to the staging texture
- D3D::context->CopyResource(m_staging_texture, m_texture->GetTex());
-
- // Map the staging texture to client memory, and encode it as a .png image.
- D3D11_MAPPED_SUBRESOURCE map;
- hr = D3D::context->Map(m_staging_texture, 0, D3D11_MAP_READ, 0, &map);
- if (FAILED(hr))
- {
- WARN_LOG(VIDEO, "Failed to map texture dumping readback texture: %X", static_cast<u32>(hr));
- return {};
- }
-
- return AbstractTexture::RawTextureInfo{reinterpret_cast<u8*>(map.pData), map.RowPitch,
- m_config.width, m_config.height};
-}
-
-std::optional<AbstractTexture::RawTextureInfo> DXTexture::MapRegionImpl(u32 level, u32 x, u32 y,
- u32 width, u32 height)
-{
- CD3D11_TEXTURE2D_DESC staging_texture_desc(DXGI_FORMAT_R8G8B8A8_UNORM, width, height, 1, 1, 0,
- D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ);
-
- HRESULT hr = D3D::device->CreateTexture2D(&staging_texture_desc, nullptr, &m_staging_texture);
- if (FAILED(hr))
- {
- WARN_LOG(VIDEO, "Failed to create texture dumping readback texture: %X", static_cast<u32>(hr));
- return {};
- }
-
- // Copy the selected data to the staging texture
- CD3D11_BOX src_box(x, y, 0, width, height, 1);
- D3D::context->CopySubresourceRegion(m_staging_texture, 0, 0, 0, 0, m_texture->GetTex(),
- D3D11CalcSubresource(level, 0, m_config.levels), &src_box);
-
- // Map the staging texture to client memory, and encode it as a .png image.
- D3D11_MAPPED_SUBRESOURCE map;
- hr = D3D::context->Map(m_staging_texture, 0, D3D11_MAP_READ, 0, &map);
- if (FAILED(hr))
- {
- WARN_LOG(VIDEO, "Failed to map texture dumping readback texture: %X", static_cast<u32>(hr));
- return {};
- }
-
- return AbstractTexture::RawTextureInfo{reinterpret_cast<u8*>(map.pData), map.RowPitch,
- m_config.width, m_config.height};
-}
-
-void DXTexture::Unmap()
-{
- if (!m_staging_texture)
- return;
-
- D3D::context->Unmap(m_staging_texture, 0);
-}
-
void DXTexture::CopyRectangleFromTexture(const AbstractTexture* src,
const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
u32 src_level, const MathUtil::Rectangle<int>& dst_rect,