summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/TextureCache.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-04-29 00:53:32 +1000
committerStenzek <stenzek@gmail.com>2017-04-29 13:46:43 +1000
commitcc851c41c11bdc1c192003021df6dc3c2d2b74fb (patch)
tree35df546c2be195f456b8c85993c4549cdd176796 /Source/Core/VideoBackends/D3D/TextureCache.cpp
parentde348fc9527f640435d57676a60317a96d217dd8 (diff)
TextureCache: Move host texture utility functions to VideoCommon
The appropriate place for these would be AbstractTexture, once it is finished.
Diffstat (limited to 'Source/Core/VideoBackends/D3D/TextureCache.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/TextureCache.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/Source/Core/VideoBackends/D3D/TextureCache.cpp b/Source/Core/VideoBackends/D3D/TextureCache.cpp
index 92941477e8..cd737e7201 100644
--- a/Source/Core/VideoBackends/D3D/TextureCache.cpp
+++ b/Source/Core/VideoBackends/D3D/TextureCache.cpp
@@ -30,23 +30,6 @@ static std::unique_ptr<PSTextureEncoder> g_encoder;
const size_t MAX_COPY_BUFFERS = 32;
ID3D11Buffer* efbcopycbuf[MAX_COPY_BUFFERS] = {0};
-static u32 GetLevelPitch(HostTextureFormat format, u32 row_length)
-{
- switch (format)
- {
- case HostTextureFormat::DXT1:
- return row_length / 4 * 8;
-
- case HostTextureFormat::DXT3:
- case HostTextureFormat::DXT5:
- return row_length / 4 * 16;
-
- case HostTextureFormat::RGBA8:
- default:
- return row_length * 4;
- }
-}
-
static DXGI_FORMAT GetDXGIFormatForHostFormat(HostTextureFormat format)
{
switch (format)
@@ -174,8 +157,9 @@ void TextureCache::TCacheEntry::CopyRectangleFromTexture(const TCacheEntryBase*
void TextureCache::TCacheEntry::Load(u32 level, u32 width, u32 height, u32 row_length,
const u8* buffer, size_t buffer_size)
{
- u32 src_pitch = GetLevelPitch(config.format, row_length);
- D3D::context->UpdateSubresource(texture->GetTex(), level, nullptr, buffer, src_pitch, 0);
+ size_t src_pitch = CalculateHostTextureLevelPitch(config.format, row_length);
+ D3D::context->UpdateSubresource(texture->GetTex(), level, nullptr, buffer,
+ static_cast<UINT>(src_pitch), 0);
}
TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntryConfig& config)