summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/AbstractTexture.cpp
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2017-06-18 12:57:05 -0700
committerGitHub <noreply@github.com>2017-06-18 12:57:05 -0700
commite63c33783049753784a24675bfa0792e54684fbd (patch)
tree3d984535025f4cb97489c9665220ac4237e7761c /Source/Core/VideoCommon/AbstractTexture.cpp
parent09457d3a4245ec9d4f2fdac3d1d0873a3354b858 (diff)
parente4896d39bd927b0b8e109e0334fa15cdb8e004f3 (diff)
Merge pull request #5305 from iwubcode/abstract_texture
Abstract Texture
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..1b6fac8bff
--- /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(AbstractTextureFormat format)
+{
+ // This will need to be changed if we add any other uncompressed formats.
+ return format != AbstractTextureFormat::RGBA8;
+}
+
+size_t AbstractTexture::CalculateHostTextureLevelPitch(AbstractTextureFormat format, u32 row_length)
+{
+ switch (format)
+ {
+ case AbstractTextureFormat::DXT1:
+ return static_cast<size_t>(std::max(1u, row_length / 4)) * 8;
+ case AbstractTextureFormat::DXT3:
+ case AbstractTextureFormat::DXT5:
+ return static_cast<size_t>(std::max(1u, row_length / 4)) * 16;
+ case AbstractTextureFormat::RGBA8:
+ default:
+ return static_cast<size_t>(row_length) * 4;
+ }
+}
+
+const TextureConfig AbstractTexture::GetConfig() const
+{
+ return m_config;
+}