diff --git a/CMakeLists.txt b/CMakeLists.txt index 431d35273..904fd5579 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,12 +216,12 @@ if (BUILD_RECORDER) endif() endif() -if(NOT SERVER_ONLY AND NOT USE_GLES2) +if(NOT SERVER_ONLY) add_subdirectory("${PROJECT_SOURCE_DIR}/lib/graphics_utils") include_directories("${PROJECT_SOURCE_DIR}/lib/graphics_utils") endif() -if(NOT SERVER_ONLY AND NOT USE_GLES2) +if(NOT SERVER_ONLY) find_library(SQUISH_LIBRARY NAMES squish libsquish) find_path(SQUISH_INCLUDEDIR NAMES squish.h PATHS) if (NOT SQUISH_LIBRARY OR NOT SQUISH_INCLUDEDIR) @@ -479,14 +479,12 @@ target_link_libraries(supertuxkart if(NOT SERVER_ONLY) if(NOT USE_GLES2) - target_link_libraries(supertuxkart ${OPENGL_gl_LIBRARY} ${GLEW_LIBRARIES} graphics_utils) + target_link_libraries(supertuxkart ${OPENGL_gl_LIBRARY} ${GLEW_LIBRARIES}) else() target_link_libraries(supertuxkart GLESv2) endif() -endif() -if(NOT SERVER_ONLY AND NOT USE_GLES2) - target_link_libraries(supertuxkart ${SQUISH_LIBRARY}) + target_link_libraries(supertuxkart ${SQUISH_LIBRARY} graphics_utils) endif() if(UNIX AND NOT APPLE) diff --git a/data/graphical_restrictions.xml b/data/graphical_restrictions.xml index 3b512b177..46b632a0c 100644 --- a/data/graphical_restrictions.xml +++ b/data/graphical_restrictions.xml @@ -33,6 +33,7 @@ + diff --git a/src/graphics/central_settings.cpp b/src/graphics/central_settings.cpp index 3b851c42f..c910ce8f7 100644 --- a/src/graphics/central_settings.cpp +++ b/src/graphics/central_settings.cpp @@ -232,6 +232,13 @@ void CentralVideoSettings::init() hasColorBufferFloat = true; Log::info("GLDriver", "EXT Color Buffer Float Present"); } + + if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_EXT_TEXTURE_COMPRESSION_S3TC) && + hasGLExtension("GL_EXT_texture_compression_s3tc")) + { + hasTextureCompression = true; + Log::info("GLDriver", "EXT Texture Compression S3TC Present"); + } if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_VERTEX_ID_WORKING)) { diff --git a/src/graphics/sp/sp_texture.cpp b/src/graphics/sp/sp_texture.cpp index 9364d0ae1..8c7957069 100644 --- a/src/graphics/sp/sp_texture.cpp +++ b/src/graphics/sp/sp_texture.cpp @@ -29,14 +29,14 @@ #include "utils/log.hpp" #include "utils/string_utils.hpp" -#if !(defined(SERVER_ONLY) || defined(USE_GLES2)) +#if !(defined(SERVER_ONLY) || defined(ANDROID)) #include static_assert(squish::kColourClusterFit == (1 << 5), "Wrong header"); static_assert(squish::kColourRangeFit == (1 << 6), "Wrong header"); static_assert(squish::kColourIterativeClusterFit == (1 << 8), "Wrong header"); #endif -#if !(defined(SERVER_ONLY) || defined(USE_GLES2)) +#if !(defined(SERVER_ONLY) || defined(ANDROID)) extern "C" { #include @@ -46,7 +46,7 @@ extern "C" #include -#if !defined(USE_GLES2) +#if !defined(ANDROID) static const uint8_t CACHE_VERSION = 1; #endif @@ -221,7 +221,7 @@ bool SPTexture::compressedTexImage2d(std::shared_ptr texture, >& mipmap_sizes) { -#if !defined(SERVER_ONLY) && !defined(USE_GLES2) +#if !defined(SERVER_ONLY) && !defined(ANDROID) unsigned format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; if (m_undo_srgb) { @@ -319,7 +319,7 @@ bool SPTexture::saveCompressedTexture(std::shared_ptr texture, >& sizes, const std::string& cache_location) { -#if !(defined(SERVER_ONLY) || defined(USE_GLES2)) +#if !defined(SERVER_ONLY) && !defined(ANDROID) const unsigned total_size = std::accumulate(sizes.begin(), sizes.end(), 0, [] (const unsigned int previous, const std::pair & cur_sizes) @@ -384,7 +384,7 @@ std::shared_ptr SPTexture::getTextureCache(const std::string& p, std::vector >* sizes) { std::shared_ptr cache; -#if !(defined(SERVER_ONLY) || defined(USE_GLES2)) +#if !(defined(SERVER_ONLY) || defined(ANDROID)) io::IReadFile* file = irr::io::createReadFile(p.c_str()); if (file == NULL) { @@ -474,7 +474,7 @@ bool SPTexture::threadedLoad() } else { -#ifndef USE_GLES2 +#ifndef ANDROID if (UserConfigParams::m_hq_mipmap && image->getDimension().Width > 1 && image->getDimension().Height > 1) { @@ -672,7 +672,7 @@ void SPTexture::generateHQMipmap(void* in, >& mms, uint8_t* out) { -#if !(defined(SERVER_ONLY) || defined(USE_GLES2)) +#if !(defined(SERVER_ONLY) || defined(ANDROID)) imMipmapCascade cascade; imReduceOptions options; imReduceSetOptions(&options, @@ -704,7 +704,7 @@ void SPTexture::generateHQMipmap(void* in, void SPTexture::squishCompressImage(uint8_t* rgba, int width, int height, int pitch, void* blocks, unsigned flags) { -#if !(defined(SERVER_ONLY) || defined(USE_GLES2)) +#if !(defined(SERVER_ONLY) || defined(ANDROID)) // This function is copied from CompressImage in libsquish to avoid omp // if enabled by shared libsquish, because we are already using // multiple thread @@ -754,7 +754,7 @@ std::vector > { std::vector > mipmap_sizes; -#if !(defined(SERVER_ONLY) || defined(USE_GLES2)) +#if !(defined(SERVER_ONLY) || defined(ANDROID)) unsigned width = image->getDimension().Width; unsigned height = image->getDimension().Height; mipmap_sizes.emplace_back(core::dimension2du(width, height), 0);