You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb Zousar.Shaker #rnx #preflight 61d93c241a3fd09dcbefcfb8 #ROBOMERGE-AUTHOR: devin.doucette #ROBOMERGE-SOURCE: CL 18560428 in //UE5/Release-5.0/... via CL 18560448 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669) [CL 18560457 by devin doucette in ue5-release-engine-test branch]
64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "DerivedDataValue.h"
|
|
|
|
#include "Compression/OodleDataCompression.h"
|
|
#include "Containers/StringConv.h"
|
|
#include "Hash/xxhash.h"
|
|
#include "Serialization/CompactBinary.h"
|
|
#include "Templates/UnrealTemplate.h"
|
|
|
|
namespace UE::DerivedData
|
|
{
|
|
|
|
constexpr ECompressedBufferCompressor GDefaultCompressor = ECompressedBufferCompressor::Mermaid;
|
|
constexpr ECompressedBufferCompressionLevel GDefaultCompressionLevel = ECompressedBufferCompressionLevel::VeryFast;
|
|
|
|
FValue FValue::Compress(const FCompositeBuffer& Buffer, const uint64 BlockSize)
|
|
{
|
|
return FValue(FCompressedBuffer::Compress(Buffer, GDefaultCompressor, GDefaultCompressionLevel, BlockSize));
|
|
}
|
|
|
|
FValue FValue::Compress(const FSharedBuffer& Buffer, const uint64 BlockSize)
|
|
{
|
|
return FValue(FCompressedBuffer::Compress(Buffer, GDefaultCompressor, GDefaultCompressionLevel, BlockSize));
|
|
}
|
|
|
|
FValueId::FValueId(const FMemoryView Id)
|
|
{
|
|
checkf(Id.GetSize() == sizeof(ByteArray),
|
|
TEXT("FValueId cannot be constructed from a view of %" UINT64_FMT " bytes."), Id.GetSize());
|
|
FMemory::Memcpy(Bytes, Id.GetData(), sizeof(ByteArray));
|
|
}
|
|
|
|
FValueId::FValueId(const FCbObjectId& Id)
|
|
: FValueId(ImplicitConv<const ByteArray&>(Id))
|
|
{
|
|
}
|
|
|
|
FValueId::operator FCbObjectId() const
|
|
{
|
|
return FCbObjectId(GetBytes());
|
|
}
|
|
|
|
FValueId FValueId::FromHash(const FIoHash& Hash)
|
|
{
|
|
checkf(!Hash.IsZero(), TEXT("FValueId requires a non-zero hash."));
|
|
return FValueId(MakeMemoryView(Hash.GetBytes()).Left(sizeof(ByteArray)));
|
|
}
|
|
|
|
FValueId FValueId::FromName(const FUtf8StringView Name)
|
|
{
|
|
checkf(!Name.IsEmpty(), TEXT("FValueId requires a non-empty name."));
|
|
uint8 HashBytes[16];
|
|
FXxHash128::HashBuffer(Name.GetData(), Name.Len()).ToByteArray(HashBytes);
|
|
return FValueId(MakeMemoryView(HashBytes, sizeof(ByteArray)));
|
|
}
|
|
|
|
FValueId FValueId::FromName(const FWideStringView Name)
|
|
{
|
|
return FValueId::FromName(FTCHARToUTF8(Name));
|
|
}
|
|
|
|
} // UE::DerivedData
|