Merge pull request #5834 from stenzek/bc7

Support loading BC7 (BPTC) textures from DDS files
This commit is contained in:
Stenzek
2017-08-01 12:39:20 +10:00
committed by GitHub
19 changed files with 78 additions and 2 deletions

View File

@ -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:

View File

@ -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.

View File

@ -15,7 +15,8 @@ enum class AbstractTextureFormat : u32
RGBA8,
DXT1,
DXT3,
DXT5
DXT5,
BPTC
};
struct TextureConfig

View File

@ -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;

View File

@ -232,6 +232,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