diff options
| author | Stenzek <stenzek@gmail.com> | 2017-04-29 00:53:32 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-04-29 13:46:43 +1000 |
| commit | cc851c41c11bdc1c192003021df6dc3c2d2b74fb (patch) | |
| tree | 35df546c2be195f456b8c85993c4549cdd176796 /Source/Core/VideoBackends/Vulkan | |
| parent | de348fc9527f640435d57676a60317a96d217dd8 (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/Vulkan')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/TextureCache.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/Util.cpp | 26 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/Util.h | 2 |
3 files changed, 1 insertions, 29 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/TextureCache.cpp b/Source/Core/VideoBackends/Vulkan/TextureCache.cpp index fad7e789cd..67faf980ea 100644 --- a/Source/Core/VideoBackends/Vulkan/TextureCache.cpp +++ b/Source/Core/VideoBackends/Vulkan/TextureCache.cpp @@ -373,7 +373,7 @@ void TextureCache::TCacheEntry::Load(u32 level, u32 width, u32 height, u32 row_l u32 upload_alignment = static_cast<u32>(g_vulkan_context->GetBufferImageGranularity()); u32 block_size = Util::GetBlockSize(m_texture->GetFormat()); u32 num_rows = Common::AlignUp(height, block_size) / block_size; - size_t source_pitch = Util::GetPitchForTexture(m_texture->GetFormat(), row_length); + size_t source_pitch = CalculateHostTextureLevelPitch(config.format, row_length); size_t upload_size = source_pitch * num_rows; std::unique_ptr<StagingBuffer> temp_buffer; VkBuffer upload_buffer; diff --git a/Source/Core/VideoBackends/Vulkan/Util.cpp b/Source/Core/VideoBackends/Vulkan/Util.cpp index a060cf3485..7ce433a79e 100644 --- a/Source/Core/VideoBackends/Vulkan/Util.cpp +++ b/Source/Core/VideoBackends/Vulkan/Util.cpp @@ -151,32 +151,6 @@ u32 GetBlockSize(VkFormat format) } } - -size_t GetPitchForTexture(VkFormat format, u32 row_length) -{ - switch (format) - { - case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: - return static_cast<size_t>(std::max(1u, row_length / 4)) * 8; - - case VK_FORMAT_BC2_UNORM_BLOCK: - return static_cast<size_t>(std::max(1u, row_length / 4)) * 16; - - case VK_FORMAT_BC3_UNORM_BLOCK: - return static_cast<size_t>(std::max(1u, row_length / 4)) * 16; - - case VK_FORMAT_R8G8B8A8_UNORM: - case VK_FORMAT_B8G8R8A8_UNORM: - case VK_FORMAT_R32_SFLOAT: - case VK_FORMAT_D32_SFLOAT: - return static_cast<size_t>(row_length) * 4; - - default: - PanicAlert("Unhandled pixel format"); - return row_length; - } -} - VkRect2D ClampRect2D(const VkRect2D& rect, u32 width, u32 height) { VkRect2D out; diff --git a/Source/Core/VideoBackends/Vulkan/Util.h b/Source/Core/VideoBackends/Vulkan/Util.h index f4596b89f7..85d447cf75 100644 --- a/Source/Core/VideoBackends/Vulkan/Util.h +++ b/Source/Core/VideoBackends/Vulkan/Util.h @@ -31,8 +31,6 @@ VkFormat GetVkFormatForHostTextureFormat(HostTextureFormat format); u32 GetTexelSize(VkFormat format); u32 GetBlockSize(VkFormat format); -size_t GetPitchForTexture(VkFormat format, u32 row_length); - // Clamps a VkRect2D to the specified dimensions. VkRect2D ClampRect2D(const VkRect2D& rect, u32 width, u32 height); |
