Commit Graph

222 Commits

Author SHA1 Message Date
nick edwards
220ccc4b3e FIoDirectoryIndexReader::IterateDirectoryIndex: Use FStringViews and TStringBuilders instead of FStrings to avoid potentially unnecessary heap allocations
FPakPlatformFile::ForeachPackageInIostoreWhile: Update usage of IterateDirectoryIndex, and use overload of TryConvertFilenameToLongPackageName using string views and builders to avoid allocations

#rb elias.lozadabenavent
#rb anton.dunchev

[CL 28282945 by nick edwards in ue5-main branch]
2023-09-27 14:10:02 -04:00
pj kack
cb214905d9 IoDispatcher: Protect the Backends array with a FRWLock since it may be modified by Mount() on GT while being used in the IoDispatcher thread.
#jira UE-192374, FORT-554088
#rb paul.chipchase
#rnx

[CL 28218395 by pj kack in ue5-main branch]
2023-09-26 04:08:15 -04:00
paul chipchase
f5c7921948 Add support for generating OnDemandToc data from UToc files on disk rather than downloading the data each time the process is launched. This feature is off by default.
#rb PJ.Kack, Per.Larsson
#rnx

### Configuration

- New cvar 's.IasGenerateOnDemandUtoc' which when set to true will tell the IasBackend to generate the OnDemand toc file from all of the utoc files marked as supporting OnDemand currently on disk. Defaults to false.
-- When we ship the IAS feature this will be changed to true.
- Note that both cvars are used before '-dpcvars' is applied so cannot be overriden from the cmdline.
- When UE_VALIDATE_GENERATED_TOC is enabled we will download the ondemand toc from the CDN anyway and check that the generated version from disk has the same values (where important) and trigger an assert if there are differences. This is intended to help debugging future compatibility issues.

## IoDispatcher Changes

- Add new method FIoStoreReader::GetChunkCompressedInfo allowing the caller to get info about a compressed chunk without actually loading it from disk.
- Changed FIoStoreReader::Initialize to take a string view rather than raw string pointer.
- FIoStoreTocResource now has an array of meta data for chunks and another for blocks, specifically for IAS (FIoStoreTocResource::OnDemandChunkMeta/OnDemandCompressedBlockMeta)
-- This data will only be generated for utoc files with OnDemand support to avoid bloating the non-ondemand utocs.
-- This data is considered meta data and will be read when EIoStoreTocReadOptions::ReadTocMeta is enabled.
- Reordered some includes to match the IWYU tool.
- Minor optimization to FIoStoreToc::Initialize

### IAS Changes

- The IoStoreOnDemand module now includes the 'Pak'File' module so that we have access to the pak directories.
- Add FEncryptionKeyManager::GetAllKeys which would be needed if IAS data ends up being encrypted.
-- The encryption path has not yet been tested and probably will need some form of defered mounting (for cases where the encryption keys are applied at a later point)

[CL 28039592 by paul chipchase in ue5-main branch]
2023-09-20 12:06:29 -04:00
paul chipchase
ba69316583 Optimization when decoding IoStore data
#rb Per.Larsson
#rnx

- Only create a copy of each block for decryption if we actually need to decrypt (ie there is a valid AES key)
- If we do need to decrypt the blocks then only create a single buffer and reuse it for each block rather than creating a new buffer and copying to it for each block.

[CL 27705362 by paul chipchase in ue5-main branch]
2023-09-08 04:20:30 -04:00
per larsson
7ee97071a4 IAS - verify chunk block(s)
#rb Martin.Ridgers
#rnx

[CL 27668179 by per larsson in ue5-main branch]
2023-09-07 06:09:25 -04:00
Matt Peters
e69f086889 CookOnTheFly2: Remove duplicate warnings for missing packages requested multiple times, and remove warnings for editor-only packages that are found due to unsolicited loads on the cooker but were not requested by the client. Add packagename to warnings about missing packages.
#jira UE-184879
#rnx
#rb Dan.Englebrecht

[CL 27593637 by Matt Peters in ue5-main branch]
2023-09-05 08:41:53 -04:00
per larsson
600eac785a IAS - allow reading from file cache when HTTP streaming is disabled
#rb Paul.Chipchase
#rnx

## Background
The on demand I/O backend doesn't store complete/hole I/O chunks in the local file cache, only the parts that has been requested by the game. There are currently
two ways for querying the I/O backend(s) whether a specific chunk exists or not. The primary one used by the texture streaming system is DoesChunkExist(ChunkId). This
method is called via FBulkData::DoesExist(). In order to be able to fufill this query for partially cached I/O chunks, two additional methods has been
added to the I/O dispatcher API. Currently private, only accessible by FBulkData.
 - DoesChunkExist(ChunkId, OffsetAndLength)
 - GetSizeForChunk(ChunkId, OffsetAndLength)

The method GetSizeForChunk is only ever used by the IAsyncFileHandle wrapper for bulk data and is a tricky compromise. The file handle
represents the hole chunk/file where the bulk data instance resides, i.e. .ubulk, .uptnl etc. Calling get file size on this file handle should return
the size for the entire chunk/file. It is technically possible to read outside of the bulk data range and this would result in the read request
coming back as failed, since the resolve function in the I/O backend wouldn't be found. The file handle wrapper for bulk data is currently only used
by virtual textures and should be deprecated in the long run.

[CL 27337787 by per larsson in ue5-main branch]
2023-08-24 07:52:54 -04:00
per larsson
58cb352bc2 I/O - delete all container partition(s) and not just the base container after upload
#rb none
#rnx

[CL 26733408 by per larsson in ue5-main branch]
2023-08-01 04:46:45 -04:00
paul chipchase
ba9220ab4a IAS: Add logging of all iorequests to complement the logging of all http requests.
The iorequest duration is very close to the actual latency as seen from the game client code.

#jira UE-188791
#rb paul.chipchase
#rnx

- Submitted on the behalf of PJ.Kack

[CL 26430435 by paul chipchase in ue5-main branch]
2023-07-18 07:08:07 -04:00
per larsson
3bed8ef537 I/O - support for uploading on demand I/O store containers to S3 with UnrealPak
- added support for uploading containers marked as on demand directly from UnrealPak.exe
- removed C# based upload logic from automation scripts
- removed on demand I/O store writer since this change reads chunks directly from container files instead of loose files

Example usage:
UnrealPak.exe -Upload=<ContainerPathOrWildcard> -ServiceUrl=<URL> -Bucket=<BucketName> -AccessKey=<Key> -SecretKey=<Key>

Read credentials from an AWS key chain file with the following command line:
-CredentialsFile=<Path> -CredentialsFileKeyName=<EntryName>

Specify -KeepUploadedContainers to prevent UnrealPak to delete on demand containers after the upload has been completed.
Specify -BucketPrefix=<Path> to upload chunks to a specific sub directory within the bucket.

#rb none

[CL 26115169 by per larsson in ue5-main branch]
2023-06-20 04:21:22 -04:00
andriy tylychko
b24f665471 minor optim to avoid needless copies of TRefCountPtr in IoDispatcher
#rb pj.kack

[CL 25844068 by andriy tylychko in ue5-main branch]
2023-06-07 10:04:07 -04:00
martin ridgers
70f3d54b1b Moved file cache into ioscod and eliminated base class .h/.cpp
#rb perl
#rnx
#jira
#preflight 646dd2d51b241f07480ef1b3

[CL 25599566 by martin ridgers in ue5-main branch]
2023-05-24 06:13:15 -04:00
martin ridgers
f4ed631edf Removed in-memory cache experiment
#rb perl
#rnx
#jira
#preflight 646db3981134ffac7072c9e2

[CL 25598669 by martin ridgers in ue5-main branch]
2023-05-24 04:06:02 -04:00
per larsson
5bf68c3de0 I/O - extend on demand I/O store TOC with source chunk hash and compression block hashes
#rb none
#preflight 6467726975696d2bd7d424d7
#rnx

[CL 25562370 by per larsson in ue5-main branch]
2023-05-22 08:28:57 -04:00
per larsson
92c4fb4c0b I/O - removed on demand TOC from core since this has moved to new module
#rb none
#preflight 6469c9ca573c1da158828c03
#rnx

[CL 25559309 by per larsson in ue5-main branch]
2023-05-21 10:15:18 -04:00
dan thompson
1ffba2605f Don't read the source buffer in iostore if we are just copying the chunk from the reference database.
#rb fabian.giesen
#rb per.larsson
#preflight 6462a3aab87b09aadd3a9f2c

[CL 25495924 by dan thompson in ue5-main branch]
2023-05-16 15:59:34 -04:00
per larsson
bfb2591e55 I/O - fixed read issues from local file cache on Switch
#rb none
#preflight 6454d06c4c3ec54e6e3d1165
#rnx
#preflight 6454d06c4c3ec54e6e3d1165

[CL 25352388 by per larsson in ue5-main branch]
2023-05-05 07:48:33 -04:00
pj kack
12064cb1d3 IoDispatcher: Improve shutdown logic.
First reset the GIoDispatcher pointer.
Then stop the IoDispatcher thread and wait for all pending requests to finish.
Then shutdown the backends.
Then destroy the IoDispatcher itself.

#rb per.larsson
#rnx
#preflight 644bbbe91c2846595c308b2a

[CL 25298458 by pj kack in ue5-main branch]
2023-05-02 03:28:46 -04:00
per larsson
f174b47daa I/O - simplified cache interface and optimized chunk requests
- replaced cache async API with TTask for easier composition with HTTP request
- combine I/O request that fetches the same chunk into one request

#rb none
#preflight 644f8c862074911121f59044

[CL 25282906 by per larsson in ue5-main branch]
2023-05-01 08:26:28 -04:00
per larsson
00573797c3 I/O - simple file based FIFO cache
#rb none
#preflight 644b6f70401d328ad90fa1c5

[CL 25238719 by per larsson in ue5-main branch]
2023-04-28 15:55:46 -04:00
per larsson
5d85c42089 I/O - parallel HTTP requests
- removed background thread in favor using Tasks
- using fixed set of task pipes to throttle HTTP requests
- updated chunk encoding API to use FIoStatus and FOffsetAndLength

#rb none
#preflight 644a50851150e908d00b36f3

[CL 25214018 by per larsson in ue5-main branch]
2023-04-27 10:06:24 -04:00
per larsson
ab30bdc35b I/O - added caching to HTTP I/O backend
-  added simple in memory LRU cache for testing purposes, enabled with -HttpBackendMemoryCache=<size>

#rb none
#preflight 6446408e0171aae0b1e8855e

[CL 25162523 by per larsson in ue5-main branch]
2023-04-24 08:27:25 -04:00
per larsson
25adb5e978 I/O - move FIoBuffer to separate header
#rb Paul.Chipchase
#preflight 64464e1f27014596f346ea3f

[CL 25162522 by per larsson in ue5-main branch]
2023-04-24 08:27:19 -04:00
per larsson
d1ab262438 I/O - move FIoStatus to separate header
#rb Paul.Chipchase
#preflight 644619984944ef78929cd295

[CL 25161501 by per larsson in ue5-main branch]
2023-04-24 05:52:11 -04:00
per larsson
7b3c2ac4ed I/O - added support for loading ondemand utoc files from CbObject
#rb trivial
#preflight 643ceb978901e5ef98c7b9e3

[CL 25066201 by per larsson in ue5-main branch]
2023-04-17 07:29:44 -04:00