Files
UnrealEngineUWP/Engine/Source/Developer/TextureBuildUtilities/Public/TextureBuildUtilities.h
Dan Thompson 96edde023f Removing PostTile and PostEncode hashes as they cause determinism issues when enabling shared linear texture encoding.
#rb none
#preflight 63780baa8b12eb83a7e9c702

[CL 23208960 by Dan Thompson in ue5-main branch]
2022-11-18 18:23:08 -05:00

78 lines
2.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "IO/IoHash.h"
#include "ImageCore.h"
#include "Interfaces/ITextureFormat.h"
struct FTextureBuildSettings;
/***
TextureBuildUtilities is a utility module for shared code that Engine and TextureBuildWorker (no Engine) can both see
for Texture-related functions that don't need Texture.h/UTexture
TextureBuildUtilities is hard-linked to the Engine so no LoadModule/ModuleInterface is needed
***/
namespace UE
{
namespace TextureBuildUtilities
{
namespace EncodedTextureExtendedData
{
TEXTUREBUILDUTILITIES_API FCbObject ToCompactBinary(const FEncodedTextureExtendedData& InExtendedData);
TEXTUREBUILDUTILITIES_API bool FromCompactBinary(FEncodedTextureExtendedData& OutExtendedData, FCbObject InCbObject);
}
namespace EncodedTextureDescription
{
TEXTUREBUILDUTILITIES_API FCbObject ToCompactBinary(const FEncodedTextureDescription& InDescription);
TEXTUREBUILDUTILITIES_API bool FromCompactBinary(FEncodedTextureDescription& OutDescription, FCbObject InCbObject);
}
namespace TextureEngineParameters
{
TEXTUREBUILDUTILITIES_API FCbObject ToCompactBinaryWithDefaults(const FTextureEngineParameters& InEngineParameters);
TEXTUREBUILDUTILITIES_API bool FromCompactBinary(FTextureEngineParameters& OutEngineParameters, FCbObject InCbObject);
}
// Carries information out of the build that we don't want to cook or save off in the runtime
struct TEXTUREBUILDUTILITIES_API FTextureBuildMetadata
{
// Whether or not the first mip level of the source has alpha detected. This is used e.g.
// picking between BC1 and BC3
bool bSourceMipsAlphaDetected = false;
// Digests of the data at various processing stages so we can track down determinism issues
// that arise.
FIoHash PreEncodeMipsHash;
FCbObject ToCompactBinaryWithDefaults() const;
FTextureBuildMetadata(FCbObject InCbObject);
FTextureBuildMetadata() = default;
};
TEXTUREBUILDUTILITIES_API bool TextureFormatIsHdr(FName const& InName);
// Removes platform and other custom prefixes from the name.
// Returns plain format name and the non-platform prefix (with trailing underscore).
// i.e. PLAT_BLAH_AutoDXT returns AutoDXT and writes BLAH_ to OutPrefix.
TEXTUREBUILDUTILITIES_API const FName TextureFormatRemovePrefixFromName(FName const& InName, FName& OutPrefix);
FORCEINLINE const FName TextureFormatRemovePrefixFromName(FName const& InName)
{
FName OutPrefix;
return TextureFormatRemovePrefixFromName(InName,OutPrefix);
}
TEXTUREBUILDUTILITIES_API ERawImageFormat::Type GetVirtualTextureBuildIntermediateFormat(const FTextureBuildSettings& BuildSettings);
} // namespace TextureBuildUtilities
} // namespace UE