summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-07-27 22:00:04 +1000
committerStenzek <stenzek@gmail.com>2017-08-01 11:59:38 +1000
commit63305e917328d0ce9f3db6def51eaa67f23880ec (patch)
treecc49e54e98061cf855c52ad62406c3bf062db6da /Source/Core/VideoCommon
parentd18988f41e6d3fdda7ce51da7de4747b69a06a6c (diff)
HiresTextures: Support loading BC7 (BPTC) from DDS files
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/AbstractTexture.cpp1
-rw-r--r--Source/Core/VideoCommon/HiresTextures_DDSLoader.cpp8
-rw-r--r--Source/Core/VideoCommon/TextureConfig.h3
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp1
-rw-r--r--Source/Core/VideoCommon/VideoConfig.h1
5 files changed, 13 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/AbstractTexture.cpp b/Source/Core/VideoCommon/AbstractTexture.cpp
index b756651640..18f9c72064 100644
--- a/Source/Core/VideoCommon/AbstractTexture.cpp
+++ b/Source/Core/VideoCommon/AbstractTexture.cpp
@@ -31,6 +31,7 @@ size_t AbstractTexture::CalculateHostTextureLevelPitch(AbstractTextureFormat for
return static_cast<size_t>(std::max(1u, row_length / 4)) * 8;
case AbstractTextureFormat::DXT3:
case AbstractTextureFormat::DXT5:
+ case AbstractTextureFormat::BPTC:
return static_cast<size_t>(std::max(1u, row_length / 4)) * 16;
case AbstractTextureFormat::RGBA8:
default:
diff --git a/Source/Core/VideoCommon/HiresTextures_DDSLoader.cpp b/Source/Core/VideoCommon/HiresTextures_DDSLoader.cpp
index 5b9bbeced9..003a59664f 100644
--- a/Source/Core/VideoCommon/HiresTextures_DDSLoader.cpp
+++ b/Source/Core/VideoCommon/HiresTextures_DDSLoader.cpp
@@ -319,6 +319,14 @@ bool ParseDDSHeader(File::IOFile& file, DDSLoadInfo* info)
info->bytes_per_block = 16;
needs_s3tc = true;
}
+ else if (dxt10_format == 98)
+ {
+ info->format = AbstractTextureFormat::BPTC;
+ info->block_size = 4;
+ info->bytes_per_block = 16;
+ if (!g_ActiveConfig.backend_info.bSupportsBPTCTextures)
+ return false;
+ }
else
{
// Leave all remaining formats to SOIL.
diff --git a/Source/Core/VideoCommon/TextureConfig.h b/Source/Core/VideoCommon/TextureConfig.h
index 27a0c935a1..7a9ac08bcc 100644
--- a/Source/Core/VideoCommon/TextureConfig.h
+++ b/Source/Core/VideoCommon/TextureConfig.h
@@ -15,7 +15,8 @@ enum class AbstractTextureFormat : u32
RGBA8,
DXT1,
DXT3,
- DXT5
+ DXT5,
+ BPTC
};
struct TextureConfig
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index c277386f71..e04264ffb9 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -38,6 +38,7 @@ VideoConfig::VideoConfig()
backend_info.bSupportsMultithreading = false;
backend_info.bSupportsInternalResolutionFrameDumps = false;
backend_info.bSupportsST3CTextures = false;
+ backend_info.bSupportsBPTCTextures = false;
bEnableValidationLayer = false;
bBackendMultithreading = true;
diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h
index f876e63802..678b1eed55 100644
--- a/Source/Core/VideoCommon/VideoConfig.h
+++ b/Source/Core/VideoCommon/VideoConfig.h
@@ -236,6 +236,7 @@ struct VideoConfig final
bool bSupportsST3CTextures;
bool bSupportsBitfield; // Needed by UberShaders, so must stay in VideoCommon
bool bSupportsDynamicSamplerIndexing; // Needed by UberShaders, so must stay in VideoCommon
+ bool bSupportsBPTCTextures;
} backend_info;
// Utility