From 6794a0fffb8803f7b963e2753a10b9b8356790ef Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Tue, 19 Nov 2013 12:03:03 -0500 Subject: [PATCH] Add hooks to NVTT bc7_export library if present on the users machine. Assumes that all of the cross platform problems are fixed for incorporation into FasTC... Otherwise the options to use NVTT are ignored. --- BPTCEncoder/CMakeLists.txt | 16 ++ BPTCEncoder/config/BC7Config.h.in | 2 + BPTCEncoder/include/BC7Compressor.h | 8 + BPTCEncoder/src/CompressNVTT.cpp | 207 +++++++++++++++++++++++++ CLTool/src/tc.cpp | 7 +- CMakeLists.txt | 1 + CMakeModules/FindBC7Export.cmake | 71 +++++++++ CMakeModules/bc7_export/CMakeLists.txt | 104 +++++++++++++ Core/include/TexComp.h | 5 + Core/src/TexComp.cpp | 13 +- 10 files changed, 432 insertions(+), 2 deletions(-) create mode 100644 BPTCEncoder/src/CompressNVTT.cpp create mode 100644 CMakeModules/FindBC7Export.cmake create mode 100644 CMakeModules/bc7_export/CMakeLists.txt diff --git a/BPTCEncoder/CMakeLists.txt b/BPTCEncoder/CMakeLists.txt index e841b89..6b1b125 100644 --- a/BPTCEncoder/CMakeLists.txt +++ b/BPTCEncoder/CMakeLists.txt @@ -45,6 +45,11 @@ INCLUDE_DIRECTORIES(${FasTC_SOURCE_DIR}/Base/include) INCLUDE_DIRECTORIES(${FasTC_SOURCE_DIR}/BPTCEncoder/include) INCLUDE_DIRECTORIES(${FasTC_BINARY_DIR}/BPTCEncoder/include) +IF(NOT "" STREQUAL "${AVPCLLIB_ROOT}") + INCLUDE_DIRECTORIES(${AVPCLLIB_INCLUDE_DIR}) + SET(FOUND_NVTT_BC7_EXPORT TRUE) +ENDIF() + INCLUDE(CheckCXXSourceRuns) IF( NOT HAS_INLINE_ASSEMBLY AND NOT HAS_INLINE_ASSEMBLY_WITH_FLAGS ) @@ -145,9 +150,20 @@ IF( HAS_INLINE_ASSEMBLY_WITH_FLAGS ) ENDIF() ENDIF() +IF(NOT "" STREQUAL "${AVPCLLIB_ROOT}") + SET( SOURCES + ${SOURCES} + src/CompressNVTT.cpp + ) +ENDIF() + ADD_LIBRARY( BPTCEncoder ${HEADERS} ${SOURCES} ) TARGET_LINK_LIBRARIES( BPTCEncoder FasTCBase ) + +IF(NOT "" STREQUAL "${AVPCLLIB_ROOT}") + TARGET_LINK_LIBRARIES( BPTCEncoder avpcl ) +ENDIF() diff --git a/BPTCEncoder/config/BC7Config.h.in b/BPTCEncoder/config/BC7Config.h.in index 0bdce7b..5a3ae81 100644 --- a/BPTCEncoder/config/BC7Config.h.in +++ b/BPTCEncoder/config/BC7Config.h.in @@ -52,3 +52,5 @@ #cmakedefine HAS_ATOMICS #cmakedefine HAS_GCC_ATOMICS #cmakedefine HAS_MSVC_ATOMICS + +#cmakedefine FOUND_NVTT_BC7_EXPORT diff --git a/BPTCEncoder/include/BC7Compressor.h b/BPTCEncoder/include/BC7Compressor.h index 96cf94c..4eb43fc 100755 --- a/BPTCEncoder/include/BC7Compressor.h +++ b/BPTCEncoder/include/BC7Compressor.h @@ -138,6 +138,14 @@ namespace BC7C { void CompressAtomic(FasTC::CompressionJobList &); #endif +#ifdef FOUND_NVTT_BC7_EXPORT + // These functions take the same arguments as Compress and CompressWithStats, + // but they use the NVTT compressor if it was supplied to CMake. + void CompressNVTT(const FasTC::CompressionJob &); + void CompressNVTTWithStats(const FasTC::CompressionJob &, + std::ostream *logStream); +#endif + // Decompress the image given as BC7 data to R8G8B8A8 format. Width and Height // are the dimensions of the image in pixels. void Decompress(const FasTC::DecompressionJob &); diff --git a/BPTCEncoder/src/CompressNVTT.cpp b/BPTCEncoder/src/CompressNVTT.cpp new file mode 100644 index 0000000..096ee3d --- /dev/null +++ b/BPTCEncoder/src/CompressNVTT.cpp @@ -0,0 +1,207 @@ +/* FasTC + * Copyright (c) 2013 University of North Carolina at Chapel Hill. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for educational, research, and non-profit purposes, without + * fee, and without a written agreement is hereby granted, provided that the + * above copyright notice, this paragraph, and the following four paragraphs + * appear in all copies. + * + * Permission to incorporate this software into commercial products may be + * obtained by contacting the authors or the Office of Technology Development + * at the University of North Carolina at Chapel Hill . + * + * This software program and documentation are copyrighted by the University of + * North Carolina at Chapel Hill. The software program and documentation are + * supplied "as is," without any accompanying services from the University of + * North Carolina at Chapel Hill or the authors. The University of North + * Carolina at Chapel Hill and the authors do not warrant that the operation of + * the program will be uninterrupted or error-free. The end-user understands + * that the program was developed for research purposes and is advised not to + * rely exclusively on the program for any reason. + * + * IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE + * AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, + * OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF + * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA + * AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY + * DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY + * STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON + * AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND + * THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, + * ENHANCEMENTS, OR MODIFICATIONS. + * + * Please send all BUG REPORTS to . + * + * The authors may be contacted via: + * + * Pavel Krajcevski + * Dept of Computer Science + * 201 S Columbia St + * Frederick P. Brooks, Jr. Computer Science Bldg + * Chapel Hill, NC 27599-3175 + * USA + * + * + */ + +#include "BC7Compressor.h" +#include "BC7CompressionMode.h" +#undef DBL_MAX +#include "BitStream.h" +#include "TexCompTypes.h" + +#include +#include +#include + +#include "avpcl.h" + +namespace BC7C { + + void GetBlock(uint32 x, uint32 y, uint32 width, const uint32 *pixels, Tile &t) { + for(uint32 j = 0; j < 4; j++) + for(uint32 i = 0; i < 4; i++) { + uint32 pixel = pixels[(y+j)*width + (x+i)]; + t.data[j][i].X() = pixel & 0xFF; + t.data[j][i].Y() = (pixel >> 8) & 0xFF; + t.data[j][i].Z() = (pixel >> 16) & 0xFF; + t.data[j][i].W() = (pixel >> 24) & 0xFF; + } + } + + class BlockLogger { + public: + BlockLogger(uint64 blockIdx, std::ostream &os) + : m_BlockIdx(blockIdx), m_Stream(os) { } + + template + friend std::ostream &operator<<(const BlockLogger &bl, const T &v); + + uint64 m_BlockIdx; + std::ostream &m_Stream; + }; + + template + std::ostream &operator<<(const BlockLogger &bl, const T &v) { + std::stringstream ss; + ss << bl.m_BlockIdx << ": " << v; + return bl.m_Stream << ss.str(); + } + + template + static void PrintStat(const BlockLogger &lgr, const char *stat, const T &v) { + std::stringstream ss; + ss << stat << " -- " << v << std::endl; + lgr << ss.str(); + } + + // Compress an image using BC7 compression. Use the inBuf parameter to point + // to an image in 4-byte RGBA format. The width and height parameters specify + // the size of the image in pixels. The buffer pointed to by outBuf should be + // large enough to store the compressed image. This implementation has an 4:1 + // compression ratio. + void CompressNVTT(const FasTC::CompressionJob &cj) { + const uint32 *inPixels = reinterpret_cast(cj.InBuf()); + const uint32 kBlockSz = GetBlockSize(FasTC::eCompressionFormat_BPTC); + uint8 *outBuf = cj.OutBuf() + cj.CoordsToBlockIdx(cj.XStart(), cj.YStart()) * kBlockSz; + + uint32 startX = cj.XStart(); + bool done = false; + + for(uint32 j = cj.YStart(); !done; j += 4) { + for(uint32 i = startX; !done && i < cj.Width(); i += 4) { + + Tile block(4, 4); + GetBlock(i, j, cj.Width(), inPixels, block); + AVPCL::compress(block, reinterpret_cast(outBuf), NULL); + + outBuf += kBlockSz; + done = i+4 >= cj.XEnd() && j+(i+4 == cj.Width()? 4 : 0) >= cj.YEnd(); + } + startX = 0; + } + } + + typedef double (*ModeCompressFunc)(const Tile &, char* out); + static ModeCompressFunc kModeFuncs[8] = { + AVPCL::compress_mode0, + AVPCL::compress_mode1, + AVPCL::compress_mode2, + AVPCL::compress_mode3, + AVPCL::compress_mode4, + AVPCL::compress_mode5, + AVPCL::compress_mode6, + AVPCL::compress_mode7 + }; + + double CompressMode(uint32 mode, const Tile &t, char *out, BlockLogger &log) { + std::stringstream ss; + ss << "Mode_" << mode << "_error"; + double mse = kModeFuncs[mode](t, out); + PrintStat(log, ss.str().c_str(), mse); + + BitStreamReadOnly strm(reinterpret_cast(out)); + while(!strm.ReadBit()); + + const BC7CompressionMode::Attributes *attrs = + BC7CompressionMode::GetAttributesForMode(mode); + const uint32 nSubsets = attrs->numSubsets; + + ss.str(""); + ss << "Mode_" << mode << "_shape"; + + uint32 shapeIdx = 0; + if ( nSubsets > 1 ) { + shapeIdx = strm.ReadBits(mode == 0? 4 : 6); + PrintStat(log, ss.str().c_str(), shapeIdx); + } else { + PrintStat(log, ss.str().c_str(), -1); + } + + return mse; + } + + void CompressNVTTWithStats(const FasTC::CompressionJob &cj, std::ostream *logStream) { + const uint32 *inPixels = reinterpret_cast(cj.InBuf()); + const uint32 kBlockSz = GetBlockSize(FasTC::eCompressionFormat_BPTC); + uint8 *outBuf = cj.OutBuf() + cj.CoordsToBlockIdx(cj.XStart(), cj.YStart()) * kBlockSz; + + uint32 startX = cj.XStart(); + bool done = false; + for(uint32 j = cj.YStart(); !done; j += 4) { + for(uint32 i = startX; !done && i < cj.Width(); i += 4) { + + Tile block(4, 4); + GetBlock(i, j, cj.Width(), inPixels, block); + + if(logStream) { + BlockLogger logger(cj.CoordsToBlockIdx(i, j), *logStream); + + char tempblock[16]; + double msebest = 1e30; + for(uint32 mode = 0; mode < 8; mode++) { + double mse_mode = CompressMode(mode, block, tempblock, logger); + if(mse_mode < msebest) { + msebest = mse_mode; + memcpy(outBuf, tempblock, AVPCL::BLOCKSIZE); + } + } + } else { + AVPCL::compress(block, reinterpret_cast(outBuf), NULL); + } + + outBuf += 16; + done = i+4 >= cj.XEnd() && j+(i+4 == cj.Width()? 4 : 0) >= cj.YEnd(); + } + + startX = 0; + } + } + +} // namespace BC7C diff --git a/CLTool/src/tc.cpp b/CLTool/src/tc.cpp index 04438b9..9a78599 100644 --- a/CLTool/src/tc.cpp +++ b/CLTool/src/tc.cpp @@ -121,6 +121,7 @@ int main(int argc, char **argv) { bool bSaveLog = false; bool bUseAtomics = false; bool bUsePVRTexLib = false; + bool bUseNVTT = false; bool bVerbose = false; FasTC::ECompressionFormat format = FasTC::eCompressionFormat_BPTC; @@ -153,6 +154,9 @@ int main(int argc, char **argv) { } else if(!strcmp(argv[fileArg], "PVRTCLib")) { format = FasTC::eCompressionFormat_PVRTC; bUsePVRTexLib = true; + } else if(!strcmp(argv[fileArg], "BPTCLib")) { + format = FasTC::eCompressionFormat_BPTC; + bUseNVTT = true; } else if(!strcmp(argv[fileArg], "ETC1")) { format = FasTC::eCompressionFormat_ETC1; } else if(!strcmp(argv[fileArg], "DXT1")) { @@ -275,6 +279,7 @@ int main(int argc, char **argv) { settings.iNumCompressions = numCompressions; settings.iJobSize = numJobs; settings.bUsePVRTexLib = bUsePVRTexLib; + settings.bUseNVTT = bUseNVTT; if(bSaveLog) { settings.logStream = &logStream; } else { @@ -323,4 +328,4 @@ int main(int argc, char **argv) { logFile.close(); } return 0; -} \ No newline at end of file +} diff --git a/CMakeLists.txt b/CMakeLists.txt index f28f909..574333e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,7 @@ ENDIF(TREAT_WARNINGS_AS_ERRORS) SET(CMAKE_MODULE_PATH "${FasTC_SOURCE_DIR}/CMakeModules" ${CMAKE_MODULE_PATH}) FIND_PACKAGE(PVRTexLib) +FIND_PACKAGE(BC7Export) SET(FASTC_DIRECTORIES Base Core IO BPTCEncoder PVRTCEncoder DXTEncoder ETCEncoder diff --git a/CMakeModules/FindBC7Export.cmake b/CMakeModules/FindBC7Export.cmake new file mode 100644 index 0000000..94474f0 --- /dev/null +++ b/CMakeModules/FindBC7Export.cmake @@ -0,0 +1,71 @@ +# FasTC +# Copyright (c) 2013 University of North Carolina at Chapel Hill. +# All rights reserved. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for educational, research, and non-profit purposes, without +# fee, and without a written agreement is hereby granted, provided that the +# above copyright notice, this paragraph, and the following four paragraphs +# appear in all copies. +# +# Permission to incorporate this software into commercial products may be +# obtained by contacting the authors or the Office of Technology Development +# at the University of North Carolina at Chapel Hill . +# +# This software program and documentation are copyrighted by the University of +# North Carolina at Chapel Hill. The software program and documentation are +# supplied "as is," without any accompanying services from the University of +# North Carolina at Chapel Hill or the authors. The University of North +# Carolina at Chapel Hill and the authors do not warrant that the operation of +# the program will be uninterrupted or error-free. The end-user understands +# that the program was developed for research purposes and is advised not to +# rely exclusively on the program for any reason. +# +# IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE +# AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, +# OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF +# THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA +# AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. +# +# THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY +# DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY +# STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON +# AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND +# THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, +# ENHANCEMENTS, OR MODIFICATIONS. +# +# Please send all BUG REPORTS to . +# +# The authors may be contacted via: +# +# Pavel Krajcevski +# Dept of Computer Science +# 201 S Columbia St +# Frederick P. Brooks, Jr. Computer Science Bldg +# Chapel Hill, NC 27599-3175 +# USA +# +# + +# - Try to find libPVRTexLib +# Once done this will define +# PVRTEXLIB_FOUND - System has PVRTexLib +# PVRTEXLIB_INCLUDE_DIRS - The PVRTexLib include directories +# PVRTEXLIB_LIBRARIES - The libraries needed to use PVRTexLib + +SET(AVPCLLIB_ROOT "" CACHE STRING "Location of the BC7 Export library from NVTT") + +IF(NOT AVPCLLIB_ROOT STREQUAL "") + IF(NOT EXISTS "${AVPCLLIB_ROOT}/src/CMakeLists.txt") + CONFIGURE_FILE( + "${CMAKE_CURRENT_LIST_DIR}/bc7_export/CMakeLists.txt" + "${AVPCLLIB_ROOT}/src" + COPYONLY) + ENDIF() + ADD_SUBDIRECTORY(${AVPCLLIB_ROOT}/src ${CMAKE_CURRENT_BINARY_DIR}/bc7_export) + set(AVPCLLIB_INCLUDE_DIR ${AVPCLLIB_ROOT}/src ) +ENDIF() + +mark_as_advanced( FORCE AVPCLLIB_ROOT AVPCLLIB_INCLUDE_DIR ) diff --git a/CMakeModules/bc7_export/CMakeLists.txt b/CMakeModules/bc7_export/CMakeLists.txt new file mode 100644 index 0000000..c5fd822 --- /dev/null +++ b/CMakeModules/bc7_export/CMakeLists.txt @@ -0,0 +1,104 @@ +# FasTC +# Copyright (c) 2012 University of North Carolina at Chapel Hill. All rights reserved. +# +# Permission to use, copy, modify, and distribute this software and its documentation for educational, +# research, and non-profit purposes, without fee, and without a written agreement is hereby granted, +# provided that the above copyright notice, this paragraph, and the following four paragraphs appear +# in all copies. +# +# Permission to incorporate this software into commercial products may be obtained by contacting the +# authors or the Office of Technology Development at the University of North Carolina at Chapel Hill . +# +# This software program and documentation are copyrighted by the University of North Carolina at Chapel Hill. +# The software program and documentation are supplied "as is," without any accompanying services from the +# University of North Carolina at Chapel Hill or the authors. The University of North Carolina at Chapel Hill +# and the authors do not warrant that the operation of the program will be uninterrupted or error-free. The +# end-user understands that the program was developed for research purposes and is advised not to rely +# exclusively on the program for any reason. +# +# IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE +# USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE +# AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY +# STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY +# OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, +# ENHANCEMENTS, OR MODIFICATIONS. +# +# Please send all BUG REPORTS to . +# +# The authors may be contacted via: +# +# Pavel Krajcevski +# Dept of Computer Science +# 201 S Columbia St +# Frederick P. Brooks, Jr. Computer Science Bldg +# Chapel Hill, NC 27599-3175 +# USA +# +# + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/arvo) + +SET( HEADERS + avpcl.h + bits.h + endpts.h + ImfArray.h + rgba.h + shapes_three.h + shapes_two.h + targa.h + tile.h + utils.h + arvo/ArvoMath.h + arvo/Char.h + arvo/Complex.h + arvo/form.h + arvo/Matrix.h + arvo/Perm.h + arvo/Rand.h + arvo/SI_units.h + arvo/SphTri.h + arvo/SVD.h + arvo/Token.h + arvo/Vec2.h + arvo/Vec3.h + arvo/Vec4.h + arvo/Vector.h +) + +SET( SOURCES + avpcl.cpp + avpcl_mode0.cpp + avpcl_mode1.cpp + avpcl_mode2.cpp + avpcl_mode3.cpp + avpcl_mode4.cpp + avpcl_mode5.cpp + avpcl_mode6.cpp + avpcl_mode7.cpp + targa.cpp + utils.cpp + arvo/ArvoMath.cpp + arvo/Char.cpp + arvo/Complex.cpp + arvo/Matrix.cpp + arvo/Perm.cpp + arvo/Rand.cpp + arvo/SphTri.cpp + arvo/SVD.cpp + arvo/Token.cpp + arvo/Vec2.cpp + arvo/Vec3.cpp + arvo/Vec4.cpp + arvo/Vector.cpp +) + +ADD_LIBRARY( avpcl + ${HEADERS} + ${SOURCES} +) diff --git a/Core/include/TexComp.h b/Core/include/TexComp.h index 5c02327..7eede5e 100644 --- a/Core/include/TexComp.h +++ b/Core/include/TexComp.h @@ -91,6 +91,11 @@ struct SCompressionSettings { // ignored. The quality being used is the fastest compression quality. bool bUsePVRTexLib; + // This flag instructs the infrastructure to use the compression routine from + // NVidia Texture Tools. If no such lib is found during configuration then this + // flag is ignored. + bool bUseNVTT; + // This is the output stream with which we should output the logs for the // compression functions. std::ostream *logStream; diff --git a/Core/src/TexComp.cpp b/Core/src/TexComp.cpp index 6b820f2..96f5158 100644 --- a/Core/src/TexComp.cpp +++ b/Core/src/TexComp.cpp @@ -104,6 +104,11 @@ static CompressionFuncWithStats ChooseFuncFromSettingsWithStats(const SCompress case FasTC::eCompressionFormat_BPTC: { +#ifdef FOUND_NVTT_BC7_EXPORT + if(s.bUseNVTT) + return BC7C::CompressNVTTWithStats; + else +#endif return BC7C::CompressWithStats; } break; @@ -136,7 +141,13 @@ static CompressionFunc ChooseFuncFromSettings(const SCompressionSettings &s) { return BC7C::CompressImageBC7SIMD; } #endif - return BC7C::Compress; + +#ifdef FOUND_NVTT_BC7_EXPORT + if(s.bUseNVTT) + return BC7C::CompressNVTT; + else +#endif + return BC7C::Compress; } break;