diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-18 02:12:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-18 12:21:50 +0300 |
commit | 97d7980671ab621bfee994c0acf410ee2012ddcd (patch) | |
tree | a76c630416d876eaf6f380d9fdca5c3b653bed17 /src/graphicsmanager.cpp | |
parent | d119e4425f418afe1198839a57e7b186d717d587 (diff) | |
download | manaverse-97d7980671ab621bfee994c0acf410ee2012ddcd.tar.gz manaverse-97d7980671ab621bfee994c0acf410ee2012ddcd.tar.bz2 manaverse-97d7980671ab621bfee994c0acf410ee2012ddcd.tar.xz manaverse-97d7980671ab621bfee994c0acf410ee2012ddcd.zip |
Add bptc texture compression support.
Add workaround for MESA for using bptc.
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r-- | src/graphicsmanager.cpp | 88 |
1 files changed, 50 insertions, 38 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index e531a90af..860015c5c 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -658,49 +658,61 @@ void GraphicsManager::updateTextureFormat() const if (compressionFormat) { - if (supportExtension("GL_EXT_texture_compression_s3tc") - || supportExtension("3DFX_texture_compression_FXT1")) + for (int f = 0; f < num; f ++) { - for (int f = 0; f < num; f ++) + switch (formats[f]) { - if (formats[f] == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT - && compressionFormat == 1) - { - delete []formats; - OpenGLImageHelper::setInternalTextureType( - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); - logger->log1("using s3tc texture compression"); - return; - } - else if (formats[f] == GL_COMPRESSED_RGBA_FXT1_3DFX - && compressionFormat == 2) - { - delete []formats; - OpenGLImageHelper::setInternalTextureType( - GL_COMPRESSED_RGBA_FXT1_3DFX); - logger->log1("using fxt1 texture compression"); - return; - } - } - delete []formats; - if (compressionFormat == 3) - { - OpenGLImageHelper::setInternalTextureType( - GL_COMPRESSED_RGBA_ARB); - logger->log1("using ARB texture compression"); - return; + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + if (compressionFormat == 1) + { + delete []formats; + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); + logger->log1("using s3tc texture compression"); + return; + } + break; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + if (compressionFormat == 2) + { + delete []formats; + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_FXT1_3DFX); + logger->log1("using fxt1 texture compression"); + return; + } + break; + case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB: + if (compressionFormat == 4) + { + delete []formats; + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_BPTC_UNORM_ARB); + logger->log1("using bptc texture compression"); + return; + } + break; + default: + break; } } - else + delete []formats; + if (compressionFormat == 3) { - if (compressionFormat == 3) - { - delete []formats; - OpenGLImageHelper::setInternalTextureType( - GL_COMPRESSED_RGBA_ARB); - logger->log1("using ARB texture compression"); - return; - } + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_ARB); + logger->log1("using ARB texture compression"); + return; + } + + // workaround for MESA bptc compression detection + if (compressionFormat == 4 + && supportExtension("GL_ARB_texture_compression_bptc")) + { + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_BPTC_UNORM_ARB); + logger->log1("using bptc texture compression"); + return; } } } |