diff options
| author | Stenzek <stenzek@gmail.com> | 2017-09-09 15:24:41 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-11-22 18:47:04 +1000 |
| commit | a584ccc7d882213d93586cae9063d9865311aaad (patch) | |
| tree | 114280e3abe44473c3c502bfa0d13a24b3bd4bb7 /Source/Core/VideoCommon/AbstractTexture.cpp | |
| parent | 49a9c33bd75df2b8cebd58eab10f140c79a8f65c (diff) | |
AbstractTexture: Support BGRA8 formats
Used for some driver's swap chains, and EFB to RAM.
Diffstat (limited to 'Source/Core/VideoCommon/AbstractTexture.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/AbstractTexture.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/AbstractTexture.cpp b/Source/Core/VideoCommon/AbstractTexture.cpp index 7e4f493601..9fa099e602 100644 --- a/Source/Core/VideoCommon/AbstractTexture.cpp +++ b/Source/Core/VideoCommon/AbstractTexture.cpp @@ -5,7 +5,7 @@ #include <algorithm> #include "Common/Assert.h" - +#include "Common/MsgHandler.h" #include "VideoCommon/AbstractTexture.h" #include "VideoCommon/ImageWrite.h" @@ -102,8 +102,17 @@ AbstractTexture::MapRegionImpl(u32 level, u32 x, u32 y, u32 width, u32 height) bool AbstractTexture::IsCompressedHostTextureFormat(AbstractTextureFormat format) { - // This will need to be changed if we add any other uncompressed formats. - return format != AbstractTextureFormat::RGBA8; + switch (format) + { + case AbstractTextureFormat::DXT1: + case AbstractTextureFormat::DXT3: + case AbstractTextureFormat::DXT5: + case AbstractTextureFormat::BPTC: + return true; + + default: + return false; + } } size_t AbstractTexture::CalculateHostTextureLevelPitch(AbstractTextureFormat format, u32 row_length) @@ -117,8 +126,11 @@ size_t AbstractTexture::CalculateHostTextureLevelPitch(AbstractTextureFormat for case AbstractTextureFormat::BPTC: return static_cast<size_t>(std::max(1u, row_length / 4)) * 16; case AbstractTextureFormat::RGBA8: - default: + case AbstractTextureFormat::BGRA8: return static_cast<size_t>(row_length) * 4; + default: + PanicAlert("Unhandled texture format."); + return 0; } } |
