Files
UnrealEngineUWP/Engine/Source/Runtime/RenderCore/Private/RenderResource.cpp

741 lines
19 KiB
C++
Raw Normal View History

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
RenderResource.cpp: Render resource implementation.
=============================================================================*/
#include "RenderResource.h"
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3209340 on 2016/11/23 by Ben.Marsh Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h. Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms. * Every header now includes everything it needs to compile. * There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first. * There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h. * Every .cpp file includes its matching .h file first. * This helps validate that each header is including everything it needs to compile. * No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more. * You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there. * There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible. * No engine code explicitly includes a precompiled header any more. * We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies. * PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files. Tool used to generate this transform is at Engine\Source\Programs\IncludeTool. [CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
#include "Misc/ScopedEvent.h"
#include "Misc/App.h"
#include "RenderingThread.h"
/** Whether to enable mip-level fading or not: +1.0f if enabled, -1.0f if disabled. */
float GEnableMipLevelFading = 1.0f;
TLinkedList<FRenderResource*>*& FRenderResource::GetResourceList()
{
static TLinkedList<FRenderResource*>* FirstResourceLink = NULL;
return FirstResourceLink;
}
void FRenderResource::InitResource()
{
check(IsInRenderingThread());
if(!bInitialized)
{
ResourceLink = TLinkedList<FRenderResource*>(this);
ResourceLink.LinkHead(GetResourceList());
if(GIsRHIInitialized)
{
InitDynamicRHI();
InitRHI();
}
FPlatformMisc::MemoryBarrier(); // there are some multithreaded reads of bInitialized
bInitialized = true;
}
}
void FRenderResource::ReleaseResource()
{
if ( !GIsCriticalError )
{
check(IsInRenderingThread());
if(bInitialized)
{
if(GIsRHIInitialized)
{
ReleaseRHI();
ReleaseDynamicRHI();
}
ResourceLink.Unlink();
bInitialized = false;
}
}
}
void FRenderResource::UpdateRHI()
{
check(IsInRenderingThread());
if(bInitialized && GIsRHIInitialized)
{
ReleaseRHI();
ReleaseDynamicRHI();
InitDynamicRHI();
InitRHI();
}
}
void FRenderResource::InitResourceFromPossiblyParallelRendering()
{
if (IsInRenderingThread())
{
InitResource();
}
else
{
check(IsInParallelRenderingThread());
class FInitResourceRenderThreadTask
{
FRenderResource& Resource;
FScopedEvent& Event;
public:
FInitResourceRenderThreadTask(FRenderResource& InResource, FScopedEvent& InEvent)
: Resource(InResource)
, Event(InEvent)
{
}
Copying //UE4/Dev-Rendering to Dev-Main (//UE4/Dev-Main) #lockdown nick.penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2879377 on 2016/02/24 by Gil.Gribb UE4 - Added render thread start and stop delegates. GitHub 2006. #Jira UE-26184 Change 2879378 on 2016/02/24 by Gil.Gribb UE4 - Avoided using TG_PrePhysics as the first tickgroup so that licensees can add tickgropups. https://udn.unrealengine.com/questions/279126/code-assumes-that-tg-prephysics-is-the-first-tick.html #Jira UE-26971 Change 2879382 on 2016/02/24 by Gil.Gribb UE4 - Tweaked automation test framework by request from UDN post. Change 2879727 on 2016/02/24 by Martin.Mittring adding debug info for Optimus driver detection issue #rb:Benjamin.Hyder #Test:PC Change 2879728 on 2016/02/24 by Martin.Mittring fixed and improved VisualizeMotionBlur #rb:David.Hill #test:PC Change 2879729 on 2016/02/24 by Martin.Mittring added AngleBetweenVectors() and variants to the FastMath library #rb:David.Hill #code_review:Brian.Karis Change 2880133 on 2016/02/24 by David.Hill new r.DepthOfFieldQualitySetting for GDC squencer demo #rb:Martin.Mittring - OR-15875 Change 2880314 on 2016/02/24 by Daniel.Wright Fixed uses of FDepthDrawingPolicyFactory being affected by bUseAsOccluder * This fixes preshadows on HISMC and foliage Change 2880338 on 2016/02/24 by Martin.Mittring added SkinCache.Debug cvar #rb:Lina.Halper #test:PC Change 2880344 on 2016/02/24 by Daniel.Wright Added the ability to apply DFAO to static indirect lighting, controlled by r.AOApplyToStaticIndirect * Lightmaps, stationary skylight and reflection captures are all affected * Specular occlusion on reflection captures requires a fair amount of tweaking of r.SkySpecularOcclusionStrength, MinOcclusion and MaxOcclusionDistance for good quality * For now, a movable skylight with low intensity (.0001) must be placed to control MaxOcclusionDistance and MinOcclusion Change 2880346 on 2016/02/24 by Daniel.Wright Added several cvars to expose mesh distance field limits, which allows higher quality * r.DistanceFields.MaxPerMeshResolution * r.DistanceFields.DefaultVoxelDensity * r.DistanceFields.AtlasSizeXY * r.DistanceFields.AtlasSizeZ Change 2881304 on 2016/02/25 by Gil.Gribb UE4 - Increased the priority of cloth tasks because these are on the critical path. Change 2881306 on 2016/02/25 by Gil.Gribb UE4 - Added cvar to control background tick list cleanup. Change 2881790 on 2016/02/25 by Daniel.Wright Screen size fading is only applied to spot and point lights Change 2882077 on 2016/02/25 by Daniel.Wright DFAO indirect occlusion on static lighting is now correctly applied to IndirectIrradiance Change 2882391 on 2016/02/25 by Martin.Mittring fixed bad caching of SRV for vertexbuffers in SkinCache (caused rendering artifacts and wasteful memory allocations). Finding a SRV is now O(1), was O(n) #rb:Olaf.Piesche #code_review:Rolando.Caloca,Marcus.Wassmer Change 2883008 on 2016/02/26 by Gil.Gribb UE4 - Fixed recursive shader intialization crash on consoles. Change 2883253 on 2016/02/26 by Martin.Mittring Improved SkinTangent compression #rb:Olaf.Piesche Change 2883295 on 2016/02/26 by Martin.Mittring Added RecomputeSkinTangent feature for GPU SkinCache, not enabled by default (r.SkinCache.RecomputeTangents) #rb:Olaf.Piesche,Brian.Karis,Lina.Halper,Rolando.Caloca Change 2883363 on 2016/02/26 by Gil.Gribb UE4 - Fixed an issue with recurisve shader init on consoles...again. Change 2883912 on 2016/02/26 by Gil.Gribb UE4 - Fixed shadows updating static meshes while the prepass is in progress. Change 2884829 on 2016/02/27 by Martin.Mittring OR-16237 indirect lighting on skin is too dark #rb:Martin.Mittring #code_review:Brian.Karis Change 2885096 on 2016/02/28 by Martin.Mittring OR-13678 [CL 2890130 by Gil Gribb in Main branch]
2016-03-02 13:38:38 -05:00
static FORCEINLINE TStatId GetStatId()
{
RETURN_QUICK_DECLARE_CYCLE_STAT(FInitResourceRenderThreadTask, STATGROUP_TaskGraphTasks);
}
Copying //UE4/Dev-Rendering to Dev-Main (//UE4/Dev-Main) #lockdown nick.penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2879377 on 2016/02/24 by Gil.Gribb UE4 - Added render thread start and stop delegates. GitHub 2006. #Jira UE-26184 Change 2879378 on 2016/02/24 by Gil.Gribb UE4 - Avoided using TG_PrePhysics as the first tickgroup so that licensees can add tickgropups. https://udn.unrealengine.com/questions/279126/code-assumes-that-tg-prephysics-is-the-first-tick.html #Jira UE-26971 Change 2879382 on 2016/02/24 by Gil.Gribb UE4 - Tweaked automation test framework by request from UDN post. Change 2879727 on 2016/02/24 by Martin.Mittring adding debug info for Optimus driver detection issue #rb:Benjamin.Hyder #Test:PC Change 2879728 on 2016/02/24 by Martin.Mittring fixed and improved VisualizeMotionBlur #rb:David.Hill #test:PC Change 2879729 on 2016/02/24 by Martin.Mittring added AngleBetweenVectors() and variants to the FastMath library #rb:David.Hill #code_review:Brian.Karis Change 2880133 on 2016/02/24 by David.Hill new r.DepthOfFieldQualitySetting for GDC squencer demo #rb:Martin.Mittring - OR-15875 Change 2880314 on 2016/02/24 by Daniel.Wright Fixed uses of FDepthDrawingPolicyFactory being affected by bUseAsOccluder * This fixes preshadows on HISMC and foliage Change 2880338 on 2016/02/24 by Martin.Mittring added SkinCache.Debug cvar #rb:Lina.Halper #test:PC Change 2880344 on 2016/02/24 by Daniel.Wright Added the ability to apply DFAO to static indirect lighting, controlled by r.AOApplyToStaticIndirect * Lightmaps, stationary skylight and reflection captures are all affected * Specular occlusion on reflection captures requires a fair amount of tweaking of r.SkySpecularOcclusionStrength, MinOcclusion and MaxOcclusionDistance for good quality * For now, a movable skylight with low intensity (.0001) must be placed to control MaxOcclusionDistance and MinOcclusion Change 2880346 on 2016/02/24 by Daniel.Wright Added several cvars to expose mesh distance field limits, which allows higher quality * r.DistanceFields.MaxPerMeshResolution * r.DistanceFields.DefaultVoxelDensity * r.DistanceFields.AtlasSizeXY * r.DistanceFields.AtlasSizeZ Change 2881304 on 2016/02/25 by Gil.Gribb UE4 - Increased the priority of cloth tasks because these are on the critical path. Change 2881306 on 2016/02/25 by Gil.Gribb UE4 - Added cvar to control background tick list cleanup. Change 2881790 on 2016/02/25 by Daniel.Wright Screen size fading is only applied to spot and point lights Change 2882077 on 2016/02/25 by Daniel.Wright DFAO indirect occlusion on static lighting is now correctly applied to IndirectIrradiance Change 2882391 on 2016/02/25 by Martin.Mittring fixed bad caching of SRV for vertexbuffers in SkinCache (caused rendering artifacts and wasteful memory allocations). Finding a SRV is now O(1), was O(n) #rb:Olaf.Piesche #code_review:Rolando.Caloca,Marcus.Wassmer Change 2883008 on 2016/02/26 by Gil.Gribb UE4 - Fixed recursive shader intialization crash on consoles. Change 2883253 on 2016/02/26 by Martin.Mittring Improved SkinTangent compression #rb:Olaf.Piesche Change 2883295 on 2016/02/26 by Martin.Mittring Added RecomputeSkinTangent feature for GPU SkinCache, not enabled by default (r.SkinCache.RecomputeTangents) #rb:Olaf.Piesche,Brian.Karis,Lina.Halper,Rolando.Caloca Change 2883363 on 2016/02/26 by Gil.Gribb UE4 - Fixed an issue with recurisve shader init on consoles...again. Change 2883912 on 2016/02/26 by Gil.Gribb UE4 - Fixed shadows updating static meshes while the prepass is in progress. Change 2884829 on 2016/02/27 by Martin.Mittring OR-16237 indirect lighting on skin is too dark #rb:Martin.Mittring #code_review:Brian.Karis Change 2885096 on 2016/02/28 by Martin.Mittring OR-13678 [CL 2890130 by Gil Gribb in Main branch]
2016-03-02 13:38:38 -05:00
static FORCEINLINE ENamedThreads::Type GetDesiredThread()
{
return ENamedThreads::RenderThread_Local;
}
Copying //UE4/Dev-Rendering to Dev-Main (//UE4/Dev-Main) #lockdown nick.penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2879377 on 2016/02/24 by Gil.Gribb UE4 - Added render thread start and stop delegates. GitHub 2006. #Jira UE-26184 Change 2879378 on 2016/02/24 by Gil.Gribb UE4 - Avoided using TG_PrePhysics as the first tickgroup so that licensees can add tickgropups. https://udn.unrealengine.com/questions/279126/code-assumes-that-tg-prephysics-is-the-first-tick.html #Jira UE-26971 Change 2879382 on 2016/02/24 by Gil.Gribb UE4 - Tweaked automation test framework by request from UDN post. Change 2879727 on 2016/02/24 by Martin.Mittring adding debug info for Optimus driver detection issue #rb:Benjamin.Hyder #Test:PC Change 2879728 on 2016/02/24 by Martin.Mittring fixed and improved VisualizeMotionBlur #rb:David.Hill #test:PC Change 2879729 on 2016/02/24 by Martin.Mittring added AngleBetweenVectors() and variants to the FastMath library #rb:David.Hill #code_review:Brian.Karis Change 2880133 on 2016/02/24 by David.Hill new r.DepthOfFieldQualitySetting for GDC squencer demo #rb:Martin.Mittring - OR-15875 Change 2880314 on 2016/02/24 by Daniel.Wright Fixed uses of FDepthDrawingPolicyFactory being affected by bUseAsOccluder * This fixes preshadows on HISMC and foliage Change 2880338 on 2016/02/24 by Martin.Mittring added SkinCache.Debug cvar #rb:Lina.Halper #test:PC Change 2880344 on 2016/02/24 by Daniel.Wright Added the ability to apply DFAO to static indirect lighting, controlled by r.AOApplyToStaticIndirect * Lightmaps, stationary skylight and reflection captures are all affected * Specular occlusion on reflection captures requires a fair amount of tweaking of r.SkySpecularOcclusionStrength, MinOcclusion and MaxOcclusionDistance for good quality * For now, a movable skylight with low intensity (.0001) must be placed to control MaxOcclusionDistance and MinOcclusion Change 2880346 on 2016/02/24 by Daniel.Wright Added several cvars to expose mesh distance field limits, which allows higher quality * r.DistanceFields.MaxPerMeshResolution * r.DistanceFields.DefaultVoxelDensity * r.DistanceFields.AtlasSizeXY * r.DistanceFields.AtlasSizeZ Change 2881304 on 2016/02/25 by Gil.Gribb UE4 - Increased the priority of cloth tasks because these are on the critical path. Change 2881306 on 2016/02/25 by Gil.Gribb UE4 - Added cvar to control background tick list cleanup. Change 2881790 on 2016/02/25 by Daniel.Wright Screen size fading is only applied to spot and point lights Change 2882077 on 2016/02/25 by Daniel.Wright DFAO indirect occlusion on static lighting is now correctly applied to IndirectIrradiance Change 2882391 on 2016/02/25 by Martin.Mittring fixed bad caching of SRV for vertexbuffers in SkinCache (caused rendering artifacts and wasteful memory allocations). Finding a SRV is now O(1), was O(n) #rb:Olaf.Piesche #code_review:Rolando.Caloca,Marcus.Wassmer Change 2883008 on 2016/02/26 by Gil.Gribb UE4 - Fixed recursive shader intialization crash on consoles. Change 2883253 on 2016/02/26 by Martin.Mittring Improved SkinTangent compression #rb:Olaf.Piesche Change 2883295 on 2016/02/26 by Martin.Mittring Added RecomputeSkinTangent feature for GPU SkinCache, not enabled by default (r.SkinCache.RecomputeTangents) #rb:Olaf.Piesche,Brian.Karis,Lina.Halper,Rolando.Caloca Change 2883363 on 2016/02/26 by Gil.Gribb UE4 - Fixed an issue with recurisve shader init on consoles...again. Change 2883912 on 2016/02/26 by Gil.Gribb UE4 - Fixed shadows updating static meshes while the prepass is in progress. Change 2884829 on 2016/02/27 by Martin.Mittring OR-16237 indirect lighting on skin is too dark #rb:Martin.Mittring #code_review:Brian.Karis Change 2885096 on 2016/02/28 by Martin.Mittring OR-13678 [CL 2890130 by Gil Gribb in Main branch]
2016-03-02 13:38:38 -05:00
static FORCEINLINE ESubsequentsMode::Type GetSubsequentsMode() { return ESubsequentsMode::FireAndForget; }
void DoTask(ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent)
{
Resource.InitResource();
Event.Trigger();
}
};
{
FScopedEvent Event;
TGraphTask<FInitResourceRenderThreadTask>::CreateTask().ConstructAndDispatchWhenReady(*this, Event);
}
}
}
FRenderResource::~FRenderResource()
{
if (bInitialized && !GIsCriticalError)
{
// Deleting an initialized FRenderResource will result in a crash later since it is still linked
UE_LOG(LogRendererCore, Fatal,TEXT("A FRenderResource was deleted without being released first!"));
}
}
void BeginInitResource(FRenderResource* Resource)
{
ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER(
InitCommand,
FRenderResource*,Resource,Resource,
{
Resource->InitResource();
});
}
void BeginUpdateResourceRHI(FRenderResource* Resource)
{
ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER(
UpdateCommand,
FRenderResource*,Resource,Resource,
{
Resource->UpdateRHI();
});
}
Copying //UE4/Dev-Core to //UE4/Dev-Main (Source: //UE4/Dev-Core @ 3345728) #lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 3315219 on 2017/02/21 by Steve.Robb Fix for FObjectAndNameAsStringProxyArchive when serializing a TWeakObjectPtr. Change 3315285 on 2017/02/21 by Steve.Robb Explicitly pass string builder into code generation functions. Change 3315341 on 2017/02/21 by Ben.Marsh UAT: Clean up some formatting in StreamCopyDescription output - remove #fyi lines, exclude merge commits, and remove some blank lines. Change 3315350 on 2017/02/21 by Ben.Marsh Fix shared resource files not being rebuilt if the version header changes. Change 3315823 on 2017/02/21 by Ben.Marsh UAT: Use a class derived from AutomationException to return information specific to commandlets failing, rather than putting it in the base class. Change 3315826 on 2017/02/21 by Ben.Marsh UAT: Move Distiller class from general use in UAT; FileFilter provides a much safer and fully featured implementation of the same concepts. Change 3315857 on 2017/02/21 by Ben.Marsh UBT: Remove the StripBaseDirectory() and MakeRerootedFilePath() utility functions from UBT. These operations can now be done more safely with FileReference objects. Change 3315942 on 2017/02/21 by Ben.Marsh UBT: Convert FileFilter to use FileReference and DirectoryReference arguments everywhere. Change 3316236 on 2017/02/22 by Maciej.Mroz #jira UE-42045 Nativization Fixed Warning: TEnumAsByte is not intended for use with enum Change 3316253 on 2017/02/22 by Robert.Manuszewski Fixes for the async log file writer hangs and crashes. - potential fix for the logging system hang when running out of disk space while flushing log - fix for unexpected concurrency assert when flushing the log buffer to disk Change 3316293 on 2017/02/22 by Steve.Robb GetTypeHash and lexicographical comparison operators (operator<() etc.) for TTuple. Change 3316342 on 2017/02/22 by Maciej.Mroz Nativization: Wrappers (stubs) required only by other wrappers are properly generated. #codereview: Mike.Beach Change 3316344 on 2017/02/22 by Maciej.Mroz Fixed crash in nativized Odin Async loading properly handles nativized structs. Change 3316359 on 2017/02/22 by Steve.Robb GitHub #3287 : Ignore #pragma in USTRUCTs #jira UE-42248 Change 3316389 on 2017/02/22 by Matthew.Griffin Switched Installed Engine Filters to multiline properties to make them more readable Added Oodle to list of excluded plugins #jira UE-42030 Change 3316392 on 2017/02/22 by Ben.Marsh UBT: Split out FileReference/DirectoryReference classes into their own file. Change 3316394 on 2017/02/22 by Ben.Marsh UBT: Move FileReference/DirectoryReference extension methods into the appropriate file. Change 3316411 on 2017/02/22 by Ben.Marsh UAT: Remove file functions that take multiple arguments. There's not really a compelling use case for these to exist over looping from the calling code. Change 3316446 on 2017/02/22 by Ben.Marsh UAT: Try disabling function name prefix to log output from UAT, to see if it improves readability. Function names are still included in the log file for debugging. Change 3316575 on 2017/02/22 by Ben.Marsh UAT: Remove unused functionality for dealing with labels, and output a more human readable list of P4 settings at startup. Change 3318481 on 2017/02/22 by Steve.Robb Use of FMath::IsPowerOfTwo in check. Static assert to ensure that an inline set allocator will have a hash size of a power of two. Change 3318496 on 2017/02/22 by Steve.Robb Fix for TSet visualizers. Change 3318919 on 2017/02/23 by Steve.Robb Fix for hot reloading UScriptStruct-derived objects in a module, where the CDOs of these objects haven't had PrepareCppStructOps() called on them. #jira UE-42178 Change 3318942 on 2017/02/23 by Steve.Robb Removal of a redundant insertion which can cause problems on reallocation of the map. Change 3319010 on 2017/02/23 by Ben.Marsh UBT: Fix exception when a file that was previously part of the working set is deleted. Change 3319134 on 2017/02/23 by Robert.Manuszewski Better fix for a deadlock when flushing log while it's already being flushed due to flush timer on the async log writer thread. Change 3319249 on 2017/02/23 by Matthew.Griffin Added a function to check if running with debug game libs instead of checking command line in multiple places Added -RunConfig parameter, which has equivalent result to -debug if value of parameter starts with 'debug' Added -RunConfig=$(Configuration) as a default commandline argument for Mac so that editor can use debug game libs Removed -Shipping argument from VCProject generation as it's not used anymore Change 3319253 on 2017/02/23 by Maciej.Mroz #jira UE-41846 New mechanism to gather modules necessary for Nativized Assets. The modules are listed based on included headers. Previously the dependencies was gathered only in FBlueprintNativeCodeGenManifest::GatherModuleDependencies. Change 3319591 on 2017/02/23 by Ben.Marsh Don't strip prefixes beginning with WARNING: or ERROR: using the Postp filter. Change 3320357 on 2017/02/23 by Steven.Hutton Slight changes to Add Crash method - Returning select fields instead of entity objects in queries for perf reasons. Change 3320361 on 2017/02/23 by Steven.Hutton Performance improvements subsequent to the recent database changes. Change 3320446 on 2017/02/23 by Steven.Hutton adding my temporary performance tracker class - reports to a private slack channel with add crash performance data. Change 3320479 on 2017/02/23 by Ben.Marsh Fix CIS errors. Change 3320576 on 2017/02/23 by Jin.Zhang Update CrashReporter to use AWS Change 3320742 on 2017/02/23 by Jin.Zhang Merging crash caching Change 3321119 on 2017/02/24 by Robert.Manuszewski DLL injection protection support for non-monolithic builds Change 3323308 on 2017/02/27 by Matthew.Griffin Moved compilation of SwarmInterface after its dependencies so that we will see a build failure immediately if they change version in future Change 3323423 on 2017/02/27 by Chad.Garyet Adding a script to check and warn about csproj targeted .net versions being mismatched #JIRA UE-39624 Change 3323442 on 2017/02/27 by Ben.Marsh UBT: Output an error if an engine module references a game module. Change 3323743 on 2017/02/27 by Ben.Marsh PR #3303: Resolved PVS scan issues (Contributed by projectgheist) Change 3323748 on 2017/02/27 by Ben.Marsh Convert whitespace to tabs. Change 3324851 on 2017/02/28 by Chris.Wood Add Odin symbol locations to engine config for MDD on CR server. NotForLicensees Change 3324979 on 2017/02/28 by Gil.Gribb Fixed bad merge of priority change in the EDL. Change 3326889 on 2017/03/01 by Steven.Hutton Update to buggs controller to generate faster queries. Change 3326910 on 2017/03/01 by Robert.Manuszewski Removing legacy #if from PackageFileSummary. Change 3327118 on 2017/03/01 by Gil.Gribb UE4 - Fixed race that resulted in a memory leak when reading compressed paks. Change 3327633 on 2017/03/01 by Gil.Gribb UE4 - Added a cvar to control the pak precacher thottle. Change 3327674 on 2017/03/01 by Steve.Robb Unified boilerplate between all generated code files. Change 3328544 on 2017/03/01 by Chris.Wood CrashReportProcess.config update (CRP v1.2.17) Tweaks to a few values. Update website URL to explicitly point to old, non-cloud site on devweb-02. Change 3328714 on 2017/03/01 by Chris.Wood Correct CRP config regression. Point website at new cloud site. Still v1.2.17 Change 3329192 on 2017/03/02 by Matthew.Griffin Added Shared Build Id file to the list of Precompiled Build Dependencies in a target receipt so that it's brought into an installed build Change 3329285 on 2017/03/02 by Ben.Marsh UGS: Allow a project to specify a filters for the streams that should be displayed for fast-switching to. The QuickSelectStreamList seting in the [Options] section of the project settings references a depot path containing a list of strings used to filter the stream list. An option is shown to switch back to showing all available streams, if desired. Change 3330636 on 2017/03/02 by Ben.Marsh UBT: Bump version number of C++ include cache to force it to be rebuilt with additional include information for the default RC files. Change 3331262 on 2017/03/03 by Robert.Manuszewski Merging Dev-LoadTimes to Dev-Core (Garbage Collection performance improvements) - Improved GC multithreading - Improved BeginDestroy performance - Introduced ULevelActorCluster for StaticMeshActor and ReflectionCapture actor clustering (can be toggled through project settings or console command gc.ActorClusterEnabled) - A few improvements to AddReferencedObjects functions - Misc improvements to GC code - Garbage Collector now properly handles clusters which had their objects marked as pending kill - Blueprints can now create clusters too (can be toggled through project settings or console command gc.BlueprintClusteringEnabled, defaults to disabled) Change 3331285 on 2017/03/03 by Robert.Manuszewski A few fixes for the previous check-in. Change 3332001 on 2017/03/03 by Ben.Marsh UBT: Add support for generating a UDN file containing the valid settings for BuildConfiguration.xml. Pass -configdoc=<filename> on the command line to generate such a file. Change 3332022 on 2017/03/03 by Ben.Marsh Update documentation for where to find the BuildConfiguration settings. Change 3332031 on 2017/03/03 by Ben.Marsh Remove documentation for Windows XP support; it has been removed in the 4.16 release. Change 3332256 on 2017/03/03 by Ben.Marsh UBT: Add support for generating a UDN page containing module and target settings. Change 3332458 on 2017/03/03 by Ben.Marsh UBT: Improvements to generated documentation. Change 3332459 on 2017/03/03 by Ben.Marsh Add generated documentation for .target.cs files, .build.cs files, and BuildConfiguration.xml files. Change 3332460 on 2017/03/03 by Ben.Marsh UBT: Make LinkTypePrivate actually private, so it doesn't show up in the docs. Change 3332899 on 2017/03/06 by Robert.Manuszewski Making sure actor clustering is not used in the editor (fix for actors being deleted when GC runs in the editor) #jira UE-42548 Change 3332955 on 2017/03/06 by Maciej.Mroz Nativization distinguishes client and server platform: - Separated lists on additional assets, additional modules, excluded assets, excluded modules, excluded paths (in config) - Context (compilation options, nativization options and platform) is deliveren to BPCOmpilerCppBackend in FCompilerNativizationOptions struct. - Wrappers (for unconverted BPs) are created only when they are directly called. - Fortnite dedicated server can be nativized Change 3332990 on 2017/03/06 by Ben.Marsh UBT: Add more comprehensive wrapper methods for System.IO.File and System.IO.Directory to FileReference and DirectoryReference. Change 3333032 on 2017/03/06 by Ben.Marsh Documentation for build tools Change 3333037 on 2017/03/06 by Ben.Marsh Add a build step to extract UAT and UBT documentation from XML comments. Change 3333089 on 2017/03/06 by Ben.Marsh UAT: Re-enable logging the calling function to the console in UAT. Needs a pass for readability first. Change 3333651 on 2017/03/06 by Gil.Gribb UE4 - Fix a werid recursive situation where StaticLoadObject could return an object that has not finished loading. Also produces a fatal error if this sometimes happens. EDL only. Change 3335236 on 2017/03/07 by Ben.Marsh UGS: Set the sync changelist separately to the compatibility changelist. Change 3335261 on 2017/03/07 by Gil.Gribb UE4 - Fixed batched render fences when BeginDestroy calls FlushRenderingCommands. Change 3335740 on 2017/03/07 by Gil.Gribb maybe fix static analysis warning Change 3335945 on 2017/03/07 by Steve.Robb Move FFindInstancedReferenceSubobjectHelper code out of header. Add map/set property support to allow instanced members of these container types to be handled during CPFUO. https://udn.unrealengine.com/questions/349232/tmap-with-instanced-object-as-value-gets-cleared-o.html Change 3336693 on 2017/03/07 by Ben.Marsh UBT: Use shared PCHs for game plugins by default, to reduce time spent generating individual PCHs. Change 3336694 on 2017/03/07 by Steve.Robb Static assert added to TMap to prevent the use of keys which don't implement a GetTypeHash. Fixes to types which relied on implicit conversions when calling GetTypeHash. Workaround in SAssetView.h and PropertyEditorModule.h for an apparent VC bug where the compiler wrongly instantiates TPointerIsConvertibleFromTo for certain forward-declared types, causing future TSharedPtr conversions to fail. #jira UE-42441 Change 3336698 on 2017/03/07 by Steve.Robb Hardcoded endpoint handling replaced with a generic string. Obsolete .proto and .java code generation removed. Change 3336811 on 2017/03/07 by Wes.Hunt Add a game blacklist to the crash report processor. Fixed a syntax error in Config.cs, added a XML comment to shut up a warning. Change 3336973 on 2017/03/08 by Steve.Robb Fix for missing GetTypeHash in a plugin. Change 3336996 on 2017/03/08 by Steve.Robb Significant refactor of code generation, to try and make data flow more apparent. Change 3337571 on 2017/03/08 by Steve.Robb CIS fixes for missing GetTypeHash functions. Non-unity fix. Change 3337588 on 2017/03/08 by Gil.Gribb UE4 - Fixed obscure check with flushing rhi resources. Change 3337620 on 2017/03/08 by Steve.Robb WITH_HOT_RELOAD_CTORS macros removed. UseVTableConstructors config option removed. Change 3339369 on 2017/03/09 by Steve.Robb GetTypeHash overload for nn::account::Uid. Change 3339464 on 2017/03/09 by Daniel.Lamb Fixed assert in 4.15 to do with trying to gather dependency info from invalid packages. #jira UE-42583 #test Editor + Cook + Run shootergame Change 3339465 on 2017/03/09 by Maciej.Mroz Fixed serialization issue, after UserDefinedEnum was used in EnumProperty. Change 3339469 on 2017/03/09 by Maciej.Mroz Fixed Nativization problem, when default value is passed as non-const reference. Change 3340178 on 2017/03/09 by Daniel.Lamb Added support for in memory only packages. The Cooker ignores these and added core functions to recognize these packages. Other systems will need to add support where nessisary. Change 3341002 on 2017/03/10 by Maciej.Mroz Nativization: Fixed FFindHeadersToInclude. Headers necessary for owners of subobjects are properly included. Change 3341076 on 2017/03/10 by Steve.Robb Fix for FBakedTextureSourceInfo move semantics. #jira UE-42658 Change 3341160 on 2017/03/10 by Gil.Gribb UE4 - Fix hazard with SetMaterialUsage from a thread. Change 3341409 on 2017/03/10 by Steve.Robb Reduction of the generated code size for StaticRegisterNatives functions. Change 3341523 on 2017/03/10 by Steve.Robb Code generation simplified. Change 3341800 on 2017/03/10 by Ben.Marsh UnrealVS: Fix UnrealVS compatibility with RTM version of Visual Studio 2017. 2017 toolchain for extensions is no longer able to build <= 2015 extensions due to validation of the VSIX manifest, so create a separate solution for it. Change 3342034 on 2017/03/10 by Ben.Marsh Fix compiler setting not being loaded correctly into the Windows target settings dialog. #jira UE-42746 Change 3342041 on 2017/03/10 by Ben.Marsh Fix -ErrorOnEngineContentUse not being set in the cooker options correctly. Change 3342094 on 2017/03/10 by Steve.Robb Fix to deteministic name order during code generation. Change 3342251 on 2017/03/10 by Daniel.Lamb Integrate fix for resave lightmaps commandlet when upgrading from no mapbuilddatapackages to mapbuilddatapackages. #thanks Tim.Hagberg #test None Change 3342961 on 2017/03/13 by Robert.Manuszewski Fixing memory leak when playing while running -nullrhi on the commandline in cooked games caused by shader resources not being destroyed. #jira FORT-38977 Change 3343022 on 2017/03/13 by Steve.Robb GetTypeHash fixes for FUniqueNetIdLive. #jira UE-42788 Change 3343448 on 2017/03/13 by Steve.Robb Compiled-in defer object order fixed. Debuggability of the deferred registration map improved. #jira UE-42828 [CL 3345747 by Ben Marsh in Main branch]
2017-03-14 15:48:33 -04:00
struct FBatchedReleaseResources
{
enum
{
NumPerBatch = 16
};
int32 NumBatch;
FRenderResource* Resources[NumPerBatch];
FBatchedReleaseResources()
{
Reset();
}
void Reset()
{
NumBatch = 0;
}
void Execute()
{
for (int32 Index = 0; Index < NumBatch; Index++)
{
Resources[Index]->ReleaseResource();
}
Reset();
}
void Flush()
{
if (NumBatch)
{
ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER(
BatchReleaseCommand,
FBatchedReleaseResources, BatchedReleaseResources, *this,
{
BatchedReleaseResources.Execute();
});
Reset();
}
}
void Add(FRenderResource* Resource)
{
if (NumBatch >= NumPerBatch)
{
Flush();
}
check(NumBatch < NumPerBatch);
Resources[NumBatch] = Resource;
NumBatch++;
}
bool IsEmpty()
{
return !NumBatch;
}
};
static bool GBatchedReleaseIsActive = false;
static FBatchedReleaseResources GBatchedRelease;
void StartBatchedRelease()
{
check(IsInGameThread() && !GBatchedReleaseIsActive && GBatchedRelease.IsEmpty());
GBatchedReleaseIsActive = true;
}
void EndBatchedRelease()
{
check(IsInGameThread() && GBatchedReleaseIsActive);
GBatchedRelease.Flush();
GBatchedReleaseIsActive = false;
}
void BeginReleaseResource(FRenderResource* Resource)
{
Copying //UE4/Dev-Core to //UE4/Dev-Main (Source: //UE4/Dev-Core @ 3345728) #lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 3315219 on 2017/02/21 by Steve.Robb Fix for FObjectAndNameAsStringProxyArchive when serializing a TWeakObjectPtr. Change 3315285 on 2017/02/21 by Steve.Robb Explicitly pass string builder into code generation functions. Change 3315341 on 2017/02/21 by Ben.Marsh UAT: Clean up some formatting in StreamCopyDescription output - remove #fyi lines, exclude merge commits, and remove some blank lines. Change 3315350 on 2017/02/21 by Ben.Marsh Fix shared resource files not being rebuilt if the version header changes. Change 3315823 on 2017/02/21 by Ben.Marsh UAT: Use a class derived from AutomationException to return information specific to commandlets failing, rather than putting it in the base class. Change 3315826 on 2017/02/21 by Ben.Marsh UAT: Move Distiller class from general use in UAT; FileFilter provides a much safer and fully featured implementation of the same concepts. Change 3315857 on 2017/02/21 by Ben.Marsh UBT: Remove the StripBaseDirectory() and MakeRerootedFilePath() utility functions from UBT. These operations can now be done more safely with FileReference objects. Change 3315942 on 2017/02/21 by Ben.Marsh UBT: Convert FileFilter to use FileReference and DirectoryReference arguments everywhere. Change 3316236 on 2017/02/22 by Maciej.Mroz #jira UE-42045 Nativization Fixed Warning: TEnumAsByte is not intended for use with enum Change 3316253 on 2017/02/22 by Robert.Manuszewski Fixes for the async log file writer hangs and crashes. - potential fix for the logging system hang when running out of disk space while flushing log - fix for unexpected concurrency assert when flushing the log buffer to disk Change 3316293 on 2017/02/22 by Steve.Robb GetTypeHash and lexicographical comparison operators (operator<() etc.) for TTuple. Change 3316342 on 2017/02/22 by Maciej.Mroz Nativization: Wrappers (stubs) required only by other wrappers are properly generated. #codereview: Mike.Beach Change 3316344 on 2017/02/22 by Maciej.Mroz Fixed crash in nativized Odin Async loading properly handles nativized structs. Change 3316359 on 2017/02/22 by Steve.Robb GitHub #3287 : Ignore #pragma in USTRUCTs #jira UE-42248 Change 3316389 on 2017/02/22 by Matthew.Griffin Switched Installed Engine Filters to multiline properties to make them more readable Added Oodle to list of excluded plugins #jira UE-42030 Change 3316392 on 2017/02/22 by Ben.Marsh UBT: Split out FileReference/DirectoryReference classes into their own file. Change 3316394 on 2017/02/22 by Ben.Marsh UBT: Move FileReference/DirectoryReference extension methods into the appropriate file. Change 3316411 on 2017/02/22 by Ben.Marsh UAT: Remove file functions that take multiple arguments. There's not really a compelling use case for these to exist over looping from the calling code. Change 3316446 on 2017/02/22 by Ben.Marsh UAT: Try disabling function name prefix to log output from UAT, to see if it improves readability. Function names are still included in the log file for debugging. Change 3316575 on 2017/02/22 by Ben.Marsh UAT: Remove unused functionality for dealing with labels, and output a more human readable list of P4 settings at startup. Change 3318481 on 2017/02/22 by Steve.Robb Use of FMath::IsPowerOfTwo in check. Static assert to ensure that an inline set allocator will have a hash size of a power of two. Change 3318496 on 2017/02/22 by Steve.Robb Fix for TSet visualizers. Change 3318919 on 2017/02/23 by Steve.Robb Fix for hot reloading UScriptStruct-derived objects in a module, where the CDOs of these objects haven't had PrepareCppStructOps() called on them. #jira UE-42178 Change 3318942 on 2017/02/23 by Steve.Robb Removal of a redundant insertion which can cause problems on reallocation of the map. Change 3319010 on 2017/02/23 by Ben.Marsh UBT: Fix exception when a file that was previously part of the working set is deleted. Change 3319134 on 2017/02/23 by Robert.Manuszewski Better fix for a deadlock when flushing log while it's already being flushed due to flush timer on the async log writer thread. Change 3319249 on 2017/02/23 by Matthew.Griffin Added a function to check if running with debug game libs instead of checking command line in multiple places Added -RunConfig parameter, which has equivalent result to -debug if value of parameter starts with 'debug' Added -RunConfig=$(Configuration) as a default commandline argument for Mac so that editor can use debug game libs Removed -Shipping argument from VCProject generation as it's not used anymore Change 3319253 on 2017/02/23 by Maciej.Mroz #jira UE-41846 New mechanism to gather modules necessary for Nativized Assets. The modules are listed based on included headers. Previously the dependencies was gathered only in FBlueprintNativeCodeGenManifest::GatherModuleDependencies. Change 3319591 on 2017/02/23 by Ben.Marsh Don't strip prefixes beginning with WARNING: or ERROR: using the Postp filter. Change 3320357 on 2017/02/23 by Steven.Hutton Slight changes to Add Crash method - Returning select fields instead of entity objects in queries for perf reasons. Change 3320361 on 2017/02/23 by Steven.Hutton Performance improvements subsequent to the recent database changes. Change 3320446 on 2017/02/23 by Steven.Hutton adding my temporary performance tracker class - reports to a private slack channel with add crash performance data. Change 3320479 on 2017/02/23 by Ben.Marsh Fix CIS errors. Change 3320576 on 2017/02/23 by Jin.Zhang Update CrashReporter to use AWS Change 3320742 on 2017/02/23 by Jin.Zhang Merging crash caching Change 3321119 on 2017/02/24 by Robert.Manuszewski DLL injection protection support for non-monolithic builds Change 3323308 on 2017/02/27 by Matthew.Griffin Moved compilation of SwarmInterface after its dependencies so that we will see a build failure immediately if they change version in future Change 3323423 on 2017/02/27 by Chad.Garyet Adding a script to check and warn about csproj targeted .net versions being mismatched #JIRA UE-39624 Change 3323442 on 2017/02/27 by Ben.Marsh UBT: Output an error if an engine module references a game module. Change 3323743 on 2017/02/27 by Ben.Marsh PR #3303: Resolved PVS scan issues (Contributed by projectgheist) Change 3323748 on 2017/02/27 by Ben.Marsh Convert whitespace to tabs. Change 3324851 on 2017/02/28 by Chris.Wood Add Odin symbol locations to engine config for MDD on CR server. NotForLicensees Change 3324979 on 2017/02/28 by Gil.Gribb Fixed bad merge of priority change in the EDL. Change 3326889 on 2017/03/01 by Steven.Hutton Update to buggs controller to generate faster queries. Change 3326910 on 2017/03/01 by Robert.Manuszewski Removing legacy #if from PackageFileSummary. Change 3327118 on 2017/03/01 by Gil.Gribb UE4 - Fixed race that resulted in a memory leak when reading compressed paks. Change 3327633 on 2017/03/01 by Gil.Gribb UE4 - Added a cvar to control the pak precacher thottle. Change 3327674 on 2017/03/01 by Steve.Robb Unified boilerplate between all generated code files. Change 3328544 on 2017/03/01 by Chris.Wood CrashReportProcess.config update (CRP v1.2.17) Tweaks to a few values. Update website URL to explicitly point to old, non-cloud site on devweb-02. Change 3328714 on 2017/03/01 by Chris.Wood Correct CRP config regression. Point website at new cloud site. Still v1.2.17 Change 3329192 on 2017/03/02 by Matthew.Griffin Added Shared Build Id file to the list of Precompiled Build Dependencies in a target receipt so that it's brought into an installed build Change 3329285 on 2017/03/02 by Ben.Marsh UGS: Allow a project to specify a filters for the streams that should be displayed for fast-switching to. The QuickSelectStreamList seting in the [Options] section of the project settings references a depot path containing a list of strings used to filter the stream list. An option is shown to switch back to showing all available streams, if desired. Change 3330636 on 2017/03/02 by Ben.Marsh UBT: Bump version number of C++ include cache to force it to be rebuilt with additional include information for the default RC files. Change 3331262 on 2017/03/03 by Robert.Manuszewski Merging Dev-LoadTimes to Dev-Core (Garbage Collection performance improvements) - Improved GC multithreading - Improved BeginDestroy performance - Introduced ULevelActorCluster for StaticMeshActor and ReflectionCapture actor clustering (can be toggled through project settings or console command gc.ActorClusterEnabled) - A few improvements to AddReferencedObjects functions - Misc improvements to GC code - Garbage Collector now properly handles clusters which had their objects marked as pending kill - Blueprints can now create clusters too (can be toggled through project settings or console command gc.BlueprintClusteringEnabled, defaults to disabled) Change 3331285 on 2017/03/03 by Robert.Manuszewski A few fixes for the previous check-in. Change 3332001 on 2017/03/03 by Ben.Marsh UBT: Add support for generating a UDN file containing the valid settings for BuildConfiguration.xml. Pass -configdoc=<filename> on the command line to generate such a file. Change 3332022 on 2017/03/03 by Ben.Marsh Update documentation for where to find the BuildConfiguration settings. Change 3332031 on 2017/03/03 by Ben.Marsh Remove documentation for Windows XP support; it has been removed in the 4.16 release. Change 3332256 on 2017/03/03 by Ben.Marsh UBT: Add support for generating a UDN page containing module and target settings. Change 3332458 on 2017/03/03 by Ben.Marsh UBT: Improvements to generated documentation. Change 3332459 on 2017/03/03 by Ben.Marsh Add generated documentation for .target.cs files, .build.cs files, and BuildConfiguration.xml files. Change 3332460 on 2017/03/03 by Ben.Marsh UBT: Make LinkTypePrivate actually private, so it doesn't show up in the docs. Change 3332899 on 2017/03/06 by Robert.Manuszewski Making sure actor clustering is not used in the editor (fix for actors being deleted when GC runs in the editor) #jira UE-42548 Change 3332955 on 2017/03/06 by Maciej.Mroz Nativization distinguishes client and server platform: - Separated lists on additional assets, additional modules, excluded assets, excluded modules, excluded paths (in config) - Context (compilation options, nativization options and platform) is deliveren to BPCOmpilerCppBackend in FCompilerNativizationOptions struct. - Wrappers (for unconverted BPs) are created only when they are directly called. - Fortnite dedicated server can be nativized Change 3332990 on 2017/03/06 by Ben.Marsh UBT: Add more comprehensive wrapper methods for System.IO.File and System.IO.Directory to FileReference and DirectoryReference. Change 3333032 on 2017/03/06 by Ben.Marsh Documentation for build tools Change 3333037 on 2017/03/06 by Ben.Marsh Add a build step to extract UAT and UBT documentation from XML comments. Change 3333089 on 2017/03/06 by Ben.Marsh UAT: Re-enable logging the calling function to the console in UAT. Needs a pass for readability first. Change 3333651 on 2017/03/06 by Gil.Gribb UE4 - Fix a werid recursive situation where StaticLoadObject could return an object that has not finished loading. Also produces a fatal error if this sometimes happens. EDL only. Change 3335236 on 2017/03/07 by Ben.Marsh UGS: Set the sync changelist separately to the compatibility changelist. Change 3335261 on 2017/03/07 by Gil.Gribb UE4 - Fixed batched render fences when BeginDestroy calls FlushRenderingCommands. Change 3335740 on 2017/03/07 by Gil.Gribb maybe fix static analysis warning Change 3335945 on 2017/03/07 by Steve.Robb Move FFindInstancedReferenceSubobjectHelper code out of header. Add map/set property support to allow instanced members of these container types to be handled during CPFUO. https://udn.unrealengine.com/questions/349232/tmap-with-instanced-object-as-value-gets-cleared-o.html Change 3336693 on 2017/03/07 by Ben.Marsh UBT: Use shared PCHs for game plugins by default, to reduce time spent generating individual PCHs. Change 3336694 on 2017/03/07 by Steve.Robb Static assert added to TMap to prevent the use of keys which don't implement a GetTypeHash. Fixes to types which relied on implicit conversions when calling GetTypeHash. Workaround in SAssetView.h and PropertyEditorModule.h for an apparent VC bug where the compiler wrongly instantiates TPointerIsConvertibleFromTo for certain forward-declared types, causing future TSharedPtr conversions to fail. #jira UE-42441 Change 3336698 on 2017/03/07 by Steve.Robb Hardcoded endpoint handling replaced with a generic string. Obsolete .proto and .java code generation removed. Change 3336811 on 2017/03/07 by Wes.Hunt Add a game blacklist to the crash report processor. Fixed a syntax error in Config.cs, added a XML comment to shut up a warning. Change 3336973 on 2017/03/08 by Steve.Robb Fix for missing GetTypeHash in a plugin. Change 3336996 on 2017/03/08 by Steve.Robb Significant refactor of code generation, to try and make data flow more apparent. Change 3337571 on 2017/03/08 by Steve.Robb CIS fixes for missing GetTypeHash functions. Non-unity fix. Change 3337588 on 2017/03/08 by Gil.Gribb UE4 - Fixed obscure check with flushing rhi resources. Change 3337620 on 2017/03/08 by Steve.Robb WITH_HOT_RELOAD_CTORS macros removed. UseVTableConstructors config option removed. Change 3339369 on 2017/03/09 by Steve.Robb GetTypeHash overload for nn::account::Uid. Change 3339464 on 2017/03/09 by Daniel.Lamb Fixed assert in 4.15 to do with trying to gather dependency info from invalid packages. #jira UE-42583 #test Editor + Cook + Run shootergame Change 3339465 on 2017/03/09 by Maciej.Mroz Fixed serialization issue, after UserDefinedEnum was used in EnumProperty. Change 3339469 on 2017/03/09 by Maciej.Mroz Fixed Nativization problem, when default value is passed as non-const reference. Change 3340178 on 2017/03/09 by Daniel.Lamb Added support for in memory only packages. The Cooker ignores these and added core functions to recognize these packages. Other systems will need to add support where nessisary. Change 3341002 on 2017/03/10 by Maciej.Mroz Nativization: Fixed FFindHeadersToInclude. Headers necessary for owners of subobjects are properly included. Change 3341076 on 2017/03/10 by Steve.Robb Fix for FBakedTextureSourceInfo move semantics. #jira UE-42658 Change 3341160 on 2017/03/10 by Gil.Gribb UE4 - Fix hazard with SetMaterialUsage from a thread. Change 3341409 on 2017/03/10 by Steve.Robb Reduction of the generated code size for StaticRegisterNatives functions. Change 3341523 on 2017/03/10 by Steve.Robb Code generation simplified. Change 3341800 on 2017/03/10 by Ben.Marsh UnrealVS: Fix UnrealVS compatibility with RTM version of Visual Studio 2017. 2017 toolchain for extensions is no longer able to build <= 2015 extensions due to validation of the VSIX manifest, so create a separate solution for it. Change 3342034 on 2017/03/10 by Ben.Marsh Fix compiler setting not being loaded correctly into the Windows target settings dialog. #jira UE-42746 Change 3342041 on 2017/03/10 by Ben.Marsh Fix -ErrorOnEngineContentUse not being set in the cooker options correctly. Change 3342094 on 2017/03/10 by Steve.Robb Fix to deteministic name order during code generation. Change 3342251 on 2017/03/10 by Daniel.Lamb Integrate fix for resave lightmaps commandlet when upgrading from no mapbuilddatapackages to mapbuilddatapackages. #thanks Tim.Hagberg #test None Change 3342961 on 2017/03/13 by Robert.Manuszewski Fixing memory leak when playing while running -nullrhi on the commandline in cooked games caused by shader resources not being destroyed. #jira FORT-38977 Change 3343022 on 2017/03/13 by Steve.Robb GetTypeHash fixes for FUniqueNetIdLive. #jira UE-42788 Change 3343448 on 2017/03/13 by Steve.Robb Compiled-in defer object order fixed. Debuggability of the deferred registration map improved. #jira UE-42828 [CL 3345747 by Ben Marsh in Main branch]
2017-03-14 15:48:33 -04:00
if (GBatchedReleaseIsActive && IsInGameThread())
{
GBatchedRelease.Add(Resource);
return;
}
ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER(
ReleaseCommand,
FRenderResource*,Resource,Resource,
{
Resource->ReleaseResource();
});
}
void ReleaseResourceAndFlush(FRenderResource* Resource)
{
// Send the release message.
ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER(
ReleaseCommand,
FRenderResource*,Resource,Resource,
{
Resource->ReleaseResource();
});
FlushRenderingCommands();
}
FTextureReference::FTextureReference()
: TextureReferenceRHI(NULL)
{
}
FTextureReference::~FTextureReference()
{
}
void FTextureReference::BeginInit_GameThread()
{
bInitialized_GameThread = true;
BeginInitResource(this);
}
void FTextureReference::BeginRelease_GameThread()
{
BeginReleaseResource(this);
bInitialized_GameThread = false;
}
void FTextureReference::InvalidateLastRenderTime()
{
LastRenderTimeRHI.SetLastRenderTime(-FLT_MAX);
}
void FTextureReference::InitRHI()
{
TextureReferenceRHI = RHICreateTextureReference(&LastRenderTimeRHI);
}
void FTextureReference::ReleaseRHI()
{
TextureReferenceRHI.SafeRelease();
}
FString FTextureReference::GetFriendlyName() const
{
return TEXT("FTextureReference");
}
/** The global null color vertex buffer, which is set with a stride of 0 on meshes without a color component. */
TGlobalResource<FNullColorVertexBuffer> GNullColorVertexBuffer;
/*------------------------------------------------------------------------------
FGlobalDynamicVertexBuffer implementation.
------------------------------------------------------------------------------*/
/**
* An individual dynamic vertex buffer.
*/
class FDynamicVertexBuffer : public FVertexBuffer
{
public:
/** The aligned size of all dynamic vertex buffers. */
enum { ALIGNMENT = (1 << 16) }; // 64KB
/** Pointer to the vertex buffer mapped in main memory. */
uint8* MappedBuffer;
/** Size of the vertex buffer in bytes. */
uint32 BufferSize;
/** Number of bytes currently allocated from the buffer. */
uint32 AllocatedByteCount;
/** Default constructor. */
explicit FDynamicVertexBuffer(uint32 InMinBufferSize)
: MappedBuffer(NULL)
, BufferSize(FMath::Max<uint32>(Align(InMinBufferSize,ALIGNMENT),ALIGNMENT))
, AllocatedByteCount(0)
{
}
/**
* Locks the vertex buffer so it may be written to.
*/
void Lock()
{
check(MappedBuffer == NULL);
check(AllocatedByteCount == 0);
check(IsValidRef(VertexBufferRHI));
MappedBuffer = (uint8*)RHILockVertexBuffer(VertexBufferRHI, 0, BufferSize, RLM_WriteOnly);
}
/**
* Unocks the buffer so the GPU may read from it.
*/
void Unlock()
{
check(MappedBuffer != NULL);
check(IsValidRef(VertexBufferRHI));
RHIUnlockVertexBuffer(VertexBufferRHI);
MappedBuffer = NULL;
AllocatedByteCount = 0;
}
// FRenderResource interface.
virtual void InitRHI() override
{
check(!IsValidRef(VertexBufferRHI));
FRHIResourceCreateInfo CreateInfo;
VertexBufferRHI = RHICreateVertexBuffer(BufferSize, BUF_Volatile, CreateInfo);
MappedBuffer = NULL;
AllocatedByteCount = 0;
}
virtual void ReleaseRHI() override
{
FVertexBuffer::ReleaseRHI();
MappedBuffer = NULL;
AllocatedByteCount = 0;
}
virtual FString GetFriendlyName() const override
{
return TEXT("FDynamicVertexBuffer");
}
};
/**
* A pool of dynamic vertex buffers.
*/
struct FDynamicVertexBufferPool
{
/** List of vertex buffers. */
TIndirectArray<FDynamicVertexBuffer> VertexBuffers;
/** The current buffer from which allocations are being made. */
FDynamicVertexBuffer* CurrentVertexBuffer;
/** Default constructor. */
FDynamicVertexBufferPool()
: CurrentVertexBuffer(NULL)
{
}
/** Destructor. */
~FDynamicVertexBufferPool()
{
int32 NumVertexBuffers = VertexBuffers.Num();
for (int32 BufferIndex = 0; BufferIndex < NumVertexBuffers; ++BufferIndex)
{
VertexBuffers[BufferIndex].ReleaseResource();
}
}
};
FGlobalDynamicVertexBuffer::FGlobalDynamicVertexBuffer()
{
Pool = new FDynamicVertexBufferPool();
}
FGlobalDynamicVertexBuffer::~FGlobalDynamicVertexBuffer()
{
delete Pool;
Pool = NULL;
}
FGlobalDynamicVertexBuffer::FAllocation FGlobalDynamicVertexBuffer::Allocate(uint32 SizeInBytes)
{
FAllocation Allocation;
FDynamicVertexBuffer* VertexBuffer = Pool->CurrentVertexBuffer;
if (VertexBuffer == NULL || VertexBuffer->AllocatedByteCount + SizeInBytes > VertexBuffer->BufferSize)
{
// Find a buffer in the pool big enough to service the request.
VertexBuffer = NULL;
for (int32 BufferIndex = 0, NumBuffers = Pool->VertexBuffers.Num(); BufferIndex < NumBuffers; ++BufferIndex)
{
FDynamicVertexBuffer& VertexBufferToCheck = Pool->VertexBuffers[BufferIndex];
if (VertexBufferToCheck.AllocatedByteCount + SizeInBytes <= VertexBufferToCheck.BufferSize)
{
VertexBuffer = &VertexBufferToCheck;
break;
}
}
// Create a new vertex buffer if needed.
if (VertexBuffer == NULL)
{
VertexBuffer = new(Pool->VertexBuffers) FDynamicVertexBuffer(SizeInBytes);
VertexBuffer->InitResource();
}
// Lock the buffer if needed.
if (VertexBuffer->MappedBuffer == NULL)
{
VertexBuffer->Lock();
}
// Remember this buffer, we'll try to allocate out of it in the future.
Pool->CurrentVertexBuffer = VertexBuffer;
}
check(VertexBuffer != NULL);
checkf(VertexBuffer->AllocatedByteCount + SizeInBytes <= VertexBuffer->BufferSize, TEXT("Global vertex buffer allocation failed: BufferSize=%d AllocatedByteCount=%d SizeInBytes=%d"), VertexBuffer->BufferSize, VertexBuffer->AllocatedByteCount, SizeInBytes);
Allocation.Buffer = VertexBuffer->MappedBuffer + VertexBuffer->AllocatedByteCount;
Allocation.VertexBuffer = VertexBuffer;
Allocation.VertexOffset = VertexBuffer->AllocatedByteCount;
VertexBuffer->AllocatedByteCount += SizeInBytes;
return Allocation;
}
void FGlobalDynamicVertexBuffer::Commit()
{
for (int32 BufferIndex = 0, NumBuffers = Pool->VertexBuffers.Num(); BufferIndex < NumBuffers; ++BufferIndex)
{
FDynamicVertexBuffer& VertexBuffer = Pool->VertexBuffers[BufferIndex];
if (VertexBuffer.MappedBuffer != NULL)
{
VertexBuffer.Unlock();
}
}
Pool->CurrentVertexBuffer = NULL;
}
FGlobalDynamicVertexBuffer& FGlobalDynamicVertexBuffer::Get()
{
check(IsInRenderingThread());
static FGlobalDynamicVertexBuffer GlobalDynamicVertexBuffer;
return GlobalDynamicVertexBuffer;
}
/*------------------------------------------------------------------------------
FGlobalDynamicIndexBuffer implementation.
------------------------------------------------------------------------------*/
/**
* An individual dynamic index buffer.
*/
class FDynamicIndexBuffer : public FIndexBuffer
{
public:
/** The aligned size of all dynamic index buffers. */
enum { ALIGNMENT = (1 << 16) }; // 64KB
/** Pointer to the index buffer mapped in main memory. */
uint8* MappedBuffer;
/** Size of the index buffer in bytes. */
uint32 BufferSize;
/** Number of bytes currently allocated from the buffer. */
uint32 AllocatedByteCount;
/** Stride of the buffer in bytes. */
uint32 Stride;
/** Initialization constructor. */
explicit FDynamicIndexBuffer(uint32 InMinBufferSize, uint32 InStride)
: MappedBuffer(NULL)
, BufferSize(FMath::Max<uint32>(Align(InMinBufferSize,ALIGNMENT),ALIGNMENT))
, AllocatedByteCount(0)
, Stride(InStride)
{
}
/**
* Locks the vertex buffer so it may be written to.
*/
void Lock()
{
check(MappedBuffer == NULL);
check(AllocatedByteCount == 0);
check(IsValidRef(IndexBufferRHI));
MappedBuffer = (uint8*)RHILockIndexBuffer(IndexBufferRHI, 0, BufferSize, RLM_WriteOnly);
}
/**
* Unocks the buffer so the GPU may read from it.
*/
void Unlock()
{
check(MappedBuffer != NULL);
check(IsValidRef(IndexBufferRHI));
RHIUnlockIndexBuffer(IndexBufferRHI);
MappedBuffer = NULL;
AllocatedByteCount = 0;
}
// FRenderResource interface.
virtual void InitRHI() override
{
check(!IsValidRef(IndexBufferRHI));
FRHIResourceCreateInfo CreateInfo;
IndexBufferRHI = RHICreateIndexBuffer(Stride, BufferSize, BUF_Volatile, CreateInfo);
MappedBuffer = NULL;
AllocatedByteCount = 0;
}
virtual void ReleaseRHI() override
{
FIndexBuffer::ReleaseRHI();
MappedBuffer = NULL;
AllocatedByteCount = 0;
}
virtual FString GetFriendlyName() const override
{
return TEXT("FDynamicIndexBuffer");
}
};
/**
* A pool of dynamic index buffers.
*/
struct FDynamicIndexBufferPool
{
/** List of index buffers. */
TIndirectArray<FDynamicIndexBuffer> IndexBuffers;
/** The current buffer from which allocations are being made. */
FDynamicIndexBuffer* CurrentIndexBuffer;
/** Stride of buffers in this pool. */
uint32 BufferStride;
/** Initialization constructor. */
explicit FDynamicIndexBufferPool(uint32 InBufferStride)
: CurrentIndexBuffer(NULL)
, BufferStride(InBufferStride)
{
}
/** Destructor. */
~FDynamicIndexBufferPool()
{
int32 NumIndexBuffers = IndexBuffers.Num();
for (int32 BufferIndex = 0; BufferIndex < NumIndexBuffers; ++BufferIndex)
{
IndexBuffers[BufferIndex].ReleaseResource();
}
}
};
FGlobalDynamicIndexBuffer::FGlobalDynamicIndexBuffer()
{
Pools[0] = new FDynamicIndexBufferPool(sizeof(uint16));
Pools[1] = new FDynamicIndexBufferPool(sizeof(uint32));
}
FGlobalDynamicIndexBuffer::~FGlobalDynamicIndexBuffer()
{
for (int32 i = 0; i < 2; ++i)
{
delete Pools[i];
Pools[i] = NULL;
}
}
FGlobalDynamicIndexBuffer::FAllocation FGlobalDynamicIndexBuffer::Allocate(uint32 NumIndices, uint32 IndexStride)
{
FAllocation Allocation;
if (IndexStride != 2 && IndexStride != 4)
{
return Allocation;
}
FDynamicIndexBufferPool* Pool = Pools[IndexStride >> 2]; // 2 -> 0, 4 -> 1
uint32 SizeInBytes = NumIndices * IndexStride;
FDynamicIndexBuffer* IndexBuffer = Pool->CurrentIndexBuffer;
if (IndexBuffer == NULL || IndexBuffer->AllocatedByteCount + SizeInBytes > IndexBuffer->BufferSize)
{
// Find a buffer in the pool big enough to service the request.
IndexBuffer = NULL;
for (int32 BufferIndex = 0, NumBuffers = Pool->IndexBuffers.Num(); BufferIndex < NumBuffers; ++BufferIndex)
{
FDynamicIndexBuffer& IndexBufferToCheck = Pool->IndexBuffers[BufferIndex];
if (IndexBufferToCheck.AllocatedByteCount + SizeInBytes <= IndexBufferToCheck.BufferSize)
{
IndexBuffer = &IndexBufferToCheck;
break;
}
}
// Create a new index buffer if needed.
if (IndexBuffer == NULL)
{
IndexBuffer = new(Pool->IndexBuffers) FDynamicIndexBuffer(SizeInBytes, Pool->BufferStride);
IndexBuffer->InitResource();
}
// Lock the buffer if needed.
if (IndexBuffer->MappedBuffer == NULL)
{
IndexBuffer->Lock();
}
Pool->CurrentIndexBuffer = IndexBuffer;
}
check(IndexBuffer != NULL);
checkf(IndexBuffer->AllocatedByteCount + SizeInBytes <= IndexBuffer->BufferSize, TEXT("Global index buffer allocation failed: BufferSize=%d AllocatedByteCount=%d SizeInBytes=%d"), IndexBuffer->BufferSize, IndexBuffer->AllocatedByteCount, SizeInBytes);
Allocation.Buffer = IndexBuffer->MappedBuffer + IndexBuffer->AllocatedByteCount;
Allocation.IndexBuffer = IndexBuffer;
Allocation.FirstIndex = IndexBuffer->AllocatedByteCount / IndexStride;
IndexBuffer->AllocatedByteCount += SizeInBytes;
return Allocation;
}
void FGlobalDynamicIndexBuffer::Commit()
{
for (int32 i = 0; i < 2; ++i)
{
FDynamicIndexBufferPool* Pool = Pools[i];
for (int32 BufferIndex = 0, NumBuffers = Pool->IndexBuffers.Num(); BufferIndex < NumBuffers; ++BufferIndex)
{
FDynamicIndexBuffer& IndexBuffer = Pool->IndexBuffers[BufferIndex];
if (IndexBuffer.MappedBuffer != NULL)
{
IndexBuffer.Unlock();
}
}
Pool->CurrentIndexBuffer = NULL;
}
}
FGlobalDynamicIndexBuffer& FGlobalDynamicIndexBuffer::Get()
{
check(IsInRenderingThread());
static FGlobalDynamicIndexBuffer GlobalDynamicIndexBuffer;
return GlobalDynamicIndexBuffer;
}
/*=============================================================================
FMipBiasFade class
=============================================================================*/
/** Global mip fading settings, indexed by EMipFadeSettings. */
FMipFadeSettings GMipFadeSettings[MipFade_NumSettings] =
{
FMipFadeSettings(0.3f, 0.1f), // MipFade_Normal
FMipFadeSettings(2.0f, 1.0f) // MipFade_Slow
};
/** How "old" a texture must be to be considered a "new texture", in seconds. */
float GMipLevelFadingAgeThreshold = 0.5f;
/**
* Sets up a new interpolation target for the mip-bias.
* @param ActualMipCount Number of mip-levels currently in memory
* @param TargetMipCount Number of mip-levels we're changing to
* @param LastRenderTime Timestamp when it was last rendered (FApp::CurrentTime time space)
* @param FadeSetting Which fade speed settings to use
*/
void FMipBiasFade::SetNewMipCount( float ActualMipCount, float TargetMipCount, double LastRenderTime, EMipFadeSettings FadeSetting )
{
check( ActualMipCount >=0 && TargetMipCount <= ActualMipCount );
float TimeSinceLastRendered = float(FApp::GetCurrentTime() - LastRenderTime);
// Is this a new texture or is this not in-game?
if ( TotalMipCount == 0 || TimeSinceLastRendered >= GMipLevelFadingAgeThreshold || GEnableMipLevelFading < 0.0f )
{
// No fading.
TotalMipCount = ActualMipCount;
MipCountDelta = 0.0f;
MipCountFadingRate = 0.0f;
StartTime = GRenderingRealtimeClock.GetCurrentTime();
BiasOffset = 0.0f;
return;
}
// Calculate the mipcount we're interpolating towards.
float CurrentTargetMipCount = TotalMipCount - BiasOffset + MipCountDelta;
// Is there no change?
if ( FMath::IsNearlyEqual(TotalMipCount, ActualMipCount) && FMath::IsNearlyEqual(TargetMipCount, CurrentTargetMipCount) )
{
return;
}
// Calculate the mip-count at our current interpolation point.
float CurrentInterpolatedMipCount = TotalMipCount - CalcMipBias();
// Clamp it against the available mip-levels.
CurrentInterpolatedMipCount = FMath::Clamp<float>(CurrentInterpolatedMipCount, 0, ActualMipCount);
// Set up a new interpolation from CurrentInterpolatedMipCount to TargetMipCount.
StartTime = GRenderingRealtimeClock.GetCurrentTime();
TotalMipCount = ActualMipCount;
MipCountDelta = TargetMipCount - CurrentInterpolatedMipCount;
// Don't fade if we're already at the target mip-count.
if ( FMath::IsNearlyZero(MipCountDelta) )
{
MipCountDelta = 0.0f;
BiasOffset = 0.0f;
MipCountFadingRate = 0.0f;
}
else
{
BiasOffset = TotalMipCount - CurrentInterpolatedMipCount;
if ( MipCountDelta > 0.0f )
{
MipCountFadingRate = 1.0f / (GMipFadeSettings[FadeSetting].FadeInSpeed * MipCountDelta);
}
else
{
MipCountFadingRate = -1.0f / (GMipFadeSettings[FadeSetting].FadeOutSpeed * MipCountDelta);
}
}
}