Merge branch 'master' of https://github.com/castano/nvidia-texture-tools
This commit is contained in:
@ -11,46 +11,6 @@ SUBDIRS(nvtt)
|
||||
SUBDIRS(bc6h)
|
||||
SUBDIRS(bc7)
|
||||
|
||||
# OpenGL
|
||||
#INCLUDE(FindOpenGL)
|
||||
#IF(OPENGL_FOUND)
|
||||
# MESSAGE(STATUS "Looking for OpenGL - found")
|
||||
#ELSE(OPENGL_FOUND)
|
||||
# MESSAGE(STATUS "Looking for OpenGL - not found")
|
||||
#ENDIF(OPENGL_FOUND)
|
||||
|
||||
# GLUT
|
||||
#INCLUDE(FindGLUT)
|
||||
#IF(GLUT_FOUND)
|
||||
# MESSAGE(STATUS "Looking for GLUT - found")
|
||||
#ELSE(GLUT_FOUND)
|
||||
# MESSAGE(STATUS "Looking for GLUT - not found")
|
||||
#ENDIF(GLUT_FOUND)
|
||||
|
||||
# DirectX
|
||||
#INCLUDE(${NV_CMAKE_DIR}/FindDirectX.cmake)
|
||||
#IF(DX10_FOUND)
|
||||
# MESSAGE(STATUS "Looking for DirectX - found")
|
||||
#ELSE(DX10_FOUND)
|
||||
# MESSAGE(STATUS "Looking for DirectX - not found")
|
||||
#ENDIF(DX10_FOUND)
|
||||
|
||||
# GLEW
|
||||
#INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
|
||||
#IF(GLEW_FOUND)
|
||||
# MESSAGE(STATUS "Looking for GLEW - found")
|
||||
#ELSE(GLEW_FOUND)
|
||||
# MESSAGE(STATUS "Looking for GLEW - not found")
|
||||
#ENDIF(GLEW_FOUND)
|
||||
|
||||
# Cg
|
||||
#INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
|
||||
#IF(CG_FOUND)
|
||||
# MESSAGE(STATUS "Looking for Cg - found")
|
||||
#ELSE(CG_FOUND)
|
||||
# MESSAGE(STATUS "Looking for Cg - not found")
|
||||
#ENDIF(CG_FOUND)
|
||||
|
||||
# CUDA
|
||||
FIND_PACKAGE(CUDA)
|
||||
IF(CUDA_FOUND)
|
||||
@ -66,71 +26,16 @@ ELSE(CUDA_FOUND)
|
||||
MESSAGE(STATUS "Looking for CUDA - not found")
|
||||
ENDIF(CUDA_FOUND)
|
||||
|
||||
# Maya
|
||||
#INCLUDE(${NV_CMAKE_DIR}/FindMaya.cmake)
|
||||
#IF(MAYA_FOUND)
|
||||
# SET(HAVE_MAYA ${MAYA_FOUND} CACHE BOOL "Set to TRUE if Maya is found, FALSE otherwise")
|
||||
# MESSAGE(STATUS "Looking for Maya - found")
|
||||
#ELSE(MAYA_FOUND)
|
||||
# MESSAGE(STATUS "Looking for Maya - not found")
|
||||
#ENDIF(MAYA_FOUND)
|
||||
|
||||
# FreeImage
|
||||
#INCLUDE(${NV_CMAKE_DIR}/FindFreeImage.cmake)
|
||||
#IF(FREEIMAGE_FOUND)
|
||||
# SET(HAVE_FREEIMAGE ${FREEIMAGE_FOUND} CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise")
|
||||
# MESSAGE(STATUS "Looking for FreeImage - found")
|
||||
#ELSE(FREEIMAGE_FOUND)
|
||||
# MESSAGE(STATUS "Looking for FreeImage - not found")
|
||||
#ENDIF(FREEIMAGE_FOUND)
|
||||
|
||||
# JPEG
|
||||
#INCLUDE(FindJPEG)
|
||||
#IF(JPEG_FOUND)
|
||||
# SET(HAVE_JPEG ${JPEG_FOUND} CACHE BOOL "Set to TRUE if JPEG is found, FALSE otherwise")
|
||||
# MESSAGE(STATUS "Looking for JPEG - found")
|
||||
#ELSE(JPEG_FOUND)
|
||||
# MESSAGE(STATUS "Looking for JPEG - not found")
|
||||
#ENDIF(JPEG_FOUND)
|
||||
|
||||
# PNG
|
||||
#INCLUDE(FindPNG)
|
||||
#IF(PNG_FOUND)
|
||||
# SET(HAVE_PNG ${PNG_FOUND} CACHE BOOL "Set to TRUE if PNG is found, FALSE otherwise")
|
||||
# MESSAGE(STATUS "Looking for PNG - found")
|
||||
#ELSE(PNG_FOUND)
|
||||
# MESSAGE(STATUS "Looking for PNG - not found")
|
||||
#ENDIF(PNG_FOUND)
|
||||
|
||||
# TIFF
|
||||
#SET(TIFF_NAMES libtiff)
|
||||
#INCLUDE(FindTIFF)
|
||||
#IF(TIFF_FOUND)
|
||||
# SET(HAVE_TIFF ${TIFF_FOUND} CACHE BOOL "Set to TRUE if TIFF is found, FALSE otherwise")
|
||||
# MESSAGE(STATUS "Looking for TIFF - found")
|
||||
#ELSE(TIFF_FOUND)
|
||||
# MESSAGE(STATUS "Looking for TIFF - not found")
|
||||
#ENDIF(TIFF_FOUND)
|
||||
|
||||
# OpenEXR
|
||||
#INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
|
||||
#IF(OPENEXR_FOUND)
|
||||
# SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
|
||||
# MESSAGE(STATUS "Looking for OpenEXR - found")
|
||||
#ELSE(OPENEXR_FOUND)
|
||||
# MESSAGE(STATUS "Looking for OpenEXR - not found")
|
||||
#ENDIF(OPENEXR_FOUND)
|
||||
|
||||
# OpenMP
|
||||
INCLUDE(FindOpenMP)
|
||||
IF(OPENMP_FOUND)
|
||||
SET(HAVE_OPENMP ${OPENMP_FOUND} CACHE BOOL "Set to TRUE if OpenMP is found, FALSE otherwise")
|
||||
MESSAGE(STATUS "Looking for OpenMP - found")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
ELSE(OPENMP_FOUND)
|
||||
MESSAGE(STATUS "Looking for OpenMP - not found")
|
||||
ENDIF(OPENMP_FOUND)
|
||||
# INCLUDE(FindOpenMP)
|
||||
# IF(OPENMP_FOUND)
|
||||
# SET(HAVE_OPENMP ${OPENMP_FOUND} CACHE BOOL "Set to TRUE if OpenMP is found, FALSE otherwise")
|
||||
# MESSAGE(STATUS "Looking for OpenMP - found")
|
||||
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
# ELSE(OPENMP_FOUND)
|
||||
# MESSAGE(STATUS "Looking for OpenMP - not found")
|
||||
# ENDIF(OPENMP_FOUND)
|
||||
|
||||
# Threads
|
||||
FIND_PACKAGE(Threads REQUIRED)
|
||||
@ -149,5 +54,3 @@ CHECK_INCLUDE_FILES("dispatch/dispatch.h" HAVE_DISPATCH_H)
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nvconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h)
|
||||
|
||||
#INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h DESTINATION include)
|
||||
|
||||
|
@ -1015,15 +1015,7 @@ void debug::dumpInfo()
|
||||
#endif
|
||||
}
|
||||
|
||||
static va_list getEmptyVAList(va_list list, ...)
|
||||
{
|
||||
va_start(list, list);
|
||||
va_end(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// Dump callstack using the specified handler.
|
||||
void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToSkip /*= 0*/)
|
||||
static void dumpCallstackImpl(MessageHandler *messageHandler, int callstackLevelsToSkip, ...)
|
||||
{
|
||||
#if (NV_OS_WIN32 && NV_CC_MSVC) || (defined(HAVE_SIGNAL_H) && defined(HAVE_EXECINFO_H))
|
||||
if (hasStackTrace())
|
||||
@ -1035,7 +1027,8 @@ void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToS
|
||||
writeStackTrace(trace, size, callstackLevelsToSkip + 1, lines); // + 1 to skip the call to dumpCallstack
|
||||
|
||||
va_list empty;
|
||||
empty = getEmptyVAList(empty);
|
||||
va_start(empty, callstackLevelsToSkip);
|
||||
va_end(empty);
|
||||
|
||||
for (uint i = 0; i < lines.count(); i++) {
|
||||
messageHandler->log(lines[i], empty);
|
||||
@ -1045,6 +1038,12 @@ void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToS
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Dump callstack using the specified handler.
|
||||
void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToSkip /*= 0*/)
|
||||
{
|
||||
dumpCallstackImpl(messageHandler, callstackLevelsToSkip);
|
||||
}
|
||||
|
||||
|
||||
/// Set the debug message handler.
|
||||
void debug::setMessageHandler(MessageHandler * message_handler)
|
||||
|
@ -585,7 +585,7 @@ DDSHeader::DDSHeader()
|
||||
|
||||
// Store version information on the reserved header attributes.
|
||||
this->reserved[9] = FOURCC_NVTT;
|
||||
this->reserved[10] = (2 << 16) | (1 << 8) | (0); // major.minor.revision
|
||||
this->reserved[10] = (2 << 16) | (1 << 8) | (1); // major.minor.revision
|
||||
|
||||
this->pf.size = 32;
|
||||
this->pf.flags = 0;
|
||||
|
@ -1,122 +0,0 @@
|
||||
|
||||
/*
|
||||
For more info:
|
||||
http://developer.valvesoftware.com/wiki/VTF
|
||||
|
||||
File Layout:
|
||||
VTF Header
|
||||
VTF Low Resolution Image Data
|
||||
For Each Mipmap (Smallest to Largest)
|
||||
For Each Frame (First to Last)
|
||||
For Each Face (First to Last)
|
||||
For Each Z Slice (Min to Max; Varies with Mipmap)
|
||||
VTF High Resolution Image Data
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
IMAGE_FORMAT_NONE = -1,
|
||||
IMAGE_FORMAT_RGBA8888 = 0,
|
||||
IMAGE_FORMAT_ABGR8888,
|
||||
IMAGE_FORMAT_RGB888,
|
||||
IMAGE_FORMAT_BGR888,
|
||||
IMAGE_FORMAT_RGB565,
|
||||
IMAGE_FORMAT_I8,
|
||||
IMAGE_FORMAT_IA88,
|
||||
IMAGE_FORMAT_P8,
|
||||
IMAGE_FORMAT_A8,
|
||||
IMAGE_FORMAT_RGB888_BLUESCREEN,
|
||||
IMAGE_FORMAT_BGR888_BLUESCREEN,
|
||||
IMAGE_FORMAT_ARGB8888,
|
||||
IMAGE_FORMAT_BGRA8888,
|
||||
IMAGE_FORMAT_DXT1,
|
||||
IMAGE_FORMAT_DXT3,
|
||||
IMAGE_FORMAT_DXT5,
|
||||
IMAGE_FORMAT_BGRX8888,
|
||||
IMAGE_FORMAT_BGR565,
|
||||
IMAGE_FORMAT_BGRX5551,
|
||||
IMAGE_FORMAT_BGRA4444,
|
||||
IMAGE_FORMAT_DXT1_ONEBITALPHA,
|
||||
IMAGE_FORMAT_BGRA5551,
|
||||
IMAGE_FORMAT_UV88,
|
||||
IMAGE_FORMAT_UVWQ8888,
|
||||
IMAGE_FORMAT_RGBA16161616F,
|
||||
IMAGE_FORMAT_RGBA16161616,
|
||||
IMAGE_FORMAT_UVLX8888,
|
||||
IMAGE_FORMAT_R32F, //!< = Luminance - 32 bpp
|
||||
IMAGE_FORMAT_RGB323232F, //!< = Red, Green, Blue - 96 bpp
|
||||
IMAGE_FORMAT_RGBA32323232F, //!< = Red, Green, Blue, Alpha - 128 bpp
|
||||
IMAGE_FORMAT_NV_DST16,
|
||||
IMAGE_FORMAT_NV_DST24,
|
||||
IMAGE_FORMAT_NV_INTZ,
|
||||
IMAGE_FORMAT_NV_RAWZ,
|
||||
IMAGE_FORMAT_ATI_DST16,
|
||||
IMAGE_FORMAT_ATI_DST24,
|
||||
IMAGE_FORMAT_NV_NULL,
|
||||
IMAGE_FORMAT_ATI2N,
|
||||
IMAGE_FORMAT_ATI1N,
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
TEXTUREFLAGS_POINTSAMPLE = 0x00000001,
|
||||
TEXTUREFLAGS_TRILINEAR = 0x00000002,
|
||||
TEXTUREFLAGS_CLAMPS = 0x00000004,
|
||||
TEXTUREFLAGS_CLAMPT = 0x00000008,
|
||||
TEXTUREFLAGS_ANISOTROPIC = 0x00000010,
|
||||
TEXTUREFLAGS_HINT_DXT5 = 0x00000020,
|
||||
TEXTUREFLAGS_NOCOMPRESS = 0x00000040,
|
||||
TEXTUREFLAGS_NORMAL = 0x00000080,
|
||||
TEXTUREFLAGS_NOMIP = 0x00000100,
|
||||
TEXTUREFLAGS_NOLOD = 0x00000200,
|
||||
TEXTUREFLAGS_MINMIP = 0x00000400,
|
||||
TEXTUREFLAGS_PROCEDURAL = 0x00000800,
|
||||
TEXTUREFLAGS_ONEBITALPHA = 0x00001000,
|
||||
TEXTUREFLAGS_EIGHTBITALPHA = 0x00002000,
|
||||
TEXTUREFLAGS_ENVMAP = 0x00004000,
|
||||
TEXTUREFLAGS_RENDERTARGET = 0x00008000,
|
||||
TEXTUREFLAGS_DEPTHRENDERTARGET = 0x00010000,
|
||||
TEXTUREFLAGS_NODEBUGOVERRIDE = 0x00020000,
|
||||
TEXTUREFLAGS_SINGLECOPY = 0x00040000,
|
||||
TEXTUREFLAGS_ONEOVERMIPLEVELINALPHA = 0x00080000,
|
||||
TEXTUREFLAGS_PREMULTCOLORBYONEOVERMIPLEVEL = 0x00100000,
|
||||
TEXTUREFLAGS_NORMALTODUDV = 0x00200000,
|
||||
TEXTUREFLAGS_ALPHATESTMIPGENERATION = 0x00400000,
|
||||
TEXTUREFLAGS_NODEPTHBUFFER = 0x00800000,
|
||||
TEXTUREFLAGS_NICEFILTERED = 0x01000000,
|
||||
TEXTUREFLAGS_CLAMPU = 0x02000000
|
||||
};
|
||||
|
||||
|
||||
struct VtfHeader
|
||||
{
|
||||
char signature[4]; // File signature ("VTF\0").
|
||||
uint32 version[2]; // version[0].version[1] (currently 7.2).
|
||||
uint32 headerSize; // Size of the header struct (16 byte aligned; currently 80 bytes).
|
||||
|
||||
// 7.0
|
||||
uint16 width; // Width of the largest mipmap in pixels. Must be a power of 2.
|
||||
uint16 height; // Height of the largest mipmap in pixels. Must be a power of 2.
|
||||
uint32 flags; // VTF flags.
|
||||
uint16 frames; // Number of frames, if animated (1 for no animation).
|
||||
uint16 firstFrame; // First frame in animation (0 based).
|
||||
uint8 padding0[4]; // reflectivity padding (16 byte alignment).
|
||||
float reflectivity[3]; // reflectivity vector.
|
||||
uint8 padding1[4]; // reflectivity padding (8 byte packing).
|
||||
float bumpmapScale; // Bumpmap scale.
|
||||
uint32 highResImageFormat; // High resolution image format.
|
||||
uint8 mipmapCount; // Number of mipmaps.
|
||||
uint32 lowResImageFormat; // Low resolution image format (always DXT1).
|
||||
uint8 lowResImageWidth; // Low resolution image width.
|
||||
uint8 lowResImageHeight; // Low resolution image height.
|
||||
|
||||
// 7.2
|
||||
uint16 depth; // Depth of the largest mipmap in pixels.
|
||||
// Must be a power of 2. Can be 0 or 1 for a 2D texture (v7.2 only).
|
||||
};
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "nvcore/Debug.h" // nvDebugCheck
|
||||
#include "nvcore/Utils.h" // max, clamp
|
||||
|
||||
// Both cmath and math for C++11 and C function definitions.
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
|
||||
#if NV_OS_WIN32 || NV_OS_XBOX
|
||||
@ -81,7 +83,7 @@ inline float sqrtf_assert(const float f)
|
||||
return sqrtf(f);
|
||||
}
|
||||
|
||||
extern "C" inline double acos_assert(const double f)
|
||||
extern "C" inline double acos_assert(const double f)
|
||||
{
|
||||
nvDebugCheck(f >= -1.0f && f <= 1.0f);
|
||||
return acos(f);
|
||||
@ -162,7 +164,9 @@ namespace nv
|
||||
|
||||
inline bool isNan(const float f)
|
||||
{
|
||||
#if NV_OS_WIN32 || NV_OS_XBOX
|
||||
#if __cplusplus >= 199711L
|
||||
return std::isnan(f);
|
||||
#elif NV_OS_WIN32 || NV_OS_XBOX
|
||||
return _isnan(f) != 0;
|
||||
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD || NV_OS_ORBIS || NV_OS_LINUX
|
||||
return isnan(f);
|
||||
@ -227,7 +231,7 @@ namespace nv
|
||||
}
|
||||
|
||||
inline float smoothstep(float edge0, float edge1, float x) {
|
||||
x = linearstep(edge0, edge1, x);
|
||||
x = linearstep(edge0, edge1, x);
|
||||
|
||||
// Evaluate polynomial
|
||||
return x*x*(3 - 2*x);
|
||||
|
@ -276,145 +276,6 @@ void CompressorETC2_RGBM::compressBlock(Vector4 colors[16], float weights[16], c
|
||||
|
||||
// External compressors.
|
||||
|
||||
#if defined(HAVE_ATITC)
|
||||
|
||||
typedef int BOOL;
|
||||
typedef _W64 unsigned long ULONG_PTR;
|
||||
typedef ULONG_PTR DWORD_PTR;
|
||||
#include "atitc/ATI_Compress.h"
|
||||
|
||||
void AtiCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
||||
{
|
||||
nvDebugCheck(d == 1);
|
||||
|
||||
// Init source texture
|
||||
ATI_TC_Texture srcTexture;
|
||||
srcTexture.dwSize = sizeof(srcTexture);
|
||||
srcTexture.dwWidth = w;
|
||||
srcTexture.dwHeight = h;
|
||||
if (inputFormat == InputFormat_BGRA_8UB)
|
||||
{
|
||||
srcTexture.dwPitch = w * 4;
|
||||
srcTexture.format = ATI_TC_FORMAT_ARGB_8888;
|
||||
}
|
||||
else
|
||||
{
|
||||
// @@ Floating point input is not swizzled.
|
||||
srcTexture.dwPitch = w * 16;
|
||||
srcTexture.format = ATI_TC_FORMAT_ARGB_32F;
|
||||
}
|
||||
srcTexture.dwDataSize = ATI_TC_CalculateBufferSize(&srcTexture);
|
||||
srcTexture.pData = (ATI_TC_BYTE*) data;
|
||||
|
||||
// Init dest texture
|
||||
ATI_TC_Texture destTexture;
|
||||
destTexture.dwSize = sizeof(destTexture);
|
||||
destTexture.dwWidth = w;
|
||||
destTexture.dwHeight = h;
|
||||
destTexture.dwPitch = 0;
|
||||
destTexture.format = ATI_TC_FORMAT_DXT1;
|
||||
destTexture.dwDataSize = ATI_TC_CalculateBufferSize(&destTexture);
|
||||
destTexture.pData = (ATI_TC_BYTE*) mem::malloc(destTexture.dwDataSize);
|
||||
|
||||
ATI_TC_CompressOptions options;
|
||||
options.dwSize = sizeof(options);
|
||||
options.bUseChannelWeighting = false;
|
||||
options.bUseAdaptiveWeighting = false;
|
||||
options.bDXT1UseAlpha = false;
|
||||
options.nCompressionSpeed = ATI_TC_Speed_Normal;
|
||||
options.bDisableMultiThreading = false;
|
||||
//options.bDisableMultiThreading = true;
|
||||
|
||||
// Compress
|
||||
ATI_TC_ConvertTexture(&srcTexture, &destTexture, &options, NULL, NULL, NULL);
|
||||
|
||||
if (outputOptions.outputHandler != NULL) {
|
||||
outputOptions.outputHandler->writeData(destTexture.pData, destTexture.dwDataSize);
|
||||
}
|
||||
|
||||
mem::free(destTexture.pData);
|
||||
}
|
||||
|
||||
void AtiCompressorDXT5::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
||||
{
|
||||
nvDebugCheck(d == 1);
|
||||
|
||||
// Init source texture
|
||||
ATI_TC_Texture srcTexture;
|
||||
srcTexture.dwSize = sizeof(srcTexture);
|
||||
srcTexture.dwWidth = w;
|
||||
srcTexture.dwHeight = h;
|
||||
if (inputFormat == InputFormat_BGRA_8UB)
|
||||
{
|
||||
srcTexture.dwPitch = w * 4;
|
||||
srcTexture.format = ATI_TC_FORMAT_ARGB_8888;
|
||||
}
|
||||
else
|
||||
{
|
||||
srcTexture.dwPitch = w * 16;
|
||||
srcTexture.format = ATI_TC_FORMAT_ARGB_32F;
|
||||
}
|
||||
srcTexture.dwDataSize = ATI_TC_CalculateBufferSize(&srcTexture);
|
||||
srcTexture.pData = (ATI_TC_BYTE*) data;
|
||||
|
||||
// Init dest texture
|
||||
ATI_TC_Texture destTexture;
|
||||
destTexture.dwSize = sizeof(destTexture);
|
||||
destTexture.dwWidth = w;
|
||||
destTexture.dwHeight = h;
|
||||
destTexture.dwPitch = 0;
|
||||
destTexture.format = ATI_TC_FORMAT_DXT5;
|
||||
destTexture.dwDataSize = ATI_TC_CalculateBufferSize(&destTexture);
|
||||
destTexture.pData = (ATI_TC_BYTE*) mem::malloc(destTexture.dwDataSize);
|
||||
|
||||
// Compress
|
||||
ATI_TC_ConvertTexture(&srcTexture, &destTexture, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (outputOptions.outputHandler != NULL) {
|
||||
outputOptions.outputHandler->writeData(destTexture.pData, destTexture.dwDataSize);
|
||||
}
|
||||
|
||||
mem::free(destTexture.pData);
|
||||
}
|
||||
|
||||
#endif // defined(HAVE_ATITC)
|
||||
|
||||
#if defined(HAVE_SQUISH)
|
||||
|
||||
//#include "squish/squish.h"
|
||||
#include "squish-1.10/squish.h"
|
||||
|
||||
void SquishCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
||||
{
|
||||
nvDebugCheck(d == 1);
|
||||
nvDebugCheck(false);
|
||||
|
||||
#pragma message(NV_FILE_LINE "TODO: Convert input to fixed point ABGR format instead of ARGB")
|
||||
/*
|
||||
Image img(*image);
|
||||
int count = img.width() * img.height();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Color32 c = img.pixel(i);
|
||||
img.pixel(i) = Color32(c.b, c.g, c.r, c.a);
|
||||
}
|
||||
|
||||
int size = squish::GetStorageRequirements(img.width(), img.height(), squish::kDxt1);
|
||||
void * blocks = mem::malloc(size);
|
||||
|
||||
squish::CompressImage((const squish::u8 *)img.pixels(), img.width(), img.height(), blocks, squish::kDxt1 | squish::kColourClusterFit);
|
||||
|
||||
if (outputOptions.outputHandler != NULL) {
|
||||
outputOptions.outputHandler->writeData(blocks, size);
|
||||
}
|
||||
|
||||
mem::free(blocks);
|
||||
*/
|
||||
}
|
||||
|
||||
#endif // defined(HAVE_SQUISH)
|
||||
|
||||
|
||||
#if defined(HAVE_D3DX)
|
||||
|
||||
void D3DXCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
||||
|
@ -79,25 +79,6 @@ namespace nv
|
||||
|
||||
|
||||
// External compressors.
|
||||
#if defined(HAVE_ATITC)
|
||||
struct AtiCompressorDXT1 : public CompressorInterface
|
||||
{
|
||||
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
||||
};
|
||||
|
||||
struct AtiCompressorDXT5 : public CompressorInterface
|
||||
{
|
||||
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SQUISH)
|
||||
struct SquishCompressorDXT1 : public CompressorInterface
|
||||
{
|
||||
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_D3DX)
|
||||
struct D3DXCompressorDXT1 : public CompressorInterface
|
||||
{
|
||||
|
@ -1043,22 +1043,12 @@ CompressorInterface * Compressor::Private::chooseCpuCompressor(const Compression
|
||||
}
|
||||
else if (compressionOptions.format == Format_DXT1)
|
||||
{
|
||||
#if defined(HAVE_ATITC)
|
||||
if (compressionOptions.externalCompressor == "ati") return new AtiCompressorDXT1;
|
||||
else
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SQUISH)
|
||||
if (compressionOptions.externalCompressor == "squish") return new SquishCompressorDXT1;
|
||||
else
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_D3DX)
|
||||
if (compressionOptions.externalCompressor == "d3dx") return new D3DXCompressorDXT1;
|
||||
else
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_D3DX)
|
||||
#if defined(HAVE_STB)
|
||||
if (compressionOptions.externalCompressor == "stb") return new StbCompressorDXT1;
|
||||
else
|
||||
#endif
|
||||
@ -1094,11 +1084,6 @@ CompressorInterface * Compressor::Private::chooseCpuCompressor(const Compression
|
||||
}
|
||||
else if (compressionOptions.format == Format_DXT5)
|
||||
{
|
||||
#if defined(HAVE_ATITC)
|
||||
if (compressionOptions.externalCompressor == "ati") return new AtiCompressorDXT5;
|
||||
else
|
||||
#endif
|
||||
|
||||
if (compressionOptions.quality == Quality_Fastest)
|
||||
{
|
||||
return new FastCompressorDXT5;
|
||||
|
@ -1027,21 +1027,6 @@ CubeSurface CubeSurface::fastResample(int size, EdgeFixup fixupMethod) const
|
||||
return resampledCube;
|
||||
}
|
||||
|
||||
|
||||
void CubeSurface::_irradianceFilter(int size, EdgeFixup fixupMethod) {
|
||||
*this = irradianceFilter(size, fixupMethod);
|
||||
}
|
||||
|
||||
void CubeSurface::_cosinePowerFilter(int size, float cosinePower, EdgeFixup fixupMethod) {
|
||||
*this = cosinePowerFilter(size, cosinePower, fixupMethod);
|
||||
}
|
||||
|
||||
void CubeSurface::_fastResample(int size, EdgeFixup fixupMethod) {
|
||||
*this = fastResample(size, fixupMethod);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CubeSurface::toLinear(float gamma)
|
||||
{
|
||||
if (isNull()) return;
|
||||
|
@ -49,7 +49,7 @@
|
||||
# define NVTT_API
|
||||
#endif
|
||||
|
||||
#define NVTT_VERSION 20100
|
||||
#define NVTT_VERSION 20101
|
||||
|
||||
#define NVTT_FORBID_COPY(Class) \
|
||||
private: \
|
||||
@ -463,8 +463,8 @@ namespace nvtt
|
||||
ToneMapper_Lightmap,
|
||||
};
|
||||
|
||||
// Transform the given x,y coordinates.
|
||||
typedef void WarpFunction(float & x, float & y, float & d);
|
||||
// Transform the given x,y,z coordinates.
|
||||
typedef void WarpFunction(float & x, float & y, float & z);
|
||||
|
||||
|
||||
// A surface is one level of a 2D or 3D texture. (New in NVTT 2.1)
|
||||
@ -664,11 +664,6 @@ namespace nvtt
|
||||
|
||||
NVTT_API CubeSurface fastResample(int size, EdgeFixup fixupMethod) const;
|
||||
|
||||
// Jai doesn't support non-pod structs as return types, so expose some other function to do the same, but operate in place:
|
||||
NVTT_API void _irradianceFilter(int size, EdgeFixup fixupMethod);
|
||||
NVTT_API void _cosinePowerFilter(int size, float cosinePower, EdgeFixup fixupMethod);
|
||||
NVTT_API void _fastResample(int size, EdgeFixup fixupMethod);
|
||||
|
||||
// Spherical Harmonics:
|
||||
NVTT_API void computeLuminanceIrradianceSH3(float sh[9]) const;
|
||||
NVTT_API void computeIrradianceSH3(int channel, float sh[9]) const;
|
||||
|
@ -21,8 +21,8 @@
|
||||
#define ICETC_IMPLEMENTATION
|
||||
#include "nvtt/icetc.h"
|
||||
|
||||
#define GOOFYTC_IMPLEMENTATION
|
||||
#include "../extern/goofy_tc.h"
|
||||
//#define GOOFYTC_IMPLEMENTATION
|
||||
//#include "../extern/goofy_tc.h"
|
||||
|
||||
#include "../extern/rg_etc1_v104/rg_etc1.h"
|
||||
#include "../extern/rg_etc1_v104/rg_etc1.cpp"
|
||||
|
Reference in New Issue
Block a user