Add astc lib for Windows x64
This commit is contained in:
@@ -58,7 +58,7 @@ public class TextureTool : EngineModule
|
||||
options.PrivateDependencies.Add("bc7enc16");
|
||||
}
|
||||
}
|
||||
if (options.Target.IsEditor && options.Platform.Target == TargetPlatform.Mac) // TODO: add ASTC for Editor on Linux and Windows
|
||||
if (options.Target.IsEditor && options.Platform.Target != TargetPlatform.Linux) // TODO: add ASTC for Editor on Linux
|
||||
{
|
||||
// ASTC for mobile (iOS and Android)
|
||||
options.SourceFiles.Add(Path.Combine(FolderPath, "TextureTool.astc.cpp"));
|
||||
|
||||
@@ -836,10 +836,10 @@ bool TextureTool::ConvertDirectXTex(TextureData& dst, const TextureData& src, co
|
||||
{
|
||||
if (PixelFormatExtensions::IsCompressedASTC(dstFormat))
|
||||
{
|
||||
// TODO: decompress if need to
|
||||
#if COMPILE_WITH_ASTC
|
||||
return ConvertAstc(dst, *textureData, dstFormat);
|
||||
return ConvertAstc(dst, src, dstFormat);
|
||||
#else
|
||||
LOG(Error, "Missing ASTC texture format compression lib.");
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "TextureTool.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
#include "Engine/Core/Math/Color32.h"
|
||||
#include "Engine/Graphics/Textures/TextureData.h"
|
||||
#include "Engine/Graphics/PixelFormatExtensions.h"
|
||||
#include "Engine/Graphics/RenderTools.h"
|
||||
@@ -49,7 +48,9 @@ bool TextureTool::ConvertAstc(TextureData& dst, const TextureData& src, const Pi
|
||||
TextureData converted;
|
||||
|
||||
// Encoder uses full 4-component RGBA input image so convert it if needed
|
||||
if (PixelFormatExtensions::ComputeComponentsCount(src.Format) != 4)
|
||||
if (PixelFormatExtensions::ComputeComponentsCount(src.Format) != 4 ||
|
||||
PixelFormatExtensions::IsCompressed(textureData->Format) ||
|
||||
!PixelFormatExtensions::IsRgbAOrder(textureData->Format))
|
||||
{
|
||||
if (textureData != &src)
|
||||
converted = src;
|
||||
@@ -71,6 +72,13 @@ bool TextureTool::ConvertAstc(TextureData& dst, const TextureData& src, const Pi
|
||||
textureData = &converted;
|
||||
}
|
||||
|
||||
// Setup output
|
||||
dst.Items.Resize(textureData->Items.Count());
|
||||
dst.Width = textureData->Width;
|
||||
dst.Height = textureData->Height;
|
||||
dst.Depth = 1;
|
||||
dst.Format = dstFormat;
|
||||
|
||||
// Compress all array slices
|
||||
for (int32 arrayIndex = 0; arrayIndex < textureData->Items.Count() && astcError == ASTCENC_SUCCESS; arrayIndex++)
|
||||
{
|
||||
@@ -124,4 +132,4 @@ bool TextureTool::ConvertAstc(TextureData& dst, const TextureData& src, const Pi
|
||||
return astcError != ASTCENC_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -666,6 +666,8 @@ bool TextureTool::ConvertStb(TextureData& dst, const TextureData& src, const Pix
|
||||
{
|
||||
#if COMPILE_WITH_ASTC
|
||||
if (ConvertAstc(dst, *textureData, dstFormat))
|
||||
#else
|
||||
LOG(Error, "Missing ASTC texture format compression lib.");
|
||||
#endif
|
||||
{
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user