From f43d85921dc85ae586d69b21d28a7578835a55bd Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 22 Oct 2017 00:49:40 +1000 Subject: VideoBackends: Add AbstractStagingTexture class Can be used for asynchronous readback or upload of textures. --- Source/Core/VideoCommon/AbstractTexture.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/AbstractTexture.cpp') diff --git a/Source/Core/VideoCommon/AbstractTexture.cpp b/Source/Core/VideoCommon/AbstractTexture.cpp index 9fa099e602..7e09be5344 100644 --- a/Source/Core/VideoCommon/AbstractTexture.cpp +++ b/Source/Core/VideoCommon/AbstractTexture.cpp @@ -100,7 +100,7 @@ AbstractTexture::MapRegionImpl(u32 level, u32 x, u32 y, u32 width, u32 height) return {}; } -bool AbstractTexture::IsCompressedHostTextureFormat(AbstractTextureFormat format) +bool AbstractTexture::IsCompressedFormat(AbstractTextureFormat format) { switch (format) { @@ -115,7 +115,7 @@ bool AbstractTexture::IsCompressedHostTextureFormat(AbstractTextureFormat format } } -size_t AbstractTexture::CalculateHostTextureLevelPitch(AbstractTextureFormat format, u32 row_length) +size_t AbstractTexture::CalculateStrideForFormat(AbstractTextureFormat format, u32 row_length) { switch (format) { @@ -134,6 +134,25 @@ size_t AbstractTexture::CalculateHostTextureLevelPitch(AbstractTextureFormat for } } +size_t AbstractTexture::GetTexelSizeForFormat(AbstractTextureFormat format) +{ + switch (format) + { + case AbstractTextureFormat::DXT1: + return 8; + case AbstractTextureFormat::DXT3: + case AbstractTextureFormat::DXT5: + case AbstractTextureFormat::BPTC: + return 16; + case AbstractTextureFormat::RGBA8: + case AbstractTextureFormat::BGRA8: + return 4; + default: + PanicAlert("Unhandled texture format."); + return 0; + } +} + const TextureConfig& AbstractTexture::GetConfig() const { return m_config; -- cgit v1.2.3