Merge trunk fixes.
This commit is contained in:
parent
3d1b9324e1
commit
64cbd74ef0
|
@ -3,7 +3,9 @@ NVIDIA Texture Tools version 2.0.2
|
||||||
* Fix indexMirror error reported by Chris Lambert.
|
* Fix indexMirror error reported by Chris Lambert.
|
||||||
* Fix vc8 post build command, reported by Richard Sim.
|
* Fix vc8 post build command, reported by Richard Sim.
|
||||||
* Fix RGBA modes with less than 32 bpp by Viktor Linder.
|
* Fix RGBA modes with less than 32 bpp by Viktor Linder.
|
||||||
* Fix alpha decompression by amorilia. See issue 40.
|
* Fix alpha decompression by Amorilia. See issue 40.
|
||||||
|
* Avoid default-initialized constructors for POD types, reported by Jim Tilander.
|
||||||
|
* Improved decompressor tool submitted by Amorilia. See issue 41.
|
||||||
* Add single color compresor for DXT1a.
|
* Add single color compresor for DXT1a.
|
||||||
|
|
||||||
NVIDIA Texture Tools version 2.0.1
|
NVIDIA Texture Tools version 2.0.1
|
||||||
|
|
|
@ -46,9 +46,9 @@ FIND_LIBRARY (CUDA_RUNTIME_LIBRARY
|
||||||
DOC "The CUDA runtime library")
|
DOC "The CUDA runtime library")
|
||||||
|
|
||||||
IF (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
|
IF (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
|
||||||
SET (CUDA_FOUND 1 CACHE STRING "Set to 1 if CUDA is found, 0 otherwise")
|
SET (CUDA_FOUND TRUE)
|
||||||
ELSE (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
|
ELSE (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
|
||||||
SET (CUDA_FOUND 0 CACHE STRING "Set to 1 if CUDA is found, 0 otherwise")
|
SET (CUDA_FOUND FALSE)
|
||||||
ENDIF (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
|
ENDIF (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
|
||||||
|
|
||||||
SET (CUDA_LIBRARIES ${CUDA_RUNTIME_LIBRARY})
|
SET (CUDA_LIBRARIES ${CUDA_RUNTIME_LIBRARY})
|
||||||
|
|
|
@ -277,14 +277,6 @@
|
||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvmath\Eigen.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvmath\Fitting.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
|
@ -299,14 +291,6 @@
|
||||||
RelativePath="..\..\..\src\nvmath\Color.h"
|
RelativePath="..\..\..\src\nvmath\Color.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvmath\Eigen.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvmath\Fitting.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\nvmath\Matrix.h"
|
RelativePath="..\..\..\src\nvmath\Matrix.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -53,8 +53,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 2,0,1,0
|
FILEVERSION 2,0,2,0
|
||||||
PRODUCTVERSION 2,0,1,0
|
PRODUCTVERSION 2,0,2,0
|
||||||
FILEFLAGSMASK 0x17L
|
FILEFLAGSMASK 0x17L
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -71,12 +71,12 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "NVIDIA Corporation"
|
VALUE "CompanyName", "NVIDIA Corporation"
|
||||||
VALUE "FileDescription", "NVIDIA Texture Tools Dynamic Link Library"
|
VALUE "FileDescription", "NVIDIA Texture Tools Dynamic Link Library"
|
||||||
VALUE "FileVersion", "2, 0, 1, 0"
|
VALUE "FileVersion", "2, 0, 2, 0"
|
||||||
VALUE "InternalName", "nvtt"
|
VALUE "InternalName", "nvtt"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2007"
|
VALUE "LegalCopyright", "Copyright (C) 2007"
|
||||||
VALUE "OriginalFilename", "nvtt.dll"
|
VALUE "OriginalFilename", "nvtt.dll"
|
||||||
VALUE "ProductName", "NVIDIA Texture Tools Dynamic Link Library"
|
VALUE "ProductName", "NVIDIA Texture Tools Dynamic Link Library"
|
||||||
VALUE "ProductVersion", "2, 0, 1, 0"
|
VALUE "ProductVersion", "2, 0, 2, 0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -50,6 +50,7 @@ ENDIF(CG_FOUND)
|
||||||
# CUDA
|
# CUDA
|
||||||
INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
|
INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
|
||||||
IF(CUDA_FOUND)
|
IF(CUDA_FOUND)
|
||||||
|
SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
|
||||||
MESSAGE(STATUS "Looking for CUDA - found")
|
MESSAGE(STATUS "Looking for CUDA - found")
|
||||||
ELSE(CUDA_FOUND)
|
ELSE(CUDA_FOUND)
|
||||||
MESSAGE(STATUS "Looking for CUDA - not found")
|
MESSAGE(STATUS "Looking for CUDA - not found")
|
||||||
|
@ -58,7 +59,7 @@ ENDIF(CUDA_FOUND)
|
||||||
# Maya
|
# Maya
|
||||||
INCLUDE(${NV_CMAKE_DIR}/FindMaya.cmake)
|
INCLUDE(${NV_CMAKE_DIR}/FindMaya.cmake)
|
||||||
IF(MAYA_FOUND)
|
IF(MAYA_FOUND)
|
||||||
SET(HAVE_MAYA MAYA_FOUND)
|
SET(HAVE_MAYA ${MAYA_FOUND} CACHE BOOL "Set to TRUE if Maya is found, FALSE otherwise")
|
||||||
MESSAGE(STATUS "Looking for Maya - found")
|
MESSAGE(STATUS "Looking for Maya - found")
|
||||||
ELSE(MAYA_FOUND)
|
ELSE(MAYA_FOUND)
|
||||||
MESSAGE(STATUS "Looking for Maya - not found")
|
MESSAGE(STATUS "Looking for Maya - not found")
|
||||||
|
@ -67,7 +68,7 @@ ENDIF(MAYA_FOUND)
|
||||||
# JPEG
|
# JPEG
|
||||||
INCLUDE(FindJPEG)
|
INCLUDE(FindJPEG)
|
||||||
IF(JPEG_FOUND)
|
IF(JPEG_FOUND)
|
||||||
SET(HAVE_JPEG JPEG_FOUND)
|
SET(HAVE_JPEG ${JPEG_FOUND} CACHE BOOL "Set to TRUE if JPEG is found, FALSE otherwise")
|
||||||
MESSAGE(STATUS "Looking for JPEG - found")
|
MESSAGE(STATUS "Looking for JPEG - found")
|
||||||
ELSE(JPEG_FOUND)
|
ELSE(JPEG_FOUND)
|
||||||
MESSAGE(STATUS "Looking for JPEG - not found")
|
MESSAGE(STATUS "Looking for JPEG - not found")
|
||||||
|
@ -76,7 +77,7 @@ ENDIF(JPEG_FOUND)
|
||||||
# PNG
|
# PNG
|
||||||
INCLUDE(FindPNG)
|
INCLUDE(FindPNG)
|
||||||
IF(PNG_FOUND)
|
IF(PNG_FOUND)
|
||||||
SET(HAVE_PNG PNG_FOUND)
|
SET(HAVE_PNG ${PNG_FOUND} CACHE BOOL "Set to TRUE if PNG is found, FALSE otherwise")
|
||||||
MESSAGE(STATUS "Looking for PNG - found")
|
MESSAGE(STATUS "Looking for PNG - found")
|
||||||
ELSE(PNG_FOUND)
|
ELSE(PNG_FOUND)
|
||||||
MESSAGE(STATUS "Looking for PNG - not found")
|
MESSAGE(STATUS "Looking for PNG - not found")
|
||||||
|
@ -85,7 +86,7 @@ ENDIF(PNG_FOUND)
|
||||||
# TIFF
|
# TIFF
|
||||||
INCLUDE(FindTIFF)
|
INCLUDE(FindTIFF)
|
||||||
IF(TIFF_FOUND)
|
IF(TIFF_FOUND)
|
||||||
SET(HAVE_TIFF TIFF_FOUND)
|
SET(HAVE_TIFF ${TIFF_FOUND} CACHE BOOL "Set to TRUE if TIFF is found, FALSE otherwise")
|
||||||
MESSAGE(STATUS "Looking for TIFF - found")
|
MESSAGE(STATUS "Looking for TIFF - found")
|
||||||
ELSE(TIFF_FOUND)
|
ELSE(TIFF_FOUND)
|
||||||
MESSAGE(STATUS "Looking for TIFF - not found")
|
MESSAGE(STATUS "Looking for TIFF - not found")
|
||||||
|
@ -94,7 +95,7 @@ ENDIF(TIFF_FOUND)
|
||||||
# OpenEXR
|
# OpenEXR
|
||||||
INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
|
INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
|
||||||
IF(OPENEXR_FOUND)
|
IF(OPENEXR_FOUND)
|
||||||
SET(HAVE_OPENEXR OPENEXR_FOUND)
|
SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
|
||||||
MESSAGE(STATUS "Looking for OpenEXR - found")
|
MESSAGE(STATUS "Looking for OpenEXR - found")
|
||||||
ELSE(OPENEXR_FOUND)
|
ELSE(OPENEXR_FOUND)
|
||||||
MESSAGE(STATUS "Looking for OpenEXR - not found")
|
MESSAGE(STATUS "Looking for OpenEXR - not found")
|
||||||
|
|
|
@ -18,8 +18,6 @@ SET(CORE_SRCS
|
||||||
TextReader.cpp
|
TextReader.cpp
|
||||||
TextWriter.h
|
TextWriter.h
|
||||||
TextWriter.cpp
|
TextWriter.cpp
|
||||||
Tokenizer.h
|
|
||||||
Tokenizer.cpp
|
|
||||||
Radix.h
|
Radix.h
|
||||||
Radix.cpp)
|
Radix.cpp)
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,7 @@ namespace nv
|
||||||
|
|
||||||
// Call default constructors
|
// Call default constructors
|
||||||
for( i = old_size; i < new_size; i++ ) {
|
for( i = old_size; i < new_size; i++ ) {
|
||||||
new(m_buffer+i) T(); // placement new
|
new(m_buffer+i) T; // placement new
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,9 @@ namespace
|
||||||
|
|
||||||
// TODO write minidump
|
// TODO write minidump
|
||||||
|
|
||||||
static LONG WINAPI nvTopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ) {
|
static LONG WINAPI nvTopLevelFilter( struct _EXCEPTION_POINTERS * pExceptionInfo)
|
||||||
|
{
|
||||||
|
NV_UNUSED(pExceptionInfo);
|
||||||
/* BOOL (WINAPI * Dump) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION );
|
/* BOOL (WINAPI * Dump) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION );
|
||||||
|
|
||||||
AutoString dbghelp_path(512);
|
AutoString dbghelp_path(512);
|
||||||
|
|
|
@ -18,6 +18,8 @@ void * nv::mem::malloc(size_t size)
|
||||||
|
|
||||||
void * nv::mem::malloc(size_t size, const char * file, int line)
|
void * nv::mem::malloc(size_t size, const char * file, int line)
|
||||||
{
|
{
|
||||||
|
NV_UNUSED(file);
|
||||||
|
NV_UNUSED(line);
|
||||||
return ::malloc(size);
|
return ::malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@ namespace
|
||||||
static const uint FOURCC_ATI1 = MAKEFOURCC('A', 'T', 'I', '1');
|
static const uint FOURCC_ATI1 = MAKEFOURCC('A', 'T', 'I', '1');
|
||||||
static const uint FOURCC_ATI2 = MAKEFOURCC('A', 'T', 'I', '2');
|
static const uint FOURCC_ATI2 = MAKEFOURCC('A', 'T', 'I', '2');
|
||||||
|
|
||||||
|
static const uint FOURCC_DX10 = MAKEFOURCC('D', 'X', '1', '0');
|
||||||
|
|
||||||
// 32 bit RGB formats.
|
// 32 bit RGB formats.
|
||||||
static const uint D3DFMT_R8G8B8 = 20;
|
static const uint D3DFMT_R8G8B8 = 20;
|
||||||
static const uint D3DFMT_A8R8G8B8 = 21;
|
static const uint D3DFMT_A8R8G8B8 = 21;
|
||||||
|
@ -253,6 +255,144 @@ namespace
|
||||||
D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4,
|
D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const char * getDxgiFormatString(DXGI_FORMAT dxgiFormat)
|
||||||
|
{
|
||||||
|
#define CASE(format) case DXGI_FORMAT_##format: return #format
|
||||||
|
switch(dxgiFormat)
|
||||||
|
{
|
||||||
|
CASE(UNKNOWN);
|
||||||
|
|
||||||
|
CASE(R32G32B32A32_TYPELESS);
|
||||||
|
CASE(R32G32B32A32_FLOAT);
|
||||||
|
CASE(R32G32B32A32_UINT);
|
||||||
|
CASE(R32G32B32A32_SINT);
|
||||||
|
|
||||||
|
CASE(R32G32B32_TYPELESS);
|
||||||
|
CASE(R32G32B32_FLOAT);
|
||||||
|
CASE(R32G32B32_UINT);
|
||||||
|
CASE(R32G32B32_SINT);
|
||||||
|
|
||||||
|
CASE(R16G16B16A16_TYPELESS);
|
||||||
|
CASE(R16G16B16A16_FLOAT);
|
||||||
|
CASE(R16G16B16A16_UNORM);
|
||||||
|
CASE(R16G16B16A16_UINT);
|
||||||
|
CASE(R16G16B16A16_SNORM);
|
||||||
|
CASE(R16G16B16A16_SINT);
|
||||||
|
|
||||||
|
CASE(R32G32_TYPELESS);
|
||||||
|
CASE(R32G32_FLOAT);
|
||||||
|
CASE(R32G32_UINT);
|
||||||
|
CASE(R32G32_SINT);
|
||||||
|
|
||||||
|
CASE(R32G8X24_TYPELESS);
|
||||||
|
CASE(D32_FLOAT_S8X24_UINT);
|
||||||
|
CASE(R32_FLOAT_X8X24_TYPELESS);
|
||||||
|
CASE(X32_TYPELESS_G8X24_UINT);
|
||||||
|
|
||||||
|
CASE(R10G10B10A2_TYPELESS);
|
||||||
|
CASE(R10G10B10A2_UNORM);
|
||||||
|
CASE(R10G10B10A2_UINT);
|
||||||
|
|
||||||
|
CASE(R11G11B10_FLOAT);
|
||||||
|
|
||||||
|
CASE(R8G8B8A8_TYPELESS);
|
||||||
|
CASE(R8G8B8A8_UNORM);
|
||||||
|
CASE(R8G8B8A8_UNORM_SRGB);
|
||||||
|
CASE(R8G8B8A8_UINT);
|
||||||
|
CASE(R8G8B8A8_SNORM);
|
||||||
|
CASE(R8G8B8A8_SINT);
|
||||||
|
|
||||||
|
CASE(R16G16_TYPELESS);
|
||||||
|
CASE(R16G16_FLOAT);
|
||||||
|
CASE(R16G16_UNORM);
|
||||||
|
CASE(R16G16_UINT);
|
||||||
|
CASE(R16G16_SNORM);
|
||||||
|
CASE(R16G16_SINT);
|
||||||
|
|
||||||
|
CASE(R32_TYPELESS);
|
||||||
|
CASE(D32_FLOAT);
|
||||||
|
CASE(R32_FLOAT);
|
||||||
|
CASE(R32_UINT);
|
||||||
|
CASE(R32_SINT);
|
||||||
|
|
||||||
|
CASE(R24G8_TYPELESS);
|
||||||
|
CASE(D24_UNORM_S8_UINT);
|
||||||
|
CASE(R24_UNORM_X8_TYPELESS);
|
||||||
|
CASE(X24_TYPELESS_G8_UINT);
|
||||||
|
|
||||||
|
CASE(R8G8_TYPELESS);
|
||||||
|
CASE(R8G8_UNORM);
|
||||||
|
CASE(R8G8_UINT);
|
||||||
|
CASE(R8G8_SNORM);
|
||||||
|
CASE(R8G8_SINT);
|
||||||
|
|
||||||
|
CASE(R16_TYPELESS);
|
||||||
|
CASE(R16_FLOAT);
|
||||||
|
CASE(D16_UNORM);
|
||||||
|
CASE(R16_UNORM);
|
||||||
|
CASE(R16_UINT);
|
||||||
|
CASE(R16_SNORM);
|
||||||
|
CASE(R16_SINT);
|
||||||
|
|
||||||
|
CASE(R8_TYPELESS);
|
||||||
|
CASE(R8_UNORM);
|
||||||
|
CASE(R8_UINT);
|
||||||
|
CASE(R8_SNORM);
|
||||||
|
CASE(R8_SINT);
|
||||||
|
CASE(A8_UNORM);
|
||||||
|
|
||||||
|
CASE(R1_UNORM);
|
||||||
|
|
||||||
|
CASE(R9G9B9E5_SHAREDEXP);
|
||||||
|
|
||||||
|
CASE(R8G8_B8G8_UNORM);
|
||||||
|
CASE(G8R8_G8B8_UNORM);
|
||||||
|
|
||||||
|
CASE(BC1_TYPELESS);
|
||||||
|
CASE(BC1_UNORM);
|
||||||
|
CASE(BC1_UNORM_SRGB);
|
||||||
|
|
||||||
|
CASE(BC2_TYPELESS);
|
||||||
|
CASE(BC2_UNORM);
|
||||||
|
CASE(BC2_UNORM_SRGB);
|
||||||
|
|
||||||
|
CASE(BC3_TYPELESS);
|
||||||
|
CASE(BC3_UNORM);
|
||||||
|
CASE(BC3_UNORM_SRGB);
|
||||||
|
|
||||||
|
CASE(BC4_TYPELESS);
|
||||||
|
CASE(BC4_UNORM);
|
||||||
|
CASE(BC4_SNORM);
|
||||||
|
|
||||||
|
CASE(BC5_TYPELESS);
|
||||||
|
CASE(BC5_UNORM);
|
||||||
|
CASE(BC5_SNORM);
|
||||||
|
|
||||||
|
CASE(B5G6R5_UNORM);
|
||||||
|
CASE(B5G5R5A1_UNORM);
|
||||||
|
CASE(B8G8R8A8_UNORM);
|
||||||
|
CASE(B8G8R8X8_UNORM);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
#undef CASE
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension)
|
||||||
|
{
|
||||||
|
switch(resourceDimension)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case D3D10_RESOURCE_DIMENSION_UNKNOWN: return "UNKNOWN";
|
||||||
|
case D3D10_RESOURCE_DIMENSION_BUFFER: return "BUFFER";
|
||||||
|
case D3D10_RESOURCE_DIMENSION_TEXTURE1D: return "TEXTURE1D";
|
||||||
|
case D3D10_RESOURCE_DIMENSION_TEXTURE2D: return "TEXTURE2D";
|
||||||
|
case D3D10_RESOURCE_DIMENSION_TEXTURE3D: return "TEXTURE3D";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace nv
|
namespace nv
|
||||||
|
@ -545,7 +685,8 @@ void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask
|
||||||
|
|
||||||
void DDSHeader::setDX10Format(uint format)
|
void DDSHeader::setDX10Format(uint format)
|
||||||
{
|
{
|
||||||
this->pf.flags = 0;
|
//this->pf.flags = 0;
|
||||||
|
this->pf.fourcc = FOURCC_DX10;
|
||||||
this->header10.dxgiFormat = format;
|
this->header10.dxgiFormat = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +734,8 @@ void DDSHeader::swapBytes()
|
||||||
|
|
||||||
bool DDSHeader::hasDX10Header() const
|
bool DDSHeader::hasDX10Header() const
|
||||||
{
|
{
|
||||||
return this->pf.flags == 0;
|
return this->pf.fourcc == FOURCC_DX10; // @@ This is according to AMD
|
||||||
|
//return this->pf.flags == 0; // @@ This is according to MS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -623,7 +765,7 @@ bool DirectDrawSurface::isValid() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint required = (DDSD_WIDTH|DDSD_HEIGHT|DDSD_CAPS|DDSD_PIXELFORMAT);
|
const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/);
|
||||||
if( (header.flags & required) != required ) {
|
if( (header.flags & required) != required ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -643,40 +785,46 @@ bool DirectDrawSurface::isSupported() const
|
||||||
{
|
{
|
||||||
nvDebugCheck(isValid());
|
nvDebugCheck(isValid());
|
||||||
|
|
||||||
if (header.pf.flags & DDPF_FOURCC)
|
if (header.hasDX10Header())
|
||||||
{
|
{
|
||||||
if (header.pf.fourcc != FOURCC_DXT1 &&
|
|
||||||
header.pf.fourcc != FOURCC_DXT2 &&
|
|
||||||
header.pf.fourcc != FOURCC_DXT3 &&
|
|
||||||
header.pf.fourcc != FOURCC_DXT4 &&
|
|
||||||
header.pf.fourcc != FOURCC_DXT5 &&
|
|
||||||
header.pf.fourcc != FOURCC_RXGB &&
|
|
||||||
header.pf.fourcc != FOURCC_ATI1 &&
|
|
||||||
header.pf.fourcc != FOURCC_ATI2)
|
|
||||||
{
|
|
||||||
// Unknown fourcc code.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (header.pf.flags & DDPF_RGB)
|
|
||||||
{
|
|
||||||
// All RGB formats are supported now.
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
if (header.pf.flags & DDPF_FOURCC)
|
||||||
}
|
{
|
||||||
|
if (header.pf.fourcc != FOURCC_DXT1 &&
|
||||||
|
header.pf.fourcc != FOURCC_DXT2 &&
|
||||||
|
header.pf.fourcc != FOURCC_DXT3 &&
|
||||||
|
header.pf.fourcc != FOURCC_DXT4 &&
|
||||||
|
header.pf.fourcc != FOURCC_DXT5 &&
|
||||||
|
header.pf.fourcc != FOURCC_RXGB &&
|
||||||
|
header.pf.fourcc != FOURCC_ATI1 &&
|
||||||
|
header.pf.fourcc != FOURCC_ATI2)
|
||||||
|
{
|
||||||
|
// Unknown fourcc code.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (header.pf.flags & DDPF_RGB)
|
||||||
|
{
|
||||||
|
// All RGB formats are supported now.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isTextureCube() && (header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES)
|
if (isTextureCube() && (header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES)
|
||||||
{
|
{
|
||||||
// Cubemaps must contain all faces.
|
// Cubemaps must contain all faces.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTexture3D())
|
if (isTexture3D())
|
||||||
{
|
{
|
||||||
// @@ 3D textures not supported yet.
|
// @@ 3D textures not supported yet.
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -712,16 +860,40 @@ uint DirectDrawSurface::depth() const
|
||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DirectDrawSurface::isTexture1D() const
|
||||||
|
{
|
||||||
|
nvDebugCheck(isValid());
|
||||||
|
if (header.hasDX10Header())
|
||||||
|
{
|
||||||
|
return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE1D;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool DirectDrawSurface::isTexture2D() const
|
bool DirectDrawSurface::isTexture2D() const
|
||||||
{
|
{
|
||||||
nvDebugCheck(isValid());
|
nvDebugCheck(isValid());
|
||||||
return !isTexture3D() && !isTextureCube();
|
if (header.hasDX10Header())
|
||||||
|
{
|
||||||
|
return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE2D;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return !isTexture3D() && !isTextureCube();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DirectDrawSurface::isTexture3D() const
|
bool DirectDrawSurface::isTexture3D() const
|
||||||
{
|
{
|
||||||
nvDebugCheck(isValid());
|
nvDebugCheck(isValid());
|
||||||
return (header.caps.caps2 & DDSCAPS2_VOLUME) != 0;
|
if (header.hasDX10Header())
|
||||||
|
{
|
||||||
|
return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE3D;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (header.caps.caps2 & DDSCAPS2_VOLUME) != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DirectDrawSurface::isTextureCube() const
|
bool DirectDrawSurface::isTextureCube() const
|
||||||
|
@ -730,6 +902,12 @@ bool DirectDrawSurface::isTextureCube() const
|
||||||
return (header.caps.caps2 & DDSCAPS2_CUBEMAP) != 0;
|
return (header.caps.caps2 & DDSCAPS2_CUBEMAP) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DirectDrawSurface::setNormalFlag(bool b)
|
||||||
|
{
|
||||||
|
nvDebugCheck(isValid());
|
||||||
|
header.setNormalFlag(b);
|
||||||
|
}
|
||||||
|
|
||||||
void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
|
void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
|
||||||
{
|
{
|
||||||
nvDebugCheck(isValid());
|
nvDebugCheck(isValid());
|
||||||
|
@ -780,7 +958,13 @@ void DirectDrawSurface::readLinearImage(Image * img)
|
||||||
|
|
||||||
uint byteCount = (header.pf.bitcount + 7) / 8;
|
uint byteCount = (header.pf.bitcount + 7) / 8;
|
||||||
|
|
||||||
if (header.pf.amask != 0)
|
// set image format: RGB or ARGB
|
||||||
|
// alpha channel exists if and only if the alpha mask is non-zero
|
||||||
|
if (header.pf.amask == 0)
|
||||||
|
{
|
||||||
|
img->setFormat(Image::Format_RGB);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
img->setFormat(Image::Format_ARGB);
|
img->setFormat(Image::Format_ARGB);
|
||||||
}
|
}
|
||||||
|
@ -809,6 +993,19 @@ void DirectDrawSurface::readBlockImage(Image * img)
|
||||||
nvDebugCheck(stream != NULL);
|
nvDebugCheck(stream != NULL);
|
||||||
nvDebugCheck(img != NULL);
|
nvDebugCheck(img != NULL);
|
||||||
|
|
||||||
|
// set image format: RGB or ARGB
|
||||||
|
if (header.pf.fourcc == FOURCC_RXGB ||
|
||||||
|
header.pf.fourcc == FOURCC_ATI1 ||
|
||||||
|
header.pf.fourcc == FOURCC_ATI2 ||
|
||||||
|
header.pf.flags & DDPF_NORMAL)
|
||||||
|
{
|
||||||
|
img->setFormat(Image::Format_RGB);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
img->setFormat(Image::Format_ARGB);
|
||||||
|
}
|
||||||
|
|
||||||
const uint w = img->width();
|
const uint w = img->width();
|
||||||
const uint h = img->height();
|
const uint h = img->height();
|
||||||
|
|
||||||
|
@ -1044,8 +1241,23 @@ void DirectDrawSurface::printInfo() const
|
||||||
if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n");
|
if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n");
|
||||||
if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
|
if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
|
||||||
|
|
||||||
printf("\tFourCC: '%c%c%c%c'\n", ((header.pf.fourcc >> 0) & 0xFF), ((header.pf.fourcc >> 8) & 0xFF), ((header.pf.fourcc >> 16) & 0xFF), ((header.pf.fourcc >> 24) & 0xFF));
|
printf("\tFourCC: '%c%c%c%c'\n",
|
||||||
printf("\tBit count: %d\n", header.pf.bitcount);
|
((header.pf.fourcc >> 0) & 0xFF),
|
||||||
|
((header.pf.fourcc >> 8) & 0xFF),
|
||||||
|
((header.pf.fourcc >> 16) & 0xFF),
|
||||||
|
((header.pf.fourcc >> 24) & 0xFF));
|
||||||
|
if ((header.pf.fourcc & DDPF_FOURCC) && (header.pf.bitcount != 0))
|
||||||
|
{
|
||||||
|
printf("\tSwizzle: '%c%c%c%c'\n",
|
||||||
|
(header.pf.bitcount >> 0) & 0xFF,
|
||||||
|
(header.pf.bitcount >> 8) & 0xFF,
|
||||||
|
(header.pf.bitcount >> 16) & 0xFF,
|
||||||
|
(header.pf.bitcount >> 24) & 0xFF);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\tBit count: %d\n", header.pf.bitcount);
|
||||||
|
}
|
||||||
printf("\tRed mask: 0x%.8X\n", header.pf.rmask);
|
printf("\tRed mask: 0x%.8X\n", header.pf.rmask);
|
||||||
printf("\tGreen mask: 0x%.8X\n", header.pf.gmask);
|
printf("\tGreen mask: 0x%.8X\n", header.pf.gmask);
|
||||||
printf("\tBlue mask: 0x%.8X\n", header.pf.bmask);
|
printf("\tBlue mask: 0x%.8X\n", header.pf.bmask);
|
||||||
|
@ -1076,11 +1288,11 @@ void DirectDrawSurface::printInfo() const
|
||||||
printf("\tCaps 3: 0x%.8X\n", header.caps.caps3);
|
printf("\tCaps 3: 0x%.8X\n", header.caps.caps3);
|
||||||
printf("\tCaps 4: 0x%.8X\n", header.caps.caps4);
|
printf("\tCaps 4: 0x%.8X\n", header.caps.caps4);
|
||||||
|
|
||||||
if (header.pf.flags == 0)
|
if (header.hasDX10Header())
|
||||||
{
|
{
|
||||||
printf("DX10 Header:\n");
|
printf("DX10 Header:\n");
|
||||||
printf("\tDXGI Format: %u\n", header.header10.dxgiFormat);
|
printf("\tDXGI Format: %u (%s)\n", header.header10.dxgiFormat, getDxgiFormatString((DXGI_FORMAT)header.header10.dxgiFormat));
|
||||||
printf("\tResource dimension: %u\n", header.header10.resourceDimension);
|
printf("\tResource dimension: %u (%s)\n", header.header10.resourceDimension, getD3d10ResourceDimensionString((D3D10_RESOURCE_DIMENSION)header.header10.resourceDimension));
|
||||||
printf("\tMisc flag: %u\n", header.header10.miscFlag);
|
printf("\tMisc flag: %u\n", header.header10.miscFlag);
|
||||||
printf("\tArray size: %u\n", header.header10.arraySize);
|
printf("\tArray size: %u\n", header.header10.arraySize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,10 +119,13 @@ namespace nv
|
||||||
uint width() const;
|
uint width() const;
|
||||||
uint height() const;
|
uint height() const;
|
||||||
uint depth() const;
|
uint depth() const;
|
||||||
|
bool isTexture1D() const;
|
||||||
bool isTexture2D() const;
|
bool isTexture2D() const;
|
||||||
bool isTexture3D() const;
|
bool isTexture3D() const;
|
||||||
bool isTextureCube() const;
|
bool isTextureCube() const;
|
||||||
|
|
||||||
|
void setNormalFlag(bool b);
|
||||||
|
|
||||||
void mipmap(Image * img, uint f, uint m);
|
void mipmap(Image * img, uint f, uint m);
|
||||||
// void mipmap(FloatImage * img, uint f, uint m);
|
// void mipmap(FloatImage * img, uint f, uint m);
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,6 @@ NVTT_API void nvttDestroyCompressionOptions(NvttCompressionOptions * compression
|
||||||
NVTT_API void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format);
|
NVTT_API void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format);
|
||||||
NVTT_API void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality);
|
NVTT_API void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality);
|
||||||
NVTT_API void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha);
|
NVTT_API void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha);
|
||||||
NVTT_API void nvttEnableCompressionOptionsCudaCompression(NvttCompressionOptions * compressionOptions, NvttBoolean enable);
|
|
||||||
NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
|
NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
|
||||||
NVTT_API void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold);
|
NVTT_API void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user