mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-07 01:25:36 +00:00
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.
This commit is contained in:
parent
ba202c6ce9
commit
6794a0fffb
|
@ -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()
|
||||
|
|
|
@ -52,3 +52,5 @@
|
|||
#cmakedefine HAS_ATOMICS
|
||||
#cmakedefine HAS_GCC_ATOMICS
|
||||
#cmakedefine HAS_MSVC_ATOMICS
|
||||
|
||||
#cmakedefine FOUND_NVTT_BC7_EXPORT
|
||||
|
|
|
@ -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 &);
|
||||
|
|
207
BPTCEncoder/src/CompressNVTT.cpp
Normal file
207
BPTCEncoder/src/CompressNVTT.cpp
Normal file
|
@ -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 <otd@unc.edu>.
|
||||
*
|
||||
* 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 <pavel@cs.unc.edu>.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* <http://gamma.cs.unc.edu/FasTC/>
|
||||
*/
|
||||
|
||||
#include "BC7Compressor.h"
|
||||
#include "BC7CompressionMode.h"
|
||||
#undef DBL_MAX
|
||||
#include "BitStream.h"
|
||||
#include "TexCompTypes.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
|
||||
#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<typename T>
|
||||
friend std::ostream &operator<<(const BlockLogger &bl, const T &v);
|
||||
|
||||
uint64 m_BlockIdx;
|
||||
std::ostream &m_Stream;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
std::ostream &operator<<(const BlockLogger &bl, const T &v) {
|
||||
std::stringstream ss;
|
||||
ss << bl.m_BlockIdx << ": " << v;
|
||||
return bl.m_Stream << ss.str();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
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<const uint32 *>(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<char *>(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<uint8 *>(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<const uint32 *>(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<char *>(outBuf), NULL);
|
||||
}
|
||||
|
||||
outBuf += 16;
|
||||
done = i+4 >= cj.XEnd() && j+(i+4 == cj.Width()? 4 : 0) >= cj.YEnd();
|
||||
}
|
||||
|
||||
startX = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace BC7C
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
71
CMakeModules/FindBC7Export.cmake
Normal file
71
CMakeModules/FindBC7Export.cmake
Normal file
|
@ -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 <otd@unc.edu>.
|
||||
#
|
||||
# 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 <pavel@cs.unc.edu>.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# <http://gamma.cs.unc.edu/FasTC/>
|
||||
|
||||
# - 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 )
|
104
CMakeModules/bc7_export/CMakeLists.txt
Normal file
104
CMakeModules/bc7_export/CMakeLists.txt
Normal file
|
@ -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 <otd@unc.edu>.
|
||||
#
|
||||
# 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 <pavel@cs.unc.edu>.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# <http://gamma.cs.unc.edu/FasTC/>
|
||||
|
||||
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}
|
||||
)
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue