From 2cdc93f4ab690279df064832d4c9688741556f0c Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 22 Apr 2017 23:44:34 -0500 Subject: Video Backends: Split texture cache code out into separate files, introduce 'AbstractTexture' --- Source/Core/VideoCommon/AbstractTexture.cpp | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Source/Core/VideoCommon/AbstractTexture.cpp (limited to 'Source/Core/VideoCommon/AbstractTexture.cpp') 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 + +#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(std::max(1u, row_length / 4)) * 8; + case HostTextureFormat::DXT3: + case HostTextureFormat::DXT5: + return static_cast(std::max(1u, row_length / 4)) * 16; + case HostTextureFormat::RGBA8: + default: + return static_cast(row_length) * 4; + } +} + +const TextureConfig AbstractTexture::GetConfig() const +{ + return m_config; +} -- cgit v1.2.3 From e4896d39bd927b0b8e109e0334fa15cdb8e004f3 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 12 Jun 2017 12:37:28 -0500 Subject: Video Backends: Move and rename HostTextureFormat to AbstractTextureFormat --- Source/Core/VideoCommon/AbstractTexture.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Source/Core/VideoCommon/AbstractTexture.cpp') diff --git a/Source/Core/VideoCommon/AbstractTexture.cpp b/Source/Core/VideoCommon/AbstractTexture.cpp index 53cf84ae0d..1b6fac8bff 100644 --- a/Source/Core/VideoCommon/AbstractTexture.cpp +++ b/Source/Core/VideoCommon/AbstractTexture.cpp @@ -17,22 +17,22 @@ bool AbstractTexture::Save(const std::string& filename, unsigned int level) return false; } -bool AbstractTexture::IsCompressedHostTextureFormat(HostTextureFormat format) +bool AbstractTexture::IsCompressedHostTextureFormat(AbstractTextureFormat format) { // This will need to be changed if we add any other uncompressed formats. - return format != HostTextureFormat::RGBA8; + return format != AbstractTextureFormat::RGBA8; } -size_t AbstractTexture::CalculateHostTextureLevelPitch(HostTextureFormat format, u32 row_length) +size_t AbstractTexture::CalculateHostTextureLevelPitch(AbstractTextureFormat format, u32 row_length) { switch (format) { - case HostTextureFormat::DXT1: + case AbstractTextureFormat::DXT1: return static_cast(std::max(1u, row_length / 4)) * 8; - case HostTextureFormat::DXT3: - case HostTextureFormat::DXT5: + case AbstractTextureFormat::DXT3: + case AbstractTextureFormat::DXT5: return static_cast(std::max(1u, row_length / 4)) * 16; - case HostTextureFormat::RGBA8: + case AbstractTextureFormat::RGBA8: default: return static_cast(row_length) * 4; } -- cgit v1.2.3