summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/AbstractTexture.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2017-04-22 23:44:34 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2017-06-13 00:41:51 -0500
commit2cdc93f4ab690279df064832d4c9688741556f0c (patch)
treedbbb654faab47eda473e3f3d617989b82ee5d3ff /Source/Core/VideoCommon/AbstractTexture.cpp
parent77c0539b5ed87ddfdb0d0c53e8db0172254ac13e (diff)
Video Backends: Split texture cache code out into separate files, introduce 'AbstractTexture'
Diffstat (limited to 'Source/Core/VideoCommon/AbstractTexture.cpp')
-rw-r--r--Source/Core/VideoCommon/AbstractTexture.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/AbstractTexture.cpp b/Source/Core/VideoCommon/AbstractTexture.cpp
new file mode 100644
index 0000000000..53cf84ae0d
--- /dev/null
+++ b/Source/Core/VideoCommon/AbstractTexture.cpp
@@ -0,0 +1,44 @@
+// Copyright 2017 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#include <algorithm>
+
+#include "VideoCommon/AbstractTexture.h"
+
+AbstractTexture::AbstractTexture(const TextureConfig& c) : m_config(c)
+{
+}
+
+AbstractTexture::~AbstractTexture() = default;
+
+bool AbstractTexture::Save(const std::string& filename, unsigned int level)
+{
+ return false;
+}
+
+bool AbstractTexture::IsCompressedHostTextureFormat(HostTextureFormat format)
+{
+ // This will need to be changed if we add any other uncompressed formats.
+ return format != HostTextureFormat::RGBA8;
+}
+
+size_t AbstractTexture::CalculateHostTextureLevelPitch(HostTextureFormat format, u32 row_length)
+{
+ switch (format)
+ {
+ case HostTextureFormat::DXT1:
+ return static_cast<size_t>(std::max(1u, row_length / 4)) * 8;
+ case HostTextureFormat::DXT3:
+ case HostTextureFormat::DXT5:
+ return static_cast<size_t>(std::max(1u, row_length / 4)) * 16;
+ case HostTextureFormat::RGBA8:
+ default:
+ return static_cast<size_t>(row_length) * 4;
+ }
+}
+
+const TextureConfig AbstractTexture::GetConfig() const
+{
+ return m_config;
+}