diff options
Diffstat (limited to 'DevIL/src-IL/src/il_dds.cpp')
-rw-r--r-- | DevIL/src-IL/src/il_dds.cpp | 411 |
1 files changed, 325 insertions, 86 deletions
diff --git a/DevIL/src-IL/src/il_dds.cpp b/DevIL/src-IL/src/il_dds.cpp index 580faed1..daaec723 100644 --- a/DevIL/src-IL/src/il_dds.cpp +++ b/DevIL/src-IL/src/il_dds.cpp @@ -4,7 +4,7 @@ // Copyright (C) 2000-2017 by Denton Woods // Last modified: 02/28/2009 // -// Filename: src-IL/src/il_dds.c +// Filename: src-IL/src/il_dds.cpp // // Description: Reads from a DirectDraw Surface (.dds) file. // @@ -30,7 +30,9 @@ // Global variables +//@TODO: Move these out of global space static DDSHEAD Head; // Image header +static DXT10HEAD HeadDXT10; // DirectX 10 extension header static ILubyte *CompData = NULL; // Compressed data static ILuint CompSize; // Compressed size //static ILuint CompFormat; // Compressed format @@ -134,6 +136,19 @@ ILboolean iGetDdsHead(DDSHEAD *Header) } +// Internal function used to get the DirectX 10 DDS header extension (24 bytes) +ILboolean iGetDXT10Head(DXT10HEAD *Header) +{ + Header->dxgiFormat = GetLittleUInt(); + Header->resourceDimension = GetLittleUInt(); + Header->miscFlag = GetLittleUInt(); + Header->arraySize = GetLittleUInt(); + Header->miscFlags2 = GetLittleUInt(); + + return IL_TRUE; +} + + // Internal function to get the header and check it. ILboolean iIsValidDds() { @@ -167,6 +182,19 @@ ILboolean iCheckDds(DDSHEAD *Head) } +// Internal function used to check if the HEADER is a valid DirectX 10 extension header. +ILboolean iCheckDxt10(DXT10HEAD *Head) +{ + if (Head->resourceDimension < 2 && Head->resourceDimension > 4) + return IL_FALSE; + if (Head->dxgiFormat > DXGI_FORMAT_V408) + return IL_FALSE; + if (Head->arraySize > 1) //@TODO: Support texture arrays + return IL_FALSE; + return IL_TRUE; +} + + //! Reads a .dds file ILboolean ilLoadDds(ILconst_string FileName) { @@ -281,18 +309,21 @@ ILubyte iCompFormatToChannelCount(ILenum Format) } -ILboolean iLoadDdsCubemapInternal(ILuint CompFormat) +ILboolean iLoadDdsCubemapInternal(ILuint CompFormat, ILboolean IsDXT10) { ILuint i; ILubyte Bpp, Channels, Bpc; ILimage *startImage; + if (IsDXT10) //@TODO: Get this working with the DirectX 10 textures + return IL_FALSE; + CompData = NULL; Bpp = iCompFormatToBpp(CompFormat); Channels = iCompFormatToChannelCount(CompFormat); Bpc = iCompFormatToBpc(CompFormat); - if (CompFormat == PF_LUMINANCE && Head.RGBBitCount == 16 && Head.RBitMask == 0xFFFF) { //@TODO: This is a HACK. + if (CompFormat == PF_LUMINANCE && Head.RGBBitCount == 16 && Head.RBitMask == 0xFFFF) { //@TODO: This is a HACK. Bpc = 2; Bpp = 2; } @@ -328,10 +359,10 @@ ILboolean iLoadDdsCubemapInternal(ILuint CompFormat) ilActiveFace(i); } - if (!ReadData()) + if (!ReadData(CompFormat, IsDXT10)) return IL_FALSE; - if (!AllocImage(CompFormat)) { + if (!AllocImage(CompFormat, IsDXT10)) { if (CompData) { ifree(CompData); CompData = NULL; @@ -341,7 +372,7 @@ ILboolean iLoadDdsCubemapInternal(ILuint CompFormat) Image->CubeFlags = CubemapDirections[i]; - if (!DdsDecompress(CompFormat)) { + if (!DdsDecompress(CompFormat, IsDXT10)) { if (CompData) { ifree(CompData); CompData = NULL; @@ -349,7 +380,7 @@ ILboolean iLoadDdsCubemapInternal(ILuint CompFormat) return IL_FALSE; } - if (!ReadMipmaps(CompFormat)) { + if (!ReadMipmaps(CompFormat, IsDXT10)) { if (CompData) { ifree(CompData); CompData = NULL; @@ -371,8 +402,9 @@ ILboolean iLoadDdsCubemapInternal(ILuint CompFormat) ILboolean iLoadDdsInternal() { - ILuint BlockSize = 0; - ILuint CompFormat; + ILuint BlockSize = 0; + ILuint CompFormat; + ILboolean IsDXT10 = IL_FALSE; CompData = NULL; Image = NULL; @@ -396,6 +428,25 @@ ILboolean iLoadDdsInternal() ilSetError(IL_INVALID_FILE_HEADER); return IL_FALSE; } + + if (CompFormat == PF_DX10) { + IsDXT10 = IL_TRUE; + if (!iGetDXT10Head(&HeadDXT10)) { + ilSetError(IL_INVALID_FILE_HEADER); + return IL_FALSE; + } + if (!iCheckDxt10(&HeadDXT10)) { + ilSetError(IL_INVALID_FILE_HEADER); + return IL_FALSE; + } + + CompFormat = HeadDXT10.dxgiFormat; + } + else + { + } + + // Needed for DXT10? Check16BitComponents(&Head); // Microsoft bug, they're not following their own documentation. @@ -408,7 +459,7 @@ ILboolean iLoadDdsInternal() Image = iCurImage; if (Head.ddsCaps1 & DDS_COMPLEX) { if (Head.ddsCaps2 & DDS_CUBEMAP) { - if (!iLoadDdsCubemapInternal(CompFormat)) + if (!iLoadDdsCubemapInternal(CompFormat, IsDXT10)) return IL_FALSE; return IL_TRUE; } @@ -417,18 +468,18 @@ ILboolean iLoadDdsInternal() Width = Head.Width; Height = Head.Height; Depth = Head.Depth; - AdjustVolumeTexture(&Head, CompFormat); + AdjustVolumeTexture(&Head, CompFormat, IsDXT10); - if (!ReadData()) + if (!ReadData(CompFormat, IsDXT10)) return IL_FALSE; - if (!AllocImage(CompFormat)) { + if (!AllocImage(CompFormat, IsDXT10)) { if (CompData) { ifree(CompData); CompData = NULL; } return IL_FALSE; } - if (!DdsDecompress(CompFormat)) { + if (!DdsDecompress(CompFormat, IsDXT10)) { if (CompData) { ifree(CompData); CompData = NULL; @@ -436,7 +487,7 @@ ILboolean iLoadDdsInternal() return IL_FALSE; } - if (!ReadMipmaps(CompFormat)) { + if (!ReadMipmaps(CompFormat, IsDXT10)) { if (CompData) { ifree(CompData); CompData = NULL; @@ -487,6 +538,10 @@ ILuint DecodePixelFormat(ILuint *CompFormat) BlockSize *= 16; break; + case IL_MAKEFOURCC('D', 'X', '1', '0'): + *CompFormat = PF_DX10; + break; + case IL_MAKEFOURCC('A', 'T', 'I', '1'): *CompFormat = PF_ATI1N; BlockSize *= 8; @@ -565,12 +620,147 @@ ILuint DecodePixelFormat(ILuint *CompFormat) } +// From https://msdn.microsoft.com/en-us/windows/uwp/gaming/complete-code-for-ddstextureloader +// +//-------------------------------------------------------------------------------------- +// Return the BPP for a particular format. +//-------------------------------------------------------------------------------------- +static size_t BitsPerPixel(_In_ DXGI_FORMAT fmt) +{ + switch (fmt) + { + case DXGI_FORMAT_R32G32B32A32_TYPELESS: + case DXGI_FORMAT_R32G32B32A32_FLOAT: + case DXGI_FORMAT_R32G32B32A32_UINT: + case DXGI_FORMAT_R32G32B32A32_SINT: + return 128; + + case DXGI_FORMAT_R32G32B32_TYPELESS: + case DXGI_FORMAT_R32G32B32_FLOAT: + case DXGI_FORMAT_R32G32B32_UINT: + case DXGI_FORMAT_R32G32B32_SINT: + return 96; + + case DXGI_FORMAT_R16G16B16A16_TYPELESS: + case DXGI_FORMAT_R16G16B16A16_FLOAT: + case DXGI_FORMAT_R16G16B16A16_UNORM: + case DXGI_FORMAT_R16G16B16A16_UINT: + case DXGI_FORMAT_R16G16B16A16_SNORM: + case DXGI_FORMAT_R16G16B16A16_SINT: + case DXGI_FORMAT_R32G32_TYPELESS: + case DXGI_FORMAT_R32G32_FLOAT: + case DXGI_FORMAT_R32G32_UINT: + case DXGI_FORMAT_R32G32_SINT: + case DXGI_FORMAT_R32G8X24_TYPELESS: + case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: + case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: + case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: + return 64; + + case DXGI_FORMAT_R10G10B10A2_TYPELESS: + case DXGI_FORMAT_R10G10B10A2_UNORM: + case DXGI_FORMAT_R10G10B10A2_UINT: + case DXGI_FORMAT_R11G11B10_FLOAT: + case DXGI_FORMAT_R8G8B8A8_TYPELESS: + case DXGI_FORMAT_R8G8B8A8_UNORM: + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + case DXGI_FORMAT_R8G8B8A8_UINT: + case DXGI_FORMAT_R8G8B8A8_SNORM: + case DXGI_FORMAT_R8G8B8A8_SINT: + case DXGI_FORMAT_R16G16_TYPELESS: + case DXGI_FORMAT_R16G16_FLOAT: + case DXGI_FORMAT_R16G16_UNORM: + case DXGI_FORMAT_R16G16_UINT: + case DXGI_FORMAT_R16G16_SNORM: + case DXGI_FORMAT_R16G16_SINT: + case DXGI_FORMAT_R32_TYPELESS: + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_R32_FLOAT: + case DXGI_FORMAT_R32_UINT: + case DXGI_FORMAT_R32_SINT: + case DXGI_FORMAT_R24G8_TYPELESS: + case DXGI_FORMAT_D24_UNORM_S8_UINT: + case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: + case DXGI_FORMAT_X24_TYPELESS_G8_UINT: + case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: + case DXGI_FORMAT_R8G8_B8G8_UNORM: + case DXGI_FORMAT_G8R8_G8B8_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM: + case DXGI_FORMAT_B8G8R8X8_UNORM: + case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: + case DXGI_FORMAT_B8G8R8A8_TYPELESS: + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + case DXGI_FORMAT_B8G8R8X8_TYPELESS: + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: + return 32; + + case DXGI_FORMAT_R8G8_TYPELESS: + case DXGI_FORMAT_R8G8_UNORM: + case DXGI_FORMAT_R8G8_UINT: + case DXGI_FORMAT_R8G8_SNORM: + case DXGI_FORMAT_R8G8_SINT: + case DXGI_FORMAT_R16_TYPELESS: + case DXGI_FORMAT_R16_FLOAT: + case DXGI_FORMAT_D16_UNORM: + case DXGI_FORMAT_R16_UNORM: + case DXGI_FORMAT_R16_UINT: + case DXGI_FORMAT_R16_SNORM: + case DXGI_FORMAT_R16_SINT: + case DXGI_FORMAT_B5G6R5_UNORM: + case DXGI_FORMAT_B5G5R5A1_UNORM: + case DXGI_FORMAT_B4G4R4A4_UNORM: + return 16; + + case DXGI_FORMAT_R8_TYPELESS: + case DXGI_FORMAT_R8_UNORM: + case DXGI_FORMAT_R8_UINT: + case DXGI_FORMAT_R8_SNORM: + case DXGI_FORMAT_R8_SINT: + case DXGI_FORMAT_A8_UNORM: + return 8; + + case DXGI_FORMAT_R1_UNORM: + return 1; + + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT_BC4_SNORM: + return 4; + + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT_BC5_SNORM: + case DXGI_FORMAT_BC6H_TYPELESS: + case DXGI_FORMAT_BC6H_UF16: + case DXGI_FORMAT_BC6H_SF16: + case DXGI_FORMAT_BC7_TYPELESS: + case DXGI_FORMAT_BC7_UNORM: + case DXGI_FORMAT_BC7_UNORM_SRGB: + return 8; + + default: + return 0; + } +} + + // The few volume textures that I have don't have consistent LinearSize // entries, even though the DDS_LINEARSIZE flag is set. -void AdjustVolumeTexture(DDSHEAD *Head, ILuint CompFormat) +void AdjustVolumeTexture(DDSHEAD *Head, ILuint CompFormat, ILboolean IsDXT10) { if (Head->Depth <= 1) return; + if (IsDXT10) + return; // All volume textures I've seem so far didn't have the DDS_COMPLEX flag set, // even though this is normally required. But because noone does set it, @@ -627,7 +817,7 @@ void AdjustVolumeTexture(DDSHEAD *Head, ILuint CompFormat) // Reads the compressed data -ILboolean ReadData() +ILboolean ReadData(ILuint CompFormat, ILboolean IsDXT10) { ILuint Bps; ILint y, z; @@ -653,8 +843,15 @@ ILboolean ReadData() } } else { - Bps = Width * Head.RGBBitCount / 8; + if (IsDXT10) + Bps = Head.LinearSize; //@TODO: Head.RGBBitCount is always 0 from the texconv.exe tool? + else + Bps = Width * Head.RGBBitCount / 8; CompSize = Bps * Height * Depth; + if (CompSize == 0) { + ilSetError(IL_INVALID_FILE_HEADER); + return IL_FALSE; + } CompData = (ILubyte*)ialloc(CompSize); if (CompData == NULL) { @@ -678,85 +875,110 @@ ILboolean ReadData() } -ILboolean AllocImage(ILuint CompFormat) +ILboolean AllocImage(ILuint CompFormat, ILboolean IsDXT10) { ILubyte channels = 4; ILenum format = IL_RGBA; - switch (CompFormat) + if (!IsDXT10) { - case PF_RGB: - if (!ilTexImage(Width, Height, Depth, 3, IL_RGB, IL_UNSIGNED_BYTE, NULL)) - return IL_FALSE; - break; - case PF_ARGB: - if (!ilTexImage(Width, Height, Depth, 4, IL_RGBA, Has16BitComponents ? IL_UNSIGNED_SHORT : IL_UNSIGNED_BYTE, NULL)) - return IL_FALSE; - break; + switch (CompFormat) + { + case PF_RGB: + if (!ilTexImage(Width, Height, Depth, 3, IL_RGB, IL_UNSIGNED_BYTE, NULL)) + return IL_FALSE; + break; + case PF_ARGB: + if (!ilTexImage(Width, Height, Depth, 4, IL_RGBA, Has16BitComponents ? IL_UNSIGNED_SHORT : IL_UNSIGNED_BYTE, NULL)) + return IL_FALSE; + break; - case PF_LUMINANCE: - if (Head.RGBBitCount == 16 && Head.RBitMask == 0xFFFF) { //HACK - if (!ilTexImage(Width, Height, Depth, 1, IL_LUMINANCE, IL_UNSIGNED_SHORT, NULL)) + case PF_LUMINANCE: + if (Head.RGBBitCount == 16 && Head.RBitMask == 0xFFFF) { //HACK + if (!ilTexImage(Width, Height, Depth, 1, IL_LUMINANCE, IL_UNSIGNED_SHORT, NULL)) + return IL_FALSE; + } + else + if (!ilTexImage(Width, Height, Depth, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, NULL)) + return IL_FALSE; + break; + + case PF_LUMINANCE_ALPHA: + if (!ilTexImage(Width, Height, Depth, 2, IL_LUMINANCE_ALPHA, IL_UNSIGNED_BYTE, NULL)) return IL_FALSE; - } - else + break; + + case PF_ATI1N: + //right now there's no OpenGL api to use the compressed 3dc data, so + //throw it away (I don't know how DirectX works, though)? if (!ilTexImage(Width, Height, Depth, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, NULL)) return IL_FALSE; - break; - - case PF_LUMINANCE_ALPHA: - if (!ilTexImage(Width, Height, Depth, 2, IL_LUMINANCE_ALPHA, IL_UNSIGNED_BYTE, NULL)) - return IL_FALSE; - break; + break; - case PF_ATI1N: - //right now there's no OpenGL api to use the compressed 3dc data, so - //throw it away (I don't know how DirectX works, though)? - if (!ilTexImage(Width, Height, Depth, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, NULL)) - return IL_FALSE; - break; + case PF_3DC: + //right now there's no OpenGL api to use the compressed 3dc data, so + //throw it away (I don't know how DirectX works, though)? + if (!ilTexImage(Width, Height, Depth, 3, IL_RGB, IL_UNSIGNED_BYTE, NULL)) + return IL_FALSE; + break; - case PF_3DC: - //right now there's no OpenGL api to use the compressed 3dc data, so - //throw it away (I don't know how DirectX works, though)? - if (!ilTexImage(Width, Height, Depth, 3, IL_RGB, IL_UNSIGNED_BYTE, NULL)) - return IL_FALSE; - break; + case PF_A16B16G16R16: + if (!ilTexImage(Width, Height, Depth, iCompFormatToChannelCount(CompFormat), + ilGetFormatBpp(iCompFormatToChannelCount(CompFormat)), IL_UNSIGNED_SHORT, NULL)) + return IL_FALSE; + break; - case PF_A16B16G16R16: - if (!ilTexImage(Width, Height, Depth, iCompFormatToChannelCount(CompFormat), - ilGetFormatBpp(iCompFormatToChannelCount(CompFormat)), IL_UNSIGNED_SHORT, NULL)) - return IL_FALSE; - break; + case PF_R16F: + case PF_G16R16F: + case PF_A16B16G16R16F: + case PF_R32F: + case PF_G32R32F: + case PF_A32B32G32R32F: + if (!ilTexImage(Width, Height, Depth, iCompFormatToChannelCount(CompFormat), + ilGetFormatBpp(iCompFormatToChannelCount(CompFormat)), IL_FLOAT, NULL)) + return IL_FALSE; + break; - case PF_R16F: - case PF_G16R16F: - case PF_A16B16G16R16F: - case PF_R32F: - case PF_G32R32F: - case PF_A32B32G32R32F: - if (!ilTexImage(Width, Height, Depth, iCompFormatToChannelCount(CompFormat), - ilGetFormatBpp(iCompFormatToChannelCount(CompFormat)), IL_FLOAT, NULL)) - return IL_FALSE; - break; + default: + if (CompFormat == PF_RXGB) { + channels = 3; //normal map + format = IL_RGB; + } - default: - if (CompFormat == PF_RXGB) { - channels = 3; //normal map - format = IL_RGB; - } + if (!ilTexImage(Width, Height, Depth, channels, format, IL_UNSIGNED_BYTE, NULL)) + return IL_FALSE; + if (ilGetInteger(IL_KEEP_DXTC_DATA) == IL_TRUE && CompData) { + iCurImage->DxtcData = (ILubyte*)ialloc(Head.LinearSize); + if (iCurImage->DxtcData == NULL) + return IL_FALSE; + iCurImage->DxtcFormat = CompFormat - PF_DXT1 + IL_DXT1; + iCurImage->DxtcSize = Head.LinearSize; + memcpy(iCurImage->DxtcData, CompData, iCurImage->DxtcSize); + } + break; + } + } + else + { + switch (CompFormat) + { + case DXGI_FORMAT_R8G8B8A8_UNORM: + if (!ilTexImage(Width, Height, Depth, 4, IL_RGBA, Has16BitComponents ? IL_UNSIGNED_SHORT : IL_UNSIGNED_BYTE, NULL)) + return IL_FALSE; + break; + case DXGI_FORMAT_B8G8R8A8_UNORM: + if (!ilTexImage(Width, Height, Depth, 4, IL_BGRA, Has16BitComponents ? IL_UNSIGNED_SHORT : IL_UNSIGNED_BYTE, NULL)) + return IL_FALSE; + break; + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + if (!ilTexImage(Width, Height, Depth, 4, IL_BGRA, Has16BitComponents ? IL_UNSIGNED_SHORT : IL_UNSIGNED_BYTE, NULL)) + return IL_FALSE; + break; - if (!ilTexImage(Width, Height, Depth, channels, format, IL_UNSIGNED_BYTE, NULL)) + default: + ilSetError(IL_INVALID_FILE_HEADER); return IL_FALSE; - if (ilGetInteger(IL_KEEP_DXTC_DATA) == IL_TRUE && CompData) { - iCurImage->DxtcData = (ILubyte*)ialloc(Head.LinearSize); - if (iCurImage->DxtcData == NULL) - return IL_FALSE; - iCurImage->DxtcFormat = CompFormat - PF_DXT1 + IL_DXT1; - iCurImage->DxtcSize = Head.LinearSize; - memcpy(iCurImage->DxtcData, CompData, iCurImage->DxtcSize); - } - break; + } } Image->Origin = IL_ORIGIN_UPPER_LEFT; @@ -779,8 +1001,13 @@ ILboolean AllocImage(ILuint CompFormat) * * @TODO: don't use globals, clean this function (and this file) up */ -ILboolean DdsDecompress(ILuint CompFormat) +ILboolean DdsDecompress(ILuint CompFormat, ILboolean IsDXT10) { + if (IsDXT10) + { //@TODO: Put in compressed formats + return DecompressARGBDX10(CompFormat); + } + switch (CompFormat) { case PF_ARGB: @@ -833,7 +1060,7 @@ ILboolean DdsDecompress(ILuint CompFormat) } -ILboolean ReadMipmaps(ILuint CompFormat) +ILboolean ReadMipmaps(ILuint CompFormat, ILboolean IsDXT10) { ILuint i, CompFactor=0; ILubyte Bpp, Channels, Bpc; @@ -843,6 +1070,9 @@ ILboolean ReadMipmaps(ILuint CompFormat) ILboolean isCompressed = IL_FALSE; + if (IsDXT10) //@TODO: Add in mipmap support + return IL_TRUE; + Bpp = iCompFormatToBpp(CompFormat); Channels = iCompFormatToChannelCount(CompFormat); Bpc = iCompFormatToBpc(CompFormat); @@ -945,7 +1175,7 @@ ILboolean ReadMipmaps(ILuint CompFormat) Head.LinearSize >>= 1; } - if (!ReadData()) + if (!ReadData(CompFormat, IsDXT10)) goto mip_fail; if (ilGetInteger(IL_KEEP_DXTC_DATA) == IL_TRUE && isCompressed == IL_TRUE && CompData) { @@ -957,7 +1187,7 @@ ILboolean ReadMipmaps(ILuint CompFormat) memcpy(Image->DxtcData, CompData, Image->DxtcSize); } - if (!DdsDecompress(CompFormat)) + if (!DdsDecompress(CompFormat, IsDXT10)) goto mip_fail; } @@ -1681,6 +1911,14 @@ void CorrectPreMult() } +ILboolean DecompressARGBDX10(ILuint CompFormat) +{ + //@TODO: Will certainly fail if iCurImage->SizeOfData != "Compressed" Size + memcpy(iCurImage->Data, CompData, iCurImage->SizeOfData); + return IL_TRUE; +} + + ILboolean DecompressARGB(ILuint CompFormat) { ILuint ReadI = 0, TempBpp, i; @@ -1989,7 +2227,8 @@ ILAPI ILboolean ILAPIENTRY ilDxtcDataToSurface() case IL_DXT5: CompFormat = PF_DXT5; break; } CompData = iCurImage->DxtcData; - DdsDecompress(CompFormat); //globals suck...fix this + DdsDecompress(CompFormat, IL_FALSE); //@TODO: globals suck...fix this + //@TODO: Should we ever expect this to be IL_TRUE? //@TODO: origin should be set in Decompress()... iCurImage->Origin = IL_ORIGIN_UPPER_LEFT; |