#UE4 Added an extra canary check
--------
Integrated using branch Ue4-To-UE4-Fortnite-Simple (reversed) of change#2527111 by Bob.Tellez on 2015/04/27 12:42:15.
[CL 2527113 by Bob Tellez in Main branch]
#UE4 Added ShaderMagic_CleaningUp to the Canary checks in FShader. This will help track down the cause of UE-14017
--------
Integrated using branch Ue4-To-UE4-Fortnite-Simple (reversed) of change#2524950 by Bob.Tellez on 2015/04/24 16:48:53.
[CL 2527112 by Bob Tellez in Main branch]
- Linkers are no longer UObjects. Renamed ULinker, ULinkerLoad and ULinkerSave to FLinker, FLinkerLoad, FLinkerSave respectively
- Linkers are now associated with their UPackages
- Linker version is now stored in UPackages
- Async loading is now performed on a separate thread (if platform supports it and only in cooked builds), with the exception of PostLoad which is still done on the game thread
- Added UObject::IsPostLoadThreadSafe() function to determine if PostLoad is thread safe and can be executed on the async loading thread (defaults to false)
- UObject creation is now thread safe and can be performed on any thread
- Move many of the linker/UObject globals into FUObjectThreadContext (TLS)
- GetAsyncLoadPercentage() now takes PostLoad into account
- More async loading stats
- Added AtomicallySetFlags/ClearFlags to UObject
- Made FModuleManager thread safe.
- Added FGCScopeGuard as means of preventing GC from executing from non-game thread
- It's possible to disable async loading thread through ini settings.
- Cancelling async loading will now also trigger GC
- Implemented a basic version of async streaming priorities.
Change 2410813 by Mikolaj Sieluzycki:
Change Sleep in while loop to ConditionalSleep in FMultiReaderSingleWriterGT
Change 2410734 by Mikolaj Sieluzycki:
Make FModuleManager thread safe.
Change 2399879 by Mikolaj Sieluzycki:
Basic version of async streaming priorities.
Change 2410707 by Mikolaj Sieluzycki:
Implement conditional and no stat versions of sleep.
Change 2371939 by Robert Manuszewski:
Async Loading Improvements: adding more stats (accumulators)
Change 2372403 by Robert Manuszewski:
Fixing compile errors when STATs are not enabled
Change 2371526 by Robert Manuszewski:
AsyncLoading Improvements (WIP)
Change 2407198 by Robert Manuszewski:
Re-implementing delegate fixes for Async Loading
Change 2407425 by Robert Manuszewski:
Re-implementing cancelling async loading in the async loading branch.
Change 2484362 by Robert Manuszewski:
Making it possible to disable async loading thread through ini settings.
Change 2484744 by Robert Manuszewski:
Minimizing locks in GC and other threads when handling UObjects
Change 2480190 by Robert Manuszewski:
Fixing infinite stall after canceling async loading in non-cooked builds
Change 2484268 by Robert Manuszewski:
Fixing crash when allocating permanent object pool.
Change 2489761 by Robert Manuszewski:
Fixing BulkData using linker archive on the main thread even if the linker was created on the async loading thread.
Change 2493624 by Robert Manuszewski:
Cancelling async loading will now also trigger GC
Change 2487881 by Robert Manuszewski:
Making ShaderIdMap operations thread safe.
Change 2488067 by Robert Manuszewski:
Fixing GetAsyncLoadPercentage. It will now also respect PostLoad.
Change 2458640 by Robert Manuszewski:
Fixing crash in PIE
Change 2458825 by Robert Manuszewski:
Fixing a few crashes when streaming and the package is missing.
Change 2476935 by Robert Manuszewski:
Fixing crash while async loading ANavigationData
Change 2477361 by Robert Manuszewski:
Fixing crashes in cooked game
Change 2480095 by Robert Manuszewski:
Making FUObjectArray more thread safe
Change 2475443 by Robert Manuszewski:
Re-enabling single-threaded async loading path for the editor and platforms that don't support multithreading.
Change 2475458 by Robert Manuszewski:
Making sure bulk data is only loaded on a separate thread if it's not being loaded on the async loading thread.
Change 2476661 by Robert Manuszewski:
Fixing FlushAsyncLoading not flushing everything
Change 2401089 by Jaroslaw Surowiec:
Core - Added AtomicallySetFlags/ClearFlags to UObject, added a comment to ThisThreadAtomicallyClearedRFUnreachable
[CL 2498249 by Robert Manuszewski in Main branch]
- Several GetTypeHash would produce only very narrow hash distributions, so these have been modified.
- FShaderDrawKey::GetTypeHash was particularly slow (around 4% of sampled time in Mac UT in Instruments) almost all in MemCrc32, so this has been replaced with a much simpler hash routine to bring it down to ~1% sampled time.
- FShaderDrawKey::operator== comparison order changed to try and fail earlier by testing from most-to-least varying attributes.
- Changed the way sampler-state & texture look-up works to avoid unnecessary map lookup.
#codereview michael.trepka
[CL 2493570 by Mark Satterthwaite in Main branch]
- This is especially important on OS X OpenGL where these hitches can be equivalent to several frames, so it is enabled by default for this platform.
- The logging of draw calls is turned on/off with r.UseShaderDrawLog and incurs a fixed overhead as all RHI state is tracked & recorded into the shader cache.
- The actual predrawing is turned on/off with r.UseShaderPredraw and requires an existing cache to be useful, the predrawing takes place at frame-end and can be controlled with r.PredrawBatchTime which the time in ms to spend predrawing each frame until complete, or -1 to do it in one go (currently the default).
- The shader cache is now also versioned with the game able to supply a version distinct from the engine, so that old caches may be invalidated if/when required.
- The shader cache is now compatible with OpenGL SM4 & SM5 on Windows & probably Linux too.
- It may not work correctly with desktop ES2 emulation as that is still untested.
- To make it easier to add to other RHIs the API has been made simper to avoid lots of exposed branches.
#codereview michael.trepka, dmitry.rekman
[CL 2460109 by Mark Satterthwaite in Main branch]
* GetStreamOutElements is a callback function on the shadertype, just like ModifyCompilationEnvironment
* If GetStreamOutElements is specified, the FShaderResource includes that shader type in its ID as it can't be shared with any other shader type.
* FShader is no longer a FRenderResource which solves some multiple initialization issues
#codereview Marcus.Wassmer
[CL 2430024 by Daniel Wright in Main branch]