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 | |
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')
-rw-r--r-- | src/graphicsmanager.cpp | 88 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_perfomance.cpp | 5 | ||||
-rw-r--r-- | src/render/mgldefines.h | 4 |
3 files changed, 57 insertions, 40 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; } } } diff --git a/src/gui/widgets/tabs/setup_perfomance.cpp b/src/gui/widgets/tabs/setup_perfomance.cpp index 16f3142a7..247419f7b 100644 --- a/src/gui/widgets/tabs/setup_perfomance.cpp +++ b/src/gui/widgets/tabs/setup_perfomance.cpp @@ -34,7 +34,7 @@ #include "debug.h" -static const int texturesListSize = 4; +static const int texturesListSize = 5; static const char *const texturesList[] = { @@ -42,7 +42,8 @@ static const char *const texturesList[] = N_("No"), "s3tc", "fxt1", - "ARB" + "ARB", + "bptc" }; Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : diff --git a/src/render/mgldefines.h b/src/render/mgldefines.h index 2a063accf..5b3497131 100644 --- a/src/render/mgldefines.h +++ b/src/render/mgldefines.h @@ -120,6 +120,10 @@ #define GLX_CONTEXT_FLAGS_ARB 0x2094 #endif +#ifndef GL_COMPRESSED_RGBA_BPTC_UNORM_ARB +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#endif + #endif // USE_OPENGL #endif // RENDER_MGLDEFINES_H |