You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- ICacheStore::Put() has updated documentation to reflect the requirements of partial records. - ICacheStore::Get() now takes a FCacheRecordPolicy, which is implicitly constructible from ECachePolicy, and allows setting the policy by payload. - ICacheStore::GetPayload() is replaced by ICacheStore::GetChunks(), which allows loading parts of payloads. - ICacheStore::CancelAll() is moved to ICache::CancelAll() because the cache can track requests at the top level and cancel them without exposing cancellation on individual cache stores. - ECachePolicy::SkipLocalCopy has been removed because it is difficult to reason about. - ECachePolicy::SkipData flags now have a documented meaning for put requests, to hint that record existence implies payload existence. - The filesystem and memory cache stores have been updated to support partial records, filtering of payloads, and loading parts of payloads. - Requesting part of a payload will decompress the entire payload for now, until compressed buffers expose a way to decompress only part. - Fixed a bug in FTexturePlatformData::AreDerivedMipsAvailable() that caused it to return false for structured cache keys. #rb Zousar.Shaker #rnx #preflight 615e03241ed62f0001b95454 #ROBOMERGE-OWNER: Devin.Doucette #ROBOMERGE-AUTHOR: devin.doucette #ROBOMERGE-SOURCE: CL 17748550 in //UE5/Release-5.0/... via CL 17748555 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v879-17706426) #ROBOMERGE-CONFLICT from-shelf #ROBOMERGE[STARSHIP]: UE5-Main [CL 17748602 by Devin Doucette in ue5-release-engine-test branch]
126 lines
3.6 KiB
C++
126 lines
3.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreTypes.h"
|
|
#include "Containers/StringFwd.h"
|
|
#include "Containers/StringView.h"
|
|
#include "IO/IoHash.h"
|
|
#include "Templates/TypeHash.h"
|
|
|
|
#define UE_API DERIVEDDATACACHE_API
|
|
|
|
namespace UE::DerivedData
|
|
{
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/**
|
|
* An alphanumeric identifier that groups related cache records.
|
|
*
|
|
* A cache bucket name must be alphanumeric, non-empty, and contain fewer than 256 code units.
|
|
*/
|
|
class FCacheBucket
|
|
{
|
|
public:
|
|
/** Construct a null cache bucket. */
|
|
FCacheBucket() = default;
|
|
|
|
/** Create a cache bucket from a name. */
|
|
UE_API explicit FCacheBucket(FUtf8StringView Name);
|
|
UE_API explicit FCacheBucket(FWideStringView Name);
|
|
|
|
/** Whether this is null. */
|
|
inline bool IsNull() const { return !Name; }
|
|
/** Whether this is not null. */
|
|
inline bool IsValid() const { return !IsNull(); }
|
|
|
|
/** Reset this to null. */
|
|
inline void Reset() { *this = FCacheBucket(); }
|
|
|
|
inline bool operator==(FCacheBucket Other) const { return Name == Other.Name; }
|
|
inline bool operator!=(FCacheBucket Other) const { return Name != Other.Name; }
|
|
|
|
inline bool operator<(FCacheBucket Other) const
|
|
{
|
|
return Name != Other.Name && ToString().Compare(Other.ToString(), ESearchCase::IgnoreCase) < 0;
|
|
}
|
|
|
|
friend inline uint32 GetTypeHash(FCacheBucket Bucket)
|
|
{
|
|
return ::GetTypeHash(reinterpret_cast<UPTRINT>(Bucket.Name));
|
|
}
|
|
|
|
/** Get the name of the cache bucket as a string. */
|
|
inline FAnsiStringView ToString() const;
|
|
|
|
protected:
|
|
static constexpr int32 LengthOffset = -1;
|
|
|
|
/** Name stored as a null-terminated string preceded by one byte containing its length. */
|
|
const ANSICHAR* Name = nullptr;
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/** A key that uniquely identifies a cache record. */
|
|
struct FCacheKey
|
|
{
|
|
FCacheBucket Bucket;
|
|
FIoHash Hash;
|
|
|
|
/** A key with a null bucket and a zero hash. */
|
|
static const FCacheKey Empty;
|
|
};
|
|
|
|
inline const FCacheKey FCacheKey::Empty;
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
inline FAnsiStringView FCacheBucket::ToString() const
|
|
{
|
|
return Name ? FAnsiStringView(Name, reinterpret_cast<const uint8*>(Name)[LengthOffset]) : FAnsiStringView();
|
|
}
|
|
|
|
template <typename CharType>
|
|
inline TStringBuilderBase<CharType>& operator<<(TStringBuilderBase<CharType>& Builder, const FCacheBucket& Bucket)
|
|
{
|
|
return Builder << Bucket.ToString();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
inline bool operator==(const FCacheKey& A, const FCacheKey& B)
|
|
{
|
|
return A.Bucket == B.Bucket && A.Hash == B.Hash;
|
|
}
|
|
|
|
inline bool operator!=(const FCacheKey& A, const FCacheKey& B)
|
|
{
|
|
return A.Bucket != B.Bucket || A.Hash != B.Hash;
|
|
}
|
|
|
|
inline bool operator<(const FCacheKey& A, const FCacheKey& B)
|
|
{
|
|
const FCacheBucket& BucketA = A.Bucket;
|
|
const FCacheBucket& BucketB = B.Bucket;
|
|
return BucketA == BucketB ? A.Hash < B.Hash : BucketA < BucketB;
|
|
}
|
|
|
|
inline uint32 GetTypeHash(const FCacheKey& Key)
|
|
{
|
|
return HashCombine(GetTypeHash(Key.Bucket), GetTypeHash(Key.Hash));
|
|
}
|
|
|
|
template <typename CharType>
|
|
inline TStringBuilderBase<CharType>& operator<<(TStringBuilderBase<CharType>& Builder, const FCacheKey& Key)
|
|
{
|
|
return Builder << Key.Bucket << CharType('/') << Key.Hash;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
} // UE::DerivedData
|
|
|
|
#undef UE_API
|