Commit Graph

113 Commits

Author SHA1 Message Date
Jason Nadro
7e37e4cc2e Cooked platform ODSC. Only compile the shaders that are rendered with and not complete shader maps for every cooked material.
# Results
- In my small tests this resulted in compiling 8.9x less shaders (1558 vs. 174)
- Spent 107 seconds less compiling.

# Changes
- Adds CacheGivenTypesForCooking to UMaterialInterface and implemented for UMaterial and UMaterialInstance.  This is responsible for compiling just the given types of shaders which is fully qualified by VF Type, Shader Type (or Shader Pipeline Type).
- Fully qualify each shader compile request from the client by FeatureLevel and QualityLevel.  This way we don't compile multiple quality levels that aren't actively rendered with.
- CacheGivenTypesForCooking for UMaterial and UMaterialInterface explicity tries to re-use and find existing resources so we can progressively build up the shadermap while running.
- FMaterial::CacheGivenTypes now can compile shader pipelines.
- Adds CompileODSCMaterialsForRemoteRecompile which compiles just the requested shaders.  This was because I wanted to leave the functionality in CompileMaterialsForRemoteRecompile alone.
- FShaderRecompileData now has a serialize function so the Load/Save serialize code can be the same on host and client.
- Made CompileMaterialsForRemoteRecompile compiled only for the Editor.
- Don't assert on needing complete shader maps when using ODSC.
- Mass conversion from NULL to nullptr in ShaderCompiler.cpp
- Refactoring some common code from RecompileShadersForRemote into separate functions.

#rb Ben.Ingram
#jira UE-136438
#preflight 6261bb9afe26b98ad8479633

[CL 19863961 by Jason Nadro in ue5-main branch]
2022-04-22 09:11:18 -04:00
Jason Nadro
d5bf20012d Implement single shader file compilation for cooked platform ODSC.
For example: recompileshaders /Engine/Private/Lumen/LumenVisualizeHardwareRayTracing.usf

1. Game sends the shader file string across the network to the cooking server.
2. Cooking server finds all shaders of that type.
3. Cooking server flushes those specific types from the global shader map.
4. Cooking server recompiles just those shaders and sends them back to the game.

# Todo
* Refactor duplicate code in RecompileShadersForRemote
* Implement the ability for material shader maps to compile just specific shader types requested (this doesn't exist).

#rb none
#jira UE-148085, UE-114418
#preflight 625d722648670f31a61eb3de

[CL 19785256 by Jason Nadro in ue5-main branch]
2022-04-18 10:38:23 -04:00
PJ Kack
da6c392750 COTF & ODSC: Fix assert in FMaterialShaderMap::LoadForRemoteRecompile when a requested material has already been destroyed and can't be found any more.
Fix serialization bug that cause old file based COTF to ignore what shader platform we were requesting (fixed for Zen COTF in 19595445).
Extend the -noshaderddc command line option with -noglobalshaderddc and -nomaterialshaderddc options (to improve COTF debugging iteration times).

#jira none
#rb jason.nadro
#rnx
#preflight 624c497bbd5b36eec30c314f

[CL 19643402 by PJ Kack in ue5-main branch]
2022-04-06 02:31:55 -04:00
Wojciech Krywult
da81b70c8c CookOnTheFly (platform protoco): Added an additional check to ITargetDeviceSocket::IsConnected in the cooking server. It's needed because on some platforms ITargetDevice::IsProtocolAvailable doesn't have the necessary knowledge and unconditionally returns 'true' (we only know if the protocol is available after creating a socket).
#jira UE-132038
#rb jeff.newquist
#rnx
#preflight 622a5146773679d25d300d44

[CL 19480805 by Wojciech Krywult in ue5-main branch]
2022-03-23 12:37:58 -04:00
PJ Kack
03d40656cf COTF: Make sure to read all platform extension directories related to the IniPlatformName.
Fix ShaderPlatform crash on platforms with a common folder that contains ShaderPlatform config data.

#jira none
#rb carlmagnus.nordin
#rnx
#preflight 6239ccbb9304d833f4f26c19

[CL 19465715 by PJ Kack in ue5-main branch]
2022-03-22 09:28:07 -04:00
Josh Adams
afecc5d4e1 - Fixed a COTF bug where it would use the TargetPlatformName (say WIndowsClient) instead of IniPlatformName (Windows) when looking in PLatformExtension directories
#jira UE-142751
#preflight 621cdede49723678579e6f8e

[CL 19173286 by Josh Adams in ue5-main branch]
2022-02-28 09:43:53 -05:00
Wojciech Krywult
7b5537cc26 CookOnTheFly (platform protocol): Editor: Added support of the platform-specific transport communication protocols to the editor and use it in the cooking server.
This change allows the cooking server to communicate with clients using platform-specific communication protocols instead of TCP (the default).

This new mode is activated by adding '-platformprotocol' command-line parameter when starting the cooking server (in addition to the usual '-cookonthefly').

The new functionality is included in FNetworkFileServerPlatformProtocol, which is a variant of the preexisting FNetworkFileServer but using ITargetDevice/ITargetDeviceSocket interfaces instead of traditional sockets.

Direct communication with targets is only supported on some platforms, which can be checked by calling ITargetPlatform::SupportsFeature(ETargetPlatformFeatures::DirectDataExchange).

#rb jeff.newquist
#preflight 62166a4237178b0175af6269

[CL 19094838 by Wojciech Krywult in ue5-main branch]
2022-02-23 12:54:09 -05:00
jason nadro
27c5094597 [Backout] - CL18273499
[FYI] Jason.Nadro
Original CL Desc
-----------------------------------------------------------------
[ODSC] - Break out recompile shaders functionality into its own file.

- Break out common functionality for both ShaderCompiler.cpp and RecompileShaders.cpp into it's own shared file.

#rb Ben.Ingram
#jira none
#preflight 619cffb0801b361978aa77d3

#ROBOMERGE-AUTHOR: jason.nadro
#ROBOMERGE-SOURCE: CL 18273892 in //UE5/Release-5.0/... via CL 18273919
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18273945 by jason nadro in ue5-release-engine-test branch]
2021-11-23 14:58:58 -05:00
jason nadro
b5c5096269 [ODSC] - Break out recompile shaders functionality into its own file.
- Break out common functionality for both ShaderCompiler.cpp and RecompileShaders.cpp into it's own shared file.

#rb Ben.Ingram
#jira none
#preflight 619cffb0801b361978aa77d3

#ROBOMERGE-AUTHOR: jason.nadro
#ROBOMERGE-SOURCE: CL 18273499 in //UE5/Release-5.0/... via CL 18273518
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18273542 by jason nadro in ue5-release-engine-test branch]
2021-11-23 14:30:48 -05:00
jason nadro
80493a5424 Refactor cooked ODSC to use the same data structures between the ShaderCompiler, CookGlobalShaderCommandlet, and the CookingServer.
## Refactoring
- FShaderRecompileData is the de-factor data structure for holding recompile inputs/outputs (these should be separated).
- FShaderRecompileData has moved from being a CookingServer only data structure to living in ShaderCompiler (Engine runtime).
- UE::Cook::FRecompileShaderRequest was basically a duplicate struct of FShaderRecompileData.  Now it just holds a FShaderRecompileData struct and a callback.
- RecompileShadersForRemote(), which previously accepted a grab bag of arguments, now just takes the FShaderRecompileData struct.
- ShaderPlatform is no longer a int32 but a EShaderPlatform to be more explicit.
- The downside to this approach is all these systems are more tightly coupled, but the sharing of code makes this easier to modify in the future.

## Bug Fixes
- recompileshaders changed would only sometimes work depending on what materials the cooking server had loaded.  Now the command issued by the client will explicitly say which materials to load and compile for.
- In RecompileShadersForRemote remove the call to GetOutdatedShaderTypes because in the cooking server it doesn't work.  That function only works when the shader maps exist, but in the cooking server when loading materials we do not create the maps.  This creates a chicken/egg issue.  Where we need to maps to determine what's out of date and to recompile...but we don't have the maps because we haven't done a compile yet.

## Features
- Display how long the shader request took on the cooking server.
- Print shader stats out at the end of recompile request.

#rb none
#jira UE-121436, UE-113113
#preflight 6196a3f0f020c4e616acff15

#ROBOMERGE-AUTHOR: jason.nadro
#ROBOMERGE-SOURCE: CL 18242119 in //UE5/Release-5.0/... via CL 18242138
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18242996 by jason nadro in ue5-release-engine-test branch]
2021-11-18 15:26:44 -05:00
Marc Audy
0c3be2b6ad Merge Release-Engine-Staging to Test @ CL# 18240298
[CL 18241953 by Marc Audy in ue5-release-engine-test branch]
2021-11-18 14:37:34 -05:00
paul chipchase
ecdec9bf35 Add an UE5 specific version EUnrealEngineObjectUE5Version to be used for global changes instead of EUnrealEngineObjectUEVersion. By splitting and storing both version numbers we allow for hypothetical future UE4 changes that will not conflict when merged to UE5.
#rb CarlMagnus.Nordin
#rnx
#tests Ran overnight preflights on several platforms, opened/cooked/staged/ran the oldest version of InfiltratorDemo that can be downloaded (4.11)

### ObjectVersion
- Add a new version enum EUnrealEngineObjectUE5Version.
-- This version number starts at 1000 which leaves more than enough for for EUnrealEngineObjectUEVersion to be expanded
- Even though very few changes (if any at all) to EUnrealEngineObjectUE4Version are expected there is a static assert to make sure that EUnrealEngineObjectUEVersion::AUTOMATIC_VERSION never overtakes EUnrealEngineObjectUE5Version::INITIAL_VERSION.
- Add a struct FPackageFileVersion that wraps around the version numbers and is used to store them instead of raw int32 values which was done before. This should make it easier to add new version numbers in the future if we desire (although this will cause problems in places that serialize the struct directly)

### FPackageFileSummary
- Adding a new entry to CurrentLegacyFileVersion at value -8 which shows the UE5 version being added. This lets us make the changes without needing to submit anything to UE4 Main.
- When loading a package that does not have a UE5 version, it will remain at 0.
- Added ::IsFileVersionTooOld and ::IsFileVersionTooNew to replace hardcoded tests in the code base for version validity. This will make it easier to make changes in the future.
- A few months ago most of the accessors of the version number were deprecated in favour of a version that did not contain the Engine number (ie UE4Ver -> UEVer in Archive) but to work with these changes the renamed methods now will return or accept the version as FPackageFileVersion rather than int32.  The old UE4 methods will remain deprecated and direct licensees to use the new methods.

### Archive
- Now stores the version as a FPackageFileVersion rather than int32

### LinkerLoad
- Reports the larger version number if we detect a higher version number than we support. Note that this could cause an issue if the UE4 version is ever raised but helps keep the code simple.

### AssetData
- Need to add a new version here to manage existing data that only has the UE4 version

### EditorDomain
- We do not need to version the format, we can just invalidate existing editor domain entries via EditorDomainVersion

### EditorServer
- When reporting that a package is too old we report the UE4 version as that is the only version that can be older than VER_UE4_OLDEST_LOADABLE_PACKAGE
- When reporting that a package is too new it can be either the UE4 or the UE5 version so we print them together "UE4Ver|UE5Ver"

### ContentCommandlets
- The min and max resave versions have been kept as a single value, you will not be able to resave against different UE4 and UE5 versions at the same time. It doesn't seem like a useful feature and would greatly increase the complexity of the code.
- We will also only report the file version as a single value.

### ManifestUObject
- This class was setting an older obsolete version on purpose to try and maintain compatibility with older clients so we need to provide a way to create an older UE4 only version that will leave the UE5 version as unset.

### NetworkPlatformFile
- I was unable to test the code path in FNetworkPlatformFile::ProcessServerCachedFilesResponse as I am unsure how to run the game in a mode that will actually use it.
- When reading an older "CookedVersion.txt" that was saved with a single version, the reads will fail and this will count as a version change in the code so that all of the existing files will be deleted. The existing code would not give the user a log message when this happens and given the very small time window where this might happen caused by this change I have opted to leave this alone and not add any additional logging.
- If we do detect a version mismatch we will still only log the version number as a single version.

### CookOnTheFlyServer
- We now add each version number to the IniVersionMap rather than merge the version and license version as a key/value pair. This allows us to a) use both the UE4 and UE5 version numbers b) we now log a warning that the version values don't match when it is changed, previously since it was a key value we would log a warning about an additional setting instead.
-- I also added "vs" to the log message when values are mismatched to make the space between the two values being printed clearer.

#ROBOMERGE-OWNER: paul.chipchase
#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 17549459 via CL 17550236 via CL 17550238 via CL 17550582
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v870-17433530)
#ROBOMERGE[STARSHIP]: UE5-Main

[CL 17550583 by paul chipchase in ue5-release-engine-test branch]
2021-09-17 07:04:55 -04:00
pj kack
1b5d14716c Delete obsolete and unused CookedIterativeFile module
#rb per.larsson
#rnx
#preflight 6142fe35568b3a000112c145

#ROBOMERGE-AUTHOR: pj.kack
#ROBOMERGE-SOURCE: CL 17535748 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17535754 by pj kack in ue5-release-engine-test branch]
2021-09-16 05:27:21 -04:00
mark lintott
24420693b6 #jira UE-111195
Updated references to UE4 to Unreal in NetworkFileConnection.cpp
This required references to GPackageFileUE4Version and GPackageFileLicenseeUE4Version to also be updated to GPackageFileUnrealVersion and GPackageFileLicenseeUnrealVersion accordingly

#ROBOMERGE-SOURCE: CL 15850452 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v786-15839533)

[CL 15851651 by mark lintott in ue5-main branch]
2021-03-29 11:38:01 -04:00
Per Larsson
314923bcd1 COTF: Fixed bug when syncing files with restricted sandbox
#rb yuriy.odonnell
#jira none
#rnx

[CL 15432938 by Per Larsson in ue5-main branch]
2021-02-17 08:05:57 -04:00
Per Larsson
f5c567408a Added option to network file server to prevent package assets being sent from outside the cooked sandbox folder
#rb matt.peters
#jira none
#rnx

[CL 15416586 by Per Larsson in ue5-main branch]
2021-02-16 06:53:30 -04:00
Per Larsson
216634f5cd Don't send uncooked packages when requesting files with SyncFile
#rb none
#jira none
#rnx

[CL 15405721 by Per Larsson in ue5-main branch]
2021-02-15 05:46:01 -04:00
Per Larsson
85bd65288e COTF: Don't send uncooked packages when cook fails
#rb matt.peters
#jira none
#rnx

[CL 15387983 by Per Larsson in ue5-main branch]
2021-02-11 11:38:54 -04:00
Marc Audy
4c1bb11c29 Merge UE5/Release-Engine-Staging to UE5/Main @ 14548662
This represents UE4/Main @ 14525125 + cherrypicked fixes
#skipundocheck

[CL 14551026 by Marc Audy in ue5-main branch]
2020-10-22 19:19:16 -04:00
Marcus Wassmer
3b81cf8201 Merging using //UE5/Main_to_//UE5/Release-Engine-Staging @14384769
autoresolved files
#rb none

[CL 14384911 by Marcus Wassmer in ue5-main branch]
2020-09-24 00:43:27 -04:00
Marc Audy
11f5b21210 Merging //UE5/Release-Engine-Staging @ 13752110 to Main (//UE5/Main)
#rnx

[CL 13753156 by Marc Audy in ue5-main branch]
2020-06-23 18:40:00 -04:00
Matt Kuhlenschmidt
603a4119c5 Fix HAL/PlatformFileManager.h non-portable casing CIS issues
#rb none

[CL 13214257 by Matt Kuhlenschmidt in ue5-main branch]
2020-05-06 17:58:18 -04:00
david harvey
224956718b Cook on the fly changes:
- target platform code can manage the file transfer from the cook server.
 - client ip address and platform-specific metadata is sent from the client.

#rb josh.adams
#rnx
#lockdown marcus.wassmer
#jira MTHRL-18

#ROBOMERGE-SOURCE: CL 12653783 in //UE4/Release-4.25Plus/... via CL 12653792
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v675-12543919)

[CL 12653798 by david harvey in Main branch]
2020-04-07 10:45:54 -04:00
ben ingram
05a97970f5 #jira UE-89915
Fix recompileshaders running on target with COTF server
#rb none
[FYI] Yuriy.ODonnell

#ROBOMERGE-SOURCE: CL 11892983 in //UE4/Release-4.25/... via CL 11892985
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v656-11643781)

[CL 11892989 by ben ingram in Main branch]
2020-03-03 19:38:43 -05:00
ryan durand
0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00