summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/AbstractTexture.cpp
diff options
context:
space:
mode:
authorFiloppi <filippotarpini@hotmail.it>2023-06-08 03:17:20 +0300
committerFiloppi <filippotarpini@hotmail.it>2023-06-08 03:17:20 +0300
commitcdc53c046b47e8aaef70637dfdc8dffc22b5e4ac (patch)
tree7da2d93aed8fe255ff13edb632599676bce590b7 /Source/Core/VideoCommon/AbstractTexture.cpp
parent6743ca8e098268e7a11f26d626a15a09bd342577 (diff)
Video: add R10B10G10A2 and R16G16B16A16F texture types (needed by PR 11850)
Diffstat (limited to 'Source/Core/VideoCommon/AbstractTexture.cpp')
-rw-r--r--Source/Core/VideoCommon/AbstractTexture.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/AbstractTexture.cpp b/Source/Core/VideoCommon/AbstractTexture.cpp
index 03b83b21cc..8c269b2101 100644
--- a/Source/Core/VideoCommon/AbstractTexture.cpp
+++ b/Source/Core/VideoCommon/AbstractTexture.cpp
@@ -26,6 +26,9 @@ bool AbstractTexture::Save(const std::string& filename, unsigned int level)
// anyway, so this is fine for now.
ASSERT(!IsCompressedFormat(m_config.format));
ASSERT(level < m_config.levels);
+ // We can't copy from float (HDR) textures to RGBA8
+ // (most other formats would probably fail as well)
+ ASSERT(m_config.format != AbstractTextureFormat::RGBA16F);
// Determine dimensions of image we want to save.
u32 level_width = std::max(1u, m_config.width >> level);
@@ -120,11 +123,13 @@ u32 AbstractTexture::CalculateStrideForFormat(AbstractTextureFormat format, u32
return static_cast<size_t>(row_length) * 2;
case AbstractTextureFormat::RGBA8:
case AbstractTextureFormat::BGRA8:
+ case AbstractTextureFormat::RGB10_A2:
case AbstractTextureFormat::R32F:
case AbstractTextureFormat::D32F:
case AbstractTextureFormat::D24_S8:
return static_cast<size_t>(row_length) * 4;
case AbstractTextureFormat::D32F_S8:
+ case AbstractTextureFormat::RGBA16F:
return static_cast<size_t>(row_length) * 8;
default:
PanicAlertFmt("Unhandled texture format.");
@@ -147,11 +152,13 @@ u32 AbstractTexture::GetTexelSizeForFormat(AbstractTextureFormat format)
return 2;
case AbstractTextureFormat::RGBA8:
case AbstractTextureFormat::BGRA8:
+ case AbstractTextureFormat::RGB10_A2:
case AbstractTextureFormat::D24_S8:
case AbstractTextureFormat::R32F:
case AbstractTextureFormat::D32F:
return 4;
case AbstractTextureFormat::D32F_S8:
+ case AbstractTextureFormat::RGBA16F:
return 8;
default:
PanicAlertFmt("Unhandled texture format.");