You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Each shadermap is now associated with one or more assets, and shaders are laid out according to the open order of those assets, if provided. If not provided, the original ordering is kept. The original ordering will not be always deterministic, particularly if shader compilation needs to happen, because jobs can get reordered during the compilation. Other fixes: - Fixed sorting within the shadermap not being deterministic (FCompareShaderPrimaryKey) - Fixed Niagara shadermap duplicating Platform property and not initializing it properly. - Removed (unused) support for Child shader libraries (would not be deterministic). #rb Ben.Ingram, Rob.Krajcarski #ROBOMERGE-OWNER: Arciel.Rekman #ROBOMERGE-AUTHOR: arciel.rekman #ROBOMERGE-SOURCE: CL 12249260 via CL 12249262 via CL 12250173 #ROBOMERGE-BOT: (v668-12245121) [CL 12250313 by Arciel Rekman in Main branch]
82 lines
2.4 KiB
C++
82 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
/**
|
|
* Defines the order mapping for files within a pak.
|
|
* When read from the files present in the pak, Indexes will be [0,NumFiles). This is important for detecting gaps in the order between adjacent files in a patch .pak.
|
|
* For new files being added into the pak, the values can be arbitrary, and will be usable only for relative order in an output list.
|
|
* Due to the arbitrary values for new files, the FPakOrderMap can contain files with duplicate Order values.
|
|
*/
|
|
class FPakOrderMap
|
|
{
|
|
public:
|
|
FPakOrderMap()
|
|
: MaxPrimaryOrderIndex(MAX_uint64)
|
|
{}
|
|
|
|
void Empty()
|
|
{
|
|
OrderMap.Empty();
|
|
MaxPrimaryOrderIndex = MAX_uint64;
|
|
}
|
|
|
|
int32 Num() const
|
|
{
|
|
return OrderMap.Num();
|
|
}
|
|
|
|
/** Add the given filename with the given Sorting Index */
|
|
void Add(const FString& Filename, uint64 Index)
|
|
{
|
|
OrderMap.Add(Filename, Index);
|
|
}
|
|
|
|
/**
|
|
* Add the given filename with the given Offset interpreted as Offset in bytes in the Pak File. This version of Add is only useful when all Adds are done by offset, and are converted
|
|
* into Sorting Indexes at the end by a call to ConvertOffsetsToOrder
|
|
*/
|
|
void AddOffset(const FString& Filename, uint64 Offset)
|
|
{
|
|
OrderMap.Add(Filename, Offset);
|
|
}
|
|
|
|
/** Remaps all the current values in the OrderMap onto [0, NumEntries). Useful to convert from Offset in Pak file bytes into an Index sorted by Offset */
|
|
void ConvertOffsetsToOrder()
|
|
{
|
|
TArray<TPair<FString, uint64>> FilenameAndOffsets;
|
|
for (auto& FilenameAndOffset : OrderMap)
|
|
{
|
|
FilenameAndOffsets.Add(FilenameAndOffset);
|
|
}
|
|
FilenameAndOffsets.Sort([](const TPair<FString, uint64>& A, const TPair<FString, uint64>& B)
|
|
{
|
|
return A.Value < B.Value;
|
|
});
|
|
int64 Index = 0;
|
|
for (auto& FilenameAndOffset : FilenameAndOffsets)
|
|
{
|
|
OrderMap[FilenameAndOffset.Key] = Index;
|
|
++Index;
|
|
}
|
|
}
|
|
|
|
bool PAKFILEUTILITIES_API ProcessOrderFile(const TCHAR* ResponseFile, bool bSecondaryOrderFile = false);
|
|
|
|
uint64 PAKFILEUTILITIES_API GetFileOrder(const FString& Path, bool bAllowUexpUBulkFallback, bool* OutIsPrimary=nullptr) const;
|
|
|
|
void PAKFILEUTILITIES_API WriteOpenOrder(FArchive* Ar);
|
|
|
|
private:
|
|
FString RemapLocalizationPathIfNeeded(const FString& PathLower, FString& OutRegion) const;
|
|
|
|
TMap<FString, uint64> OrderMap;
|
|
uint64 MaxPrimaryOrderIndex;
|
|
};
|
|
|
|
|
|
PAKFILEUTILITIES_API bool ExecuteUnrealPak(const TCHAR* CmdLine);
|
|
|