You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 3053250 on 2016/07/18 by Steve.Robb TNot metafunction added. Change 3053252 on 2016/07/18 by Steve.Robb New TIsEnumClass trait. Change 3061345 on 2016/07/22 by Robert.Manuszewski Changing FMallocStomp::GetAllocationSize() to return the requested allocation size instead of the physical allocation size to make FMallocStomp work properly with FMallocPoisonProxy Change 3061377 on 2016/07/22 by Graeme.Thornton Added bStripAnimationDataOnDedicatedServer option to UAnimationSettings which will remove all compressed data from cooked server data. Disabled by default Change 3064592 on 2016/07/26 by Steven.Hutton Uploading repository files Change 3064595 on 2016/07/26 by Steven.Hutton Assign crashes to buggs based not just on Callstack but also based on Error message. Error messages have "data" masked out and are then compared to a table of error messages to find similar messages. Ensures are not currently filtered by error message. Change 3066046 on 2016/07/27 by Graeme.Thornton Better dedicated client/server class exclusion during cooking - Add class lists to cooker settings so they can be modified in the editor Change 3066077 on 2016/07/27 by Graeme.Thornton Move Paragon NeedsLoadForServer calls over to the new config based system Change 3066203 on 2016/07/27 by Chris.Wood CrashReportProcess logging and Slack reporting improvements to monitor disk space. [UE-31129] - Crash Report server need to alert on Slack when the PDB cache is full Change 3066276 on 2016/07/27 by Graeme.Thornton Move simple NeedsLoadForClient implementations over to new config based system Change 3068019 on 2016/07/28 by Graeme.Thornton Don't call ReleaseResources on UStaticMesh if we never render, and therefore never actually initialize the resources - Corrects some bad stats Change 3068218 on 2016/07/28 by Chris.Wood CrashReportProcess 1.1.18 passes BuildVersion to MinidumpDiagnostics [UE-31706] - Add new BuildVersion string to crash context and website Also modified command line log file ini settings to stop MDD stalling trying to sort and delete its logs. Change3071665on 2016/08/01 by Robert.Manuszewski Moving RemoveNamesFromMasterList from UEnum destructor to BeginDestroy to avoid potential issues when its package has already been destroyed. Change 3073388 on 2016/08/02 by Graeme.Thornton Invalidate string asset reference tags after finishing up loading of an async package Change 3073745 on 2016/08/02 by Robert.Manuszewski Disabling logging to memory in shipping by default. From now on FOutputDeviceMemory will be an opt-in for games. #jira FORT-27839 Change 3074866 on 2016/08/03 by Robert.Manuszewski PR #2650: Fixed a bug where newline escape sequence wasnt written to the pipe (Contributed by ozturkhakki) Change3075128on 2016/08/03 by Steve.Robb Static analysis fixes: error C2065: 'ThisOuterWorld': undeclared identifier Change 3075130 on 2016/08/03 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'LODLevel' Change 3075131 on 2016/08/03 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Owner' Change 3075235 on 2016/08/03 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'AnimToOperateOn' Change 3075248 on 2016/08/03 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'ParentProfile' Change 3075662 on 2016/08/03 by Steve.Robb Static analysis/buffer size fix: warning C28020: The expression '_Param_(7)>=sizeof(ICMP_ECHO_REPLY)+_Param_(4)+8' is not true at this call Change 3075668 on 2016/08/03 by Steve.Robb Static analysis fix: warning C6326: Potential comparison of a constant with another constant Change 3075679 on 2016/08/03 by Chris.Wood Added -NoTrimCallstack command line arg to MDD calls from CRP 1.1.19 [OR-26335] - 29.1 crash reporter generating reports with no callstacks / info New MDD has -NoTrimCallstack option to leave possibly irrelevant entires in the stack. Trimming is somewhat arbitrary and based on string matching. I'd rather see the whole thing. Change 3077070 on 2016/08/04 by Steve.Robb Dead array slack tracking code removed. Change 3077113 on 2016/08/04 by Steve.Robb TEnumAsByte is now deprecated for enum classes. All current uses fixed (which tidies up that code anyway). New FArchive::op<< for enum classes. Generated code now never uses TEnumAsByte for enum classes. Change 3077117 on 2016/08/04 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'DefaultSettings' Change 3078709 on 2016/08/05 by Steve.Robb FUNCTION_NO_NULL_RETURN_* macros added to statically annotate a function to say that it never returns a null pointer. TObjectIterator annotated to never return null. NewObject annotated to never return null. Change 3078836 on 2016/08/05 by Graeme.Thornton Silently skip creating exports from a package where the outer is also an export and has been filtered at runtime during loading Change 3082217 on 2016/08/09 by Steve.Robb Missing #include for FUniqueNetIdRepl added. Change 3083679 on 2016/08/10 by Chris.Wood CrashReportProcess performance improvements. CRP v1.1.22 [UE-34402] - Crash Reporter: Improve CRP performance by allowing multiple MDD instances [UE-34403] - Crash Reporter: CRP should throw away crashes when backlog is too large to avoid runaway Passing lock details to MDD on command line and managing multiple MDD tasks in CRP. Configurable values for range of queue sizes that cause us to throw away crashes. Change 3085362 on 2016/08/11 by Steve.Robb Rule-of-three fixes for FAIMessageObserver, to prevent accidents. From here: https://udn.unrealengine.com/questions/306507/tstaticarray-doesnt-call-destructor-on-elements-be.html Change 3085396 on 2016/08/11 by Steve.Robb Swap can now be configured via the TUseBitwiseSwap trait to not use Memswap, which can be less optimal for certain types. Change 3088840 on 2016/08/15 by Steve.Robb TRemoveReference moved to its own header. Change 3088858 on 2016/08/15 by Steve.Robb TDecay moved to its own header. Change 3088963 on 2016/08/15 by Steve.Robb Invoke function, for doing a generic call on a generic callable thing. Equivalent to std::invoke. Change 3089144 on 2016/08/15 by Steve.Robb Algo::Transform updated to use Invoke. Algorithm tests updated to test the new features. Change 3089147 on 2016/08/15 by Steve.Robb TLess and TGreater moved to their own headers and defaulted to void as a type-deducing version, as per std::. Change 3090243 on 2016/08/16 by Steve.Robb New Algo::Sort and Algo::SortBy algorithms. Change 3090387 on 2016/08/16 by Steve.Robb Improved bitwise swapping for Swap. See: https://udn.unrealengine.com/questions/306922/swap-is-painfully-slow.html Change 3090444 on 2016/08/16 by Steve.Robb Ptr+Size overloads removed after discussion - MakeArrayView should be used instead. Change 3090495 on 2016/08/16 by Steve.Robb Assert when FString::Mid is passed a negative count. #jira UE-18756 Change 3093455 on 2016/08/18 by Steve.Robb Debuggability and efficiency improvements to UScriptStruct::DeferCppStructOps. Change 3094476 on 2016/08/19 by Steve.Robb BOM removed from InvariantCulture.h. Change 3094697 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6237: (<zero> && <expression>) is always zero. <expression> is never evaluated and might have side effects. Change 3094702 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Interactor'. Change 3094715 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6385: Reading invalid data from 'Order': the readable size is '256' bytes, but '8160' bytes may be read. Change 3094737 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'OwnedComponent'. warning C28182: Dereferencing NULL pointer. 'Child' contains the same NULL value as 'AttachToComponent' did. Change 3094750 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Actor'. Change 3094768 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'LevelSequence'. warning C6011: Dereferencing NULL pointer 'Actor'. Change 3094774 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'CallFunctionNode'. Change 3094783 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'TargetPin'. Change 3094807 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'SourceClass'. Change 3094815 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'VarNode'. warning C6011: Dereferencing NULL pointer 'SourceClass'. Change 3094840 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'TunnelGraph'. warning C28182: Dereferencing NULL pointer. 'GraphNode' contains the same NULL value as 'SourceNode' did. Change 3094864 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'SpawnClassPin'. Change 3094880 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'PrevIfIndexMatchesStatement'. Change 3094886 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'SpawnBlueprintPin'. Change 3094903 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'K2Node'. Change 3094916 on 2016/08/19 by Steve.Robb Static analysis fix: Dereferencing NULL pointer 'CompilerContext'. Change 3094931 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'VariablePin'. Change 3094935 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'CurrentPin'. Change 3094943 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'Pin'. warning C28182: Dereferencing NULL pointer. 'Graph' contains the same NULL value as 'TargetGraph' did. Change 3094960 on 2016/08/19 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'LastOutPin'. Change 3095046 on 2016/08/19 by Steve.Robb Single parameter version of CastChecked tagged to never return null. Change 3095054 on 2016/08/19 by Steve.Robb Committed wrong version in CL# 3095046. Change 3095089 on 2016/08/19 by Steve.Robb Static analysis fixes: warning C6509: Invalid annotation: 'return' cannot be referenced in some contexts warning C6101: Returning uninitialized memory '*lpdwExitCode'. Change 3096035 on 2016/08/22 by Steve.Robb Fix for static lighting in pixel inspector. Change 3096039 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'World'. Change 3096045 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Actor'. Change 3096058 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'OtherPin'. Change 3096059 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'MainMesh'. Change 3096066 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'SourceType'. Change 3096070 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'LastPushStatement'. Change 3096074 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'OriginalDataTableInPin'. Change 3096075 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'CurrentPin'. Change 3096081 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'RunningPlatformData'. Change 3096156 on 2016/08/22 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'BP'. warning C6011: Dereferencing NULL pointer 'Object'. Change 3096308 on 2016/08/22 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'TopMipData'. warning C6011: Dereferencing NULL pointer 'MipCoverageData[0]'. Change 3096315 on 2016/08/22 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'OldParent'. warning C6011: Dereferencing NULL pointer 'TestExecutionInfo'. Change 3096318 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'OwnerClass'. Change 3096322 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'StaticMeshInstanceData'. Change3096337on 2016/08/22 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'Pin'. warning C6011: Dereferencing NULL pointer 'SpawnVarPin'. Change 3096345 on 2016/08/22 by Steve.Robb Static analysis fixes: warning C6246: Local declaration of 'NumTris' hides declaration of the same name in outer scope. Change 3096356 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'InWorld'. Change 3096387 on 2016/08/22 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'ExpressionPreviewMaterial'. warning C6011: Dereferencing NULL pointer 'MaterialNode->MaterialExpression'. Change 3096400 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'FunctionInputs'. Change 3096413 on 2016/08/22 by Steve.Robb Static analysis fix: warning C28182: Dereferencing NULL pointer. 'LODPackage' contains the same NULL value as 'AssetsOuter' did. Change 3096416 on 2016/08/22 by Steve.Robb Static analysis fixes: warning C6237: (<zero> && <expression>) is always zero. <expression> is never evaluated and might have side effects. Change 3096423 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'RedirectorRefs.Redirector'. Change 3096439 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'NewObject'. Change 3096446 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'BaseClass'. Change 3096454 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'OldSkeleton'. Change 3096464 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'MyNode'. Change 3096469 on 2016/08/22 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'VRInteractor'. Change 3097559 on 2016/08/23 by Steve.Robb Alternate fix to CL# 3096439. Change 3097583 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'SourceCategoryEnum'. warning C6011: Dereferencing NULL pointer 'CurrentWorld'. Change 3097584 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'LocalizationTarget'. Change 3097585 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C28182: Dereferencing NULL pointer. 'VariableSetNode' contains the same NULL value as 'AssignmentNode' did. warning C6011: Dereferencing NULL pointer 'FirstNativeClass'. Change 3097588 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'OutputObjClass'. Change 3097589 on 2016/08/23 by Steve.Robb Static analysis fix: warning C28182: Dereferencing NULL pointer. 'Term' contains the same NULL value as 'RValueTerm' did. Change 3097591 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Schema'. Change 3097597 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'LayerInfo'. Change 3097598 on 2016/08/23 by Steve.Robb Const-correctness fix for ILandscapeEditorModule::GetHeightmapFormatByExtension and ILandscapeEditorModule::GetWeightmapFormatByExtension. Change 3097600 on 2016/08/23 by Steve.Robb Fix for incorrect null check. Change 3097605 on 2016/08/23 by Steve.Robb Spurious static analysis fix: warning C6011: Dereferencing NULL pointer 'TexDataPtr'. Bug filed here: https://connect.microsoft.com/VisualStudio/feedback/details/3078125 Change 3097609 on 2016/08/23 by Steve.Robb Static analysis fix: warning C28182: Dereferencing NULL pointer. 'ObjClass' contains the same NULL value as 'BaseClass' did. Change 3097613 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'InEdGraph'. Change 3097620 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'ThisScalableFloat'. Change 3097627 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'AnimBlueprint'. Change 3097629 on 2016/08/23 by Steve.Robb Static analysis fix: warning C28182: Dereferencing NULL pointer. 'Pin' contains the same NULL value as 'PoseNet' did. Change 3097631 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'IPOverlayInfo.Brush'. Change 3097634 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Survey'. Change 3097639 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'Settings'. Change 3097650 on 2016/08/23 by Steve.Robb Alternate fix for CL# 3097597. Change 3097725 on 2016/08/23 by Steve.Robb Spurious static analysis fix: warning C6011: Dereferencing NULL pointer 'BodySetup'. Change 3097764 on 2016/08/23 by Steve.Robb Spurious static analysis fix: warning C28182: Dereferencing NULL pointer. 'FoundMode' contains the same NULL value as 'ElementType * FoundMode=LoopModes.FindByPredicate(<lambda>)' did. Change 3097770 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Triangle'. Change 3097775 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'CurGroup'. Change 3097796 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'SourceComponent'. Change 3097797 on 2016/08/23 by Steve.Robb Spurious static analysis fix: warning C6011: Dereferencing NULL pointer 'HitComponent'. Change 3097843 on 2016/08/23 by Steve.Robb Spurious static analysis fix: Dereferencing NULL pointer. 'MatchingNewPin' contains the same NULL value as 'UEdGraphPin ** MatchingNewPin=this->Pins.FindByPredicate(<lambda>)' did. Change 3097864 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'ObjectClass'. warning C6011: Dereferencing NULL pointer 'Client'. Change 3097871 on 2016/08/23 by Steve.Robb Static analysis fix: warning C28182: Dereferencing NULL pointer. 'SMLightingMesh->StaticMesh' contains the same NULL value as 'StaticMesh' did. Change 3098015 on 2016/08/23 by Steve.Robb Alternative fix for CL# 3094864. Change 3098024 on 2016/08/23 by Steve.Robb Alternative fix for CL# 3094943. Change 3098052 on 2016/08/23 by Steve.Robb Alternative fix for CL# 3094886. Change 3098080 on 2016/08/23 by Steve.Robb Static analysis fix: warning C28182: Dereferencing NULL pointer. 'PrimitiveComponent' contains the same NULL value as 'ReplacementComponent' did. Change 3098102 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'IndexTermPtr'. Change 3098148 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'Node'. warning C6011: Dereferencing NULL pointer 'OldNode'. warning C6011: Dereferencing NULL pointer 'LinkedPin'. warning C6011: Dereferencing NULL pointer 'RootNode'. Change 3098156 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'BTGraphNode'. Change 3098176 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'NewSection'. Change 3098182 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Sprite'. Change 3098197 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'Node'. Coding standards fixes. Change 3098202 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'ExistingEventNode'. Change 3098208 on 2016/08/23 by Steve.Robb Static analysis fixes: warning C28182: Dereferencing NULL pointer. 'Graph' contains the same NULL value as 'GraphNew' did. warning C28182: Dereferencing NULL pointer. 'GoodGraph' contains the same NULL value as 'GraphNew' did. Change 3098229 on 2016/08/23 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Property'. Change 3099188 on 2016/08/24 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'SharedBaseClass'. Change 3099195 on 2016/08/24 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'NodeProperty'. Change 3099205 on 2016/08/24 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'VarDesc'. Change 3099228 on 2016/08/24 by Steve.Robb Spurious static analysis fix: warning C28182: Dereferencing NULL pointer. 'Node' contains the same NULL value as 'ParentNode' did. Change 3099539 on 2016/08/24 by Steve.Robb Spurious static analysis fixes: warning C6011: Dereferencing NULL pointer 'InBlueprint'. warning C28182: Dereferencing NULL pointer. 'TestObj' contains the same NULL value as 'TestOuter' did. https://connect.microsoft.com/VisualStudio/feedback/details/3082362 https://connect.microsoft.com/VisualStudio/feedback/details/3082622 Change 3099546 on 2016/08/24 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'OldNode'. Change 3099561 on 2016/08/24 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'ReferencedObject'. Change 3099571 on 2016/08/24 by Steve.Robb Static analysis fix: Dereferencing NULL pointer. 'ObjClass' contains the same NULL value as 'CommonBaseClass' did. Change 3099600 on 2016/08/24 by Steve.Robb Static analysis fix: warning C6385: Reading invalid data from 'this->Packages': the readable size is '24' bytes, but '32' bytes may be read. warning C6385: Reading invalid data from 'Diff.ObjectSets': the readable size is '24' bytes, but '32' bytes may be read. warning C6386: Buffer overrun while writing to 'Objects': the writable size is '24' bytes, but '32' bytes might be written. Change 3099912 on 2016/08/24 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'SharedBaseClass'. Change 3099923 on 2016/08/24 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'ThumbnailInfo'. Change 3100977 on 2016/08/25 by Steve.Robb Static analysis fixes: warning C6001: Using uninitialized memory '*VectorRef'. warning C6001: Using uninitialized memory '*PointRef'. warning C6001: Using uninitialized memory '*PolyRef'. Coding standard fixes. Change 3100985 on 2016/08/25 by Steve.Robb Static analyis fix: warning C6011: Dereferencing NULL pointer 'SpawnClassPin'. Change 3100987 on 2016/08/25 by Steve.Robb Static analysis fixes: warning C28183: 'Resources.BitmapHandle' could be '0', and is a copy of the value found in 'CreateDIBSection()`829': this does not adhere to the specification for the function 'SelectObject'. warning C6387: '_Param_(4)' could be '0': this does not adhere to the specification for the function 'CreateDIBSection'. Change 3100992 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6287: Redundant code: the left and right sub-expressions are identical. Change 3101000 on 2016/08/25 by Steve.Robb Static analysis fixes: warning C6001: Using uninitialized memory 'tmpMemReq'. warning C6001: Using uninitialized memory 'TmpCreateInfo'. Change 3101004 on 2016/08/25 by Steve.Robb warning C28182: Dereferencing NULL pointer. 'FoliageActor' contains the same NULL value as 'Actor' did. Change 3101009 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'StaticMeshComponent'. Change 3101115 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Canvas'. Change 3101120 on 2016/08/25 by Steve.Robb Fixes to previous fixes. Change 3101128 on 2016/08/25 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'Stream'. Change 3101281 on 2016/08/25 by Steve.Robb Static analysis fixes: warning C6262: Function uses '99256' bytes of stack: exceeds /analyze:stacksize '81940'. Consider moving some data to heap. warning C6001: Using uninitialized memory 'Pixel'. Change 3101292 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'BulkDataPointer'. Change 3101299 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'UnrealMaterial'. Change 3101300 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'AssetObject'. Change 3101304 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'MeshRootNode'. Change 3101311 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Cluster'. Change3101323on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'StartNode'. Change 3101329 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Object'. Change 3101333 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'ArrayRef'. Change 3101339 on 2016/08/25 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'ImportData'. warning C6011: Dereferencing NULL pointer 'CurveToImport'. Change 3101485 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'ObjectProperty'. Change 3101583 on 2016/08/25 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'UserDefinedStruct'. Change 3105721 on 2016/08/30 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'SpawnClassPin'. Change 3105724 on 2016/08/30 by Steven.Hutton Change users page to more responsive paginated version. Change 3105725 on 2016/08/30 by Steven.Hutton Added field for crash processor failed Change 3105786 on 2016/08/30 by Steve.Robb Reintroduced missing operator<< for enum classes. Change 3105803 on 2016/08/30 by Steve.Robb Removal of obsolete code and state. PrepareCppStructOps() has several unreachable blocks, one of which sets UScriptStruct::bCppStructOpsFromBaseClass which is otherwise never true, so it can be removed too. Change 3106251 on 2016/08/30 by Steve.Robb Switch static analysis node to build editor instead of just the engine. Change 3107556 on 2016/08/31 by Steven.Hutton Added build version data from CRP to DB as part of add crash #rb none Change 3107557 on 2016/08/31 by Steven.Hutton Passed build version data to CRW through crash description #rb none Change 3107634 on 2016/08/31 by Graeme.Thornton Only accept "log=<filename>" and "abslog=<filename>" command line values if the filename has a "log" or "txt" extension #jira UE-20147 Change 3107797 on 2016/08/31 by Steve.Robb Fix for UHT debugging manifest, after paths changed in CL# 3088416. Change 3107964 on 2016/08/31 by Steve.Robb TCString::Strfind renamed to TCString::Strifind, as it is case-insensitive. New case-sensitive TCString::Strfind added, based on GitHub PR #2453. Change 3108023 on 2016/08/31 by Steve.Robb Removal of test code which no longer compiles now that we emit errors on skipped preprocessor blocks. Change 3108160 on 2016/08/31 by Steven.Hutton Update to add new filter to website front page #rb none Change 3109556 on 2016/09/01 by Steven.Hutton Fixing compile warning #rb none Change 3110001 on 2016/09/01 by Steve.Robb PR #2468: Fix for UnrealHeaderTool TArray<TScriptInterface<>> UFUNCTION parameters (Contributed by UnrealEverything) Change 3111835 on 2016/09/02 by Steve.Robb Enforce uint8 on UENUM() enum classes. #jira UE-35224 Change 3111867 on 2016/09/02 by Steve.Robb Static analysis fix: warning C6236: (<expression> || <non-zero constant>) is always a non-zero constant. Change 3111880 on 2016/09/02 by Steve.Robb Static analysis fixes: warning C6386: Buffer overrun while writing to 'Views': the writable size is 'ShaderBindings.ResourceViews.public: int __cdecl TArray<class TSlateD3DTypedShaderParameter<struct ID3D11ShaderResourceView> *,class FDefaultAllocator>::Num(void)const ()*8' bytes, but '16' bytes might be written. warning C6386: Buffer overrun while writing to 'ConstantBuffers': the writable size is 'ShaderBindings.ConstantBuffers.public: int __cdecl TArray<class TSlateD3DTypedShaderParameter<struct ID3D11Buffer> *,class FDefaultAllocator>::Num(void)const ()*8' bytes, but '16' bytes might be written. Change 3111886 on 2016/09/02 by Steve.Robb Static analysis fix: warning C6386: Buffer overrun while writing to 'DistortionMeshIndices': the writable size is 'NumIndices*2' bytes, but '4' bytes might be written. Change 3112025 on 2016/09/02 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'pInputProcessParameters'. warning C6011: Dereferencing NULL pointer 'pOutputProcessParameters'. Change 3112051 on 2016/09/02 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Command'. Change 3112066 on 2016/09/02 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'CurNetDriver'. Change 3112093 on 2016/09/02 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'byteArray'. Change 3112110 on 2016/09/02 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'PersistentParty'. Change 3112123 on 2016/09/02 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'CurDriver'. warning C6011: Dereferencing NULL pointer 'CurNetDriver'. warning C6011: Dereferencing NULL pointer 'CurWorld'. Change 3112157 on 2016/09/02 by Steve.Robb Static analysis fixes: warning C6011: Dereferencing NULL pointer 'UnitTest'. Change 3112283 on 2016/09/02 by Steve.Robb Static analysis fixes: warning C6244: Local declaration of 'None' hides previous declaration at line '173' of 'netcodeunittest.h'. Change 3113455 on 2016/09/05 by Chris.Wood CRP performance improvements (v1.1.25) Change 3113468 on 2016/09/05 by Steve.Robb Reverting unnecessary merge in CL# 3112464. Change 3113508 on 2016/09/05 by Steve.Robb Static analysis fix: warning C6031: Return value ignored: 'CoCreateGuid'. Change 3113588 on 2016/09/05 by Steve.Robb Static analysis fix: warning C6244: Local declaration of 'hInstance' hides previous declaration Change 3113863 on 2016/09/06 by Steve.Robb Fix for this error: Could not find a part of the path 'D:\Build\++UE4+Dev-Core+Compile\Sync\Engine\Plugins\2D\Paper2D\Binaries\Win64\UE4Editor.modules'. Change 3113864 on 2016/09/06 by Steve.Robb Misc static analysis fixes for VS2015 Update 2. Change 3113918 on 2016/09/06 by Ben.Marsh Explicitly check for version manifest existing before trying to delete it, rather than swallowing the exception. Change3114293on 2016/09/06 by Steve.Robb Static analysis fixes for Visual Studio Update 2. Change 3115732 on 2016/09/07 by Steve.Robb Static analysis fix: warning C6262: Function uses '121180' bytes of stack: exceeds /analyze:stacksize '81940'. Consider moving some data to heap. Change 3115754 on 2016/09/07 by Steve.Robb GObjectArrayForDebugVisualizers init order fix. Removal of obsolete FName visualizer helper code. Change 3115774 on 2016/09/07 by Steve.Robb Fix for ICE by moving static variables into their own file and removing const return types. #jira UE-35597 Change 3116061 on 2016/09/07 by Steve.Robb Redundant LOCTEXT_NAMESPACE removed - was missed in CL# 3115774. Change 3117478 on 2016/09/08 by Steve.Robb Static analysis fixes in third party code, using a new macro-based system. Change 3119152 on 2016/09/09 by Steve.Robb TArray::RemoveAt and RemoveAtSwap with a bool Count is now a compile error. Change 3119200 on 2016/09/09 by Steve.Robb Fix for destructors not being called in TSparseArray move assignment. Change 3119568 on 2016/09/09 by Steve.Robb Fix for TSparseArray visualizer. Change 3119591 on 2016/09/09 by Steve.Robb New MakeShared function which allocates the object and reference controller in a single block. Change 3120281 on 2016/09/09 by Steve.Robb Fix for ICE on static analysis build. #jira UE-35596 Change 3120786 on 2016/09/12 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'SavedGame'. Change 3120787 on 2016/09/12 by Steve.Robb Removal of TEnumAsByte on enum classes. Change 3120789 on 2016/09/12 by Steve.Robb Static analysis fixes: warning C6385: Reading invalid data from 'D3D11X_CERAM_OFFSET_BY_SET_STAGE': the readable size is '28' bytes, but '64' bytes may be read. warning C6101: Returning uninitialized memory '*pDescriptorDst'. A successful path through the function does not set the named _Out_ parameter. Change 3121234 on 2016/09/12 by Steve.Robb Unused ToBuildInfoString function declaration removed. Change 3122616 on 2016/09/13 by Steve.Robb Static analysis fix: warning C6011: Dereferencing NULL pointer 'Compiler'. Change 3123070 on 2016/09/13 by Steve.Robb Static analysis fix: warning C28182: Dereferencing NULL pointer. 'top' contains the same NULL value as 'edge' did. [CL 3126145 by Robert Manuszewski in Main branch]
940 lines
30 KiB
C++
940 lines
30 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
// ShaderCompileWorker.cpp : Defines the entry point for the console application.
|
|
//
|
|
|
|
#include "Core.h"
|
|
#include "RequiredProgramMainCPPInclude.h"
|
|
#include "ShaderCore.h"
|
|
#include "ExceptionHandling.h"
|
|
#include "IShaderFormat.h"
|
|
#include "IShaderFormatModule.h"
|
|
|
|
#define DEBUG_USING_CONSOLE 0
|
|
|
|
// this is for the protocol, not the data, bump if FShaderCompilerInput or ProcessInputFromArchive changes (also search for the second one with the same name, todo: put into one header file)
|
|
const int32 ShaderCompileWorkerInputVersion = 7;
|
|
// this is for the protocol, not the data, bump if FShaderCompilerOutput or WriteToOutputArchive changes (also search for the second one with the same name, todo: put into one header file)
|
|
const int32 ShaderCompileWorkerOutputVersion = 3;
|
|
// this is for the protocol, not the data, bump if FShaderCompilerOutput or WriteToOutputArchive changes (also search for the second one with the same name, todo: put into one header file)
|
|
const int32 ShaderCompileWorkerSingleJobHeader = 'S';
|
|
// this is for the protocol, not the data, bump if FShaderCompilerOutput or WriteToOutputArchive changes (also search for the second one with the same name, todo: put into one header file)
|
|
const int32 ShaderCompileWorkerPipelineJobHeader = 'P';
|
|
|
|
enum class ESCWErrorCode
|
|
{
|
|
Success,
|
|
GeneralCrash,
|
|
BadShaderFormatVersion,
|
|
BadInputVersion,
|
|
BadSingleJobHeader,
|
|
BadPipelineJobHeader,
|
|
CantDeleteInputFile,
|
|
CantSaveOutputFile,
|
|
NoTargetShaderFormatsFound,
|
|
CantCompileForSpecificFormat,
|
|
};
|
|
|
|
double LastCompileTime = 0.0;
|
|
|
|
static bool GShaderCompileUseXGE = false;
|
|
static ESCWErrorCode GFailedErrorCode = ESCWErrorCode::Success;
|
|
|
|
static void WriteXGESuccessFile(const TCHAR* WorkingDirectory)
|
|
{
|
|
// To signal compilation completion, create a zero length file in the working directory.
|
|
delete IFileManager::Get().CreateFileWriter(*FString::Printf(TEXT("%s/Success"), WorkingDirectory), FILEWRITE_EvenIfReadOnly);
|
|
}
|
|
|
|
#if USING_CODE_ANALYSIS
|
|
FUNCTION_NO_RETURN_START static inline void ExitWithoutCrash(ESCWErrorCode ErrorCode, const FString& Message) FUNCTION_NO_RETURN_END;
|
|
#endif
|
|
|
|
static inline void ExitWithoutCrash(ESCWErrorCode ErrorCode, const FString& Message)
|
|
{
|
|
GFailedErrorCode = ErrorCode;
|
|
FCString::Snprintf(GErrorExceptionDescription, sizeof(GErrorExceptionDescription), TEXT("%s"), *Message);
|
|
UE_LOG(LogShaders, Fatal, TEXT("%s"), *Message);
|
|
}
|
|
|
|
static const TArray<const IShaderFormat*>& GetShaderFormats()
|
|
{
|
|
static bool bInitialized = false;
|
|
static TArray<const IShaderFormat*> Results;
|
|
|
|
if (!bInitialized)
|
|
{
|
|
bInitialized = true;
|
|
Results.Empty(Results.Num());
|
|
|
|
TArray<FName> Modules;
|
|
FModuleManager::Get().FindModules(SHADERFORMAT_MODULE_WILDCARD, Modules);
|
|
|
|
if (!Modules.Num())
|
|
{
|
|
ExitWithoutCrash(ESCWErrorCode::NoTargetShaderFormatsFound, TEXT("No target shader formats found!"));
|
|
}
|
|
|
|
for (int32 Index = 0; Index < Modules.Num(); Index++)
|
|
{
|
|
IShaderFormat* Format = FModuleManager::LoadModuleChecked<IShaderFormatModule>(Modules[Index]).GetShaderFormat();
|
|
if (Format != nullptr)
|
|
{
|
|
Results.Add(Format);
|
|
}
|
|
}
|
|
}
|
|
return Results;
|
|
}
|
|
|
|
static const IShaderFormat* FindShaderFormat(FName Name)
|
|
{
|
|
const TArray<const IShaderFormat*>& ShaderFormats = GetShaderFormats();
|
|
|
|
for (int32 Index = 0; Index < ShaderFormats.Num(); Index++)
|
|
{
|
|
TArray<FName> Formats;
|
|
ShaderFormats[Index]->GetSupportedFormats(Formats);
|
|
for (int32 FormatIndex = 0; FormatIndex < Formats.Num(); FormatIndex++)
|
|
{
|
|
if (Formats[FormatIndex] == Name)
|
|
{
|
|
return ShaderFormats[Index];
|
|
}
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
/** Processes a compilation job. */
|
|
static void ProcessCompilationJob(const FShaderCompilerInput& Input,FShaderCompilerOutput& Output,const FString& WorkingDirectory)
|
|
{
|
|
const IShaderFormat* Compiler = FindShaderFormat(Input.ShaderFormat);
|
|
if (!Compiler)
|
|
{
|
|
ExitWithoutCrash(ESCWErrorCode::CantCompileForSpecificFormat, FString::Printf(TEXT("Can't compile shaders for format %s"), *Input.ShaderFormat.ToString()));
|
|
}
|
|
|
|
// Compile the shader directly through the platform dll (directly from the shader dir as the working directory)
|
|
Compiler->CompileShader(Input.ShaderFormat, Input, Output, WorkingDirectory);
|
|
}
|
|
|
|
|
|
class FWorkLoop
|
|
{
|
|
public:
|
|
FWorkLoop(const TCHAR* ParentProcessIdText,const TCHAR* InWorkingDirectory,const TCHAR* InInputFilename,const TCHAR* InOutputFilename, TMap<FString, uint16>& InFormatVersionMap)
|
|
: ParentProcessId(FCString::Atoi(ParentProcessIdText))
|
|
, WorkingDirectory(InWorkingDirectory)
|
|
, InputFilename(InInputFilename)
|
|
, OutputFilename(InOutputFilename)
|
|
, InputFilePath(FString(InWorkingDirectory) + InInputFilename)
|
|
, OutputFilePath(FString(InWorkingDirectory) + InOutputFilename)
|
|
, FormatVersionMap(InFormatVersionMap)
|
|
{
|
|
}
|
|
|
|
void Loop()
|
|
{
|
|
UE_LOG(LogShaders, Log, TEXT("Entering job loop"));
|
|
|
|
while(true)
|
|
{
|
|
TArray<FJobResult> SingleJobResults;
|
|
TArray<FPipelineJobResult> PipelineJobResults;
|
|
|
|
// Read & Process Input
|
|
{
|
|
FArchive* InputFilePtr = OpenInputFile();
|
|
if(!InputFilePtr)
|
|
{
|
|
break;
|
|
}
|
|
|
|
UE_LOG(LogShaders, Log, TEXT("Processing shader"));
|
|
|
|
ProcessInputFromArchive(InputFilePtr, SingleJobResults, PipelineJobResults);
|
|
|
|
LastCompileTime = FPlatformTime::Seconds();
|
|
|
|
// Close the input file.
|
|
delete InputFilePtr;
|
|
}
|
|
|
|
// Prepare for output
|
|
FArchive* OutputFilePtr = CreateOutputArchive();
|
|
check(OutputFilePtr);
|
|
WriteToOutputArchive(OutputFilePtr, SingleJobResults, PipelineJobResults);
|
|
|
|
// Close the output file.
|
|
delete OutputFilePtr;
|
|
|
|
// Change the output file name to requested one
|
|
IFileManager::Get().Move(*OutputFilePath, *TempFilePath);
|
|
|
|
if (GShaderCompileUseXGE)
|
|
{
|
|
// To signal compilation completion, create a zero length file in the working directory.
|
|
WriteXGESuccessFile(*WorkingDirectory);
|
|
|
|
// We only do one pass per process when using XGE.
|
|
break;
|
|
}
|
|
}
|
|
|
|
UE_LOG(LogShaders, Log, TEXT("Exiting job loop"));
|
|
}
|
|
|
|
private:
|
|
struct FJobResult
|
|
{
|
|
FShaderCompilerOutput CompilerOutput;
|
|
};
|
|
|
|
struct FPipelineJobResult
|
|
{
|
|
FString PipelineName;
|
|
TArray<FJobResult> SingleJobs;
|
|
};
|
|
|
|
const int32 ParentProcessId;
|
|
const FString WorkingDirectory;
|
|
const FString InputFilename;
|
|
const FString OutputFilename;
|
|
|
|
const FString InputFilePath;
|
|
const FString OutputFilePath;
|
|
TMap<FString, uint16> FormatVersionMap;
|
|
FString TempFilePath;
|
|
|
|
/** Opens an input file, trying multiple times if necessary. */
|
|
FArchive* OpenInputFile()
|
|
{
|
|
FArchive* InputFile = nullptr;
|
|
bool bFirstOpenTry = true;
|
|
while(!InputFile && !GIsRequestingExit)
|
|
{
|
|
// Try to open the input file that we are going to process
|
|
InputFile = IFileManager::Get().CreateFileReader(*InputFilePath,FILEREAD_Silent);
|
|
|
|
if(!InputFile && !bFirstOpenTry)
|
|
{
|
|
CheckExitConditions();
|
|
// Give up CPU time while we are waiting
|
|
FPlatformProcess::Sleep(0.01f);
|
|
}
|
|
bFirstOpenTry = false;
|
|
}
|
|
return InputFile;
|
|
}
|
|
|
|
void VerifyFormatVersions(TMap<FString, uint16>& ReceivedFormatVersionMap)
|
|
{
|
|
for (auto Pair : ReceivedFormatVersionMap)
|
|
{
|
|
auto* Found = FormatVersionMap.Find(Pair.Key);
|
|
if (Found)
|
|
{
|
|
if (Pair.Value != *Found)
|
|
{
|
|
ExitWithoutCrash(ESCWErrorCode::BadShaderFormatVersion, FString::Printf(TEXT("Mismatched shader version for format %s; did you forget to build ShaderCompilerWorker?"), *Pair.Key, *Found, Pair.Value));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void ProcessInputFromArchive(FArchive* InputFilePtr, TArray<FJobResult>& OutSingleJobResults, TArray<FPipelineJobResult>& OutPipelineJobResults)
|
|
{
|
|
FArchive& InputFile = *InputFilePtr;
|
|
int32 InputVersion;
|
|
InputFile << InputVersion;
|
|
if (ShaderCompileWorkerInputVersion != InputVersion)
|
|
{
|
|
ExitWithoutCrash(ESCWErrorCode::BadInputVersion, FString::Printf(TEXT("Exiting due to ShaderCompilerWorker expecting input version %d, got %d instead! Did you forget to build ShaderCompilerWorker?"), ShaderCompileWorkerInputVersion, InputVersion));
|
|
}
|
|
|
|
TMap<FString, uint16> ReceivedFormatVersionMap;
|
|
InputFile << ReceivedFormatVersionMap;
|
|
|
|
VerifyFormatVersions(ReceivedFormatVersionMap);
|
|
|
|
// Individual jobs
|
|
{
|
|
int32 SingleJobHeader = ShaderCompileWorkerSingleJobHeader;
|
|
InputFile << SingleJobHeader;
|
|
if (ShaderCompileWorkerSingleJobHeader != SingleJobHeader)
|
|
{
|
|
ExitWithoutCrash(ESCWErrorCode::BadSingleJobHeader, FString::Printf(TEXT("Exiting due to ShaderCompilerWorker expecting job header %d, got %d instead! Did you forget to build ShaderCompilerWorker?"), ShaderCompileWorkerSingleJobHeader, SingleJobHeader));
|
|
}
|
|
|
|
int32 NumBatches = 0;
|
|
InputFile << NumBatches;
|
|
|
|
// Flush cache, to make sure we load the latest version of the input file.
|
|
// (Otherwise quick changes to a shader file can result in the wrong output.)
|
|
FlushShaderFileCache();
|
|
|
|
for (int32 BatchIndex = 0; BatchIndex < NumBatches; BatchIndex++)
|
|
{
|
|
// Deserialize the job's inputs.
|
|
FShaderCompilerInput CompilerInput;
|
|
InputFile << CompilerInput;
|
|
|
|
if (IsValidRef(CompilerInput.SharedEnvironment))
|
|
{
|
|
// Merge the shared environment into the per-shader environment before calling into the compile function
|
|
CompilerInput.Environment.Merge(*CompilerInput.SharedEnvironment);
|
|
}
|
|
|
|
// Process the job.
|
|
FShaderCompilerOutput CompilerOutput;
|
|
ProcessCompilationJob(CompilerInput, CompilerOutput, WorkingDirectory);
|
|
|
|
// Serialize the job's output.
|
|
FJobResult& JobResult = *new(OutSingleJobResults) FJobResult;
|
|
JobResult.CompilerOutput = CompilerOutput;
|
|
}
|
|
}
|
|
|
|
// Shader pipeline jobs
|
|
{
|
|
int32 PipelineJobHeader = ShaderCompileWorkerPipelineJobHeader;
|
|
InputFile << PipelineJobHeader;
|
|
if (ShaderCompileWorkerPipelineJobHeader != PipelineJobHeader)
|
|
{
|
|
ExitWithoutCrash(ESCWErrorCode::BadPipelineJobHeader, FString::Printf(TEXT("Exiting due to ShaderCompilerWorker expecting pipeline job header %d, got %d instead! Did you forget to build ShaderCompilerWorker?"), ShaderCompileWorkerSingleJobHeader, PipelineJobHeader));
|
|
}
|
|
|
|
int32 NumPipelines = 0;
|
|
InputFile << NumPipelines;
|
|
|
|
for (int32 Index = 0; Index < NumPipelines; ++Index)
|
|
{
|
|
FPipelineJobResult& PipelineJob = *new(OutPipelineJobResults) FPipelineJobResult;
|
|
|
|
InputFile << PipelineJob.PipelineName;
|
|
|
|
int32 NumStages = 0;
|
|
InputFile << NumStages;
|
|
|
|
TArray<FShaderCompilerInput> CompilerInputs;
|
|
CompilerInputs.AddDefaulted(NumStages);
|
|
|
|
for (int32 StageIndex = 0; StageIndex < NumStages; ++StageIndex)
|
|
{
|
|
// Deserialize the job's inputs.
|
|
InputFile << CompilerInputs[StageIndex];
|
|
|
|
if (IsValidRef(CompilerInputs[StageIndex].SharedEnvironment))
|
|
{
|
|
// Merge the shared environment into the per-shader environment before calling into the compile function
|
|
CompilerInputs[StageIndex].Environment.Merge(*CompilerInputs[StageIndex].SharedEnvironment);
|
|
}
|
|
}
|
|
|
|
ProcessShaderPipelineCompilationJob(PipelineJob, CompilerInputs);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ProcessShaderPipelineCompilationJob(FPipelineJobResult& PipelineJob, TArray<FShaderCompilerInput>& CompilerInputs)
|
|
{
|
|
checkf(CompilerInputs.Num() > 0, TEXT("Exiting due to Pipeline %s having zero jobs!"), *PipelineJob.PipelineName);
|
|
|
|
// Process the job.
|
|
FShaderCompilerOutput FirstCompilerOutput;
|
|
CompilerInputs[0].bCompilingForShaderPipeline = true;
|
|
CompilerInputs[0].bIncludeUsedOutputs = false;
|
|
ProcessCompilationJob(CompilerInputs[0], FirstCompilerOutput, WorkingDirectory);
|
|
|
|
// Serialize the job's output.
|
|
{
|
|
FJobResult& JobResult = *new(PipelineJob.SingleJobs) FJobResult;
|
|
JobResult.CompilerOutput = FirstCompilerOutput;
|
|
}
|
|
|
|
bool bEnableRemovingUnused = true;
|
|
|
|
//#todo-rco: Only remove for pure VS & PS stages
|
|
for (int32 Index = 0; Index < CompilerInputs.Num(); ++Index)
|
|
{
|
|
auto Stage = CompilerInputs[Index].Target.Frequency;
|
|
if (Stage != SF_Vertex && Stage != SF_Pixel)
|
|
{
|
|
bEnableRemovingUnused = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
for (int32 Index = 1; Index < CompilerInputs.Num(); ++Index)
|
|
{
|
|
if (bEnableRemovingUnused && PipelineJob.SingleJobs.Last().CompilerOutput.bSupportsQueryingUsedAttributes)
|
|
{
|
|
CompilerInputs[Index].bIncludeUsedOutputs = true;
|
|
CompilerInputs[Index].bCompilingForShaderPipeline = true;
|
|
CompilerInputs[Index].UsedOutputs = PipelineJob.SingleJobs.Last().CompilerOutput.UsedAttributes;
|
|
}
|
|
|
|
FShaderCompilerOutput CompilerOutput;
|
|
ProcessCompilationJob(CompilerInputs[Index], CompilerOutput, WorkingDirectory);
|
|
|
|
// Serialize the job's output.
|
|
FJobResult& JobResult = *new(PipelineJob.SingleJobs) FJobResult;
|
|
JobResult.CompilerOutput = CompilerOutput;
|
|
}
|
|
}
|
|
|
|
FArchive* CreateOutputArchive()
|
|
{
|
|
FArchive* OutputFilePtr = nullptr;
|
|
const double StartTime = FPlatformTime::Seconds();
|
|
bool bResult = false;
|
|
|
|
// It seems XGE does not support deleting files.
|
|
// Don't delete the input file if we are running under Incredibuild.
|
|
// Instead, we signal completion by creating a zero byte "Success" file after the output file has been fully written.
|
|
if (!GShaderCompileUseXGE)
|
|
{
|
|
do
|
|
{
|
|
// Remove the input file so that it won't get processed more than once
|
|
bResult = IFileManager::Get().Delete(*InputFilePath);
|
|
}
|
|
while (!bResult && (FPlatformTime::Seconds() - StartTime < 2));
|
|
|
|
if (!bResult)
|
|
{
|
|
ExitWithoutCrash(ESCWErrorCode::CantDeleteInputFile, FString::Printf(TEXT("Couldn't delete input file %s, is it readonly?"), *InputFilePath));
|
|
}
|
|
}
|
|
|
|
// To make sure that the process waiting for results won't read unfinished output file,
|
|
// we use a temp file name during compilation.
|
|
do
|
|
{
|
|
FGuid Guid;
|
|
FPlatformMisc::CreateGuid(Guid);
|
|
TempFilePath = WorkingDirectory + Guid.ToString();
|
|
} while (IFileManager::Get().FileSize(*TempFilePath) != INDEX_NONE);
|
|
|
|
const double StartTime2 = FPlatformTime::Seconds();
|
|
|
|
do
|
|
{
|
|
// Create the output file.
|
|
OutputFilePtr = IFileManager::Get().CreateFileWriter(*TempFilePath,FILEWRITE_EvenIfReadOnly);
|
|
}
|
|
while (!OutputFilePtr && (FPlatformTime::Seconds() - StartTime2 < 2));
|
|
|
|
if (!OutputFilePtr)
|
|
{
|
|
ExitWithoutCrash(ESCWErrorCode::CantSaveOutputFile, FString::Printf(TEXT("Couldn't save output file %s"), *TempFilePath));
|
|
}
|
|
|
|
return OutputFilePtr;
|
|
}
|
|
|
|
void WriteToOutputArchive(FArchive* OutputFilePtr, TArray<FJobResult>& SingleJobResults, TArray<FPipelineJobResult>& PipelineJobResults)
|
|
{
|
|
FArchive& OutputFile = *OutputFilePtr;
|
|
|
|
int32 OutputVersion = ShaderCompileWorkerOutputVersion;
|
|
OutputFile << OutputVersion;
|
|
|
|
int32 ErrorCode = (int32)ESCWErrorCode::Success;
|
|
OutputFile << ErrorCode;
|
|
|
|
int32 ErrorStringLength = 0;
|
|
OutputFile << ErrorStringLength;
|
|
OutputFile << ErrorStringLength;
|
|
|
|
{
|
|
int32 SingleJobHeader = ShaderCompileWorkerSingleJobHeader;
|
|
OutputFile << SingleJobHeader;
|
|
|
|
int32 NumBatches = SingleJobResults.Num();
|
|
OutputFile << NumBatches;
|
|
|
|
for (int32 ResultIndex = 0; ResultIndex < SingleJobResults.Num(); ResultIndex++)
|
|
{
|
|
FJobResult& JobResult = SingleJobResults[ResultIndex];
|
|
OutputFile << JobResult.CompilerOutput;
|
|
}
|
|
}
|
|
|
|
{
|
|
int32 PipelineJobHeader = ShaderCompileWorkerPipelineJobHeader;
|
|
OutputFile << PipelineJobHeader;
|
|
int32 NumBatches = PipelineJobResults.Num();
|
|
OutputFile << NumBatches;
|
|
|
|
for (int32 ResultIndex = 0; ResultIndex < PipelineJobResults.Num(); ResultIndex++)
|
|
{
|
|
auto& PipelineJob = PipelineJobResults[ResultIndex];
|
|
OutputFile << PipelineJob.PipelineName;
|
|
int32 NumStageJobs = PipelineJob.SingleJobs.Num();
|
|
OutputFile << NumStageJobs;
|
|
for (int32 Index = 0; Index < NumStageJobs; ++Index)
|
|
{
|
|
FJobResult& JobResult = PipelineJob.SingleJobs[Index];
|
|
OutputFile << JobResult.CompilerOutput;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/** Called in the idle loop, checks for conditions under which the helper should exit */
|
|
void CheckExitConditions()
|
|
{
|
|
if (!InputFilename.Contains(TEXT("Only")))
|
|
{
|
|
UE_LOG(LogShaders, Log, TEXT("InputFilename did not contain 'Only', exiting after one job."));
|
|
FPlatformMisc::RequestExit(false);
|
|
}
|
|
|
|
#if PLATFORM_MAC || PLATFORM_LINUX
|
|
if (!FPlatformMisc::IsDebuggerPresent() && ParentProcessId > 0)
|
|
{
|
|
// If the parent process is no longer running, exit
|
|
if (!FPlatformProcess::IsApplicationRunning(ParentProcessId))
|
|
{
|
|
FString FilePath = FString(WorkingDirectory) + InputFilename;
|
|
checkf(IFileManager::Get().FileSize(*FilePath) == INDEX_NONE, TEXT("Exiting due to the parent process no longer running and the input file is present!"));
|
|
UE_LOG(LogShaders, Log, TEXT("Parent process no longer running, exiting"));
|
|
FPlatformMisc::RequestExit(false);
|
|
}
|
|
}
|
|
|
|
const double CurrentTime = FPlatformTime::Seconds();
|
|
// If we have been idle for 20 seconds then exit
|
|
if (CurrentTime - LastCompileTime > 20.0)
|
|
{
|
|
UE_LOG(LogShaders, Log, TEXT("No jobs found for 20 seconds, exiting"));
|
|
FPlatformMisc::RequestExit(false);
|
|
}
|
|
#else
|
|
// Don't do these if the debugger is present
|
|
//@todo - don't do these if Unreal is being debugged either
|
|
if (!IsDebuggerPresent())
|
|
{
|
|
if (ParentProcessId > 0)
|
|
{
|
|
FString FilePath = FString(WorkingDirectory) + InputFilename;
|
|
|
|
bool bParentStillRunning = true;
|
|
HANDLE ParentProcessHandle = OpenProcess(SYNCHRONIZE, false, ParentProcessId);
|
|
// If we couldn't open the process then it is no longer running, exit
|
|
if (ParentProcessHandle == nullptr)
|
|
{
|
|
checkf(IFileManager::Get().FileSize(*FilePath) == INDEX_NONE, TEXT("Exiting due to OpenProcess(ParentProcessId) failing and the input file is present!"));
|
|
UE_LOG(LogShaders, Log, TEXT("Couldn't OpenProcess, Parent process no longer running, exiting"));
|
|
FPlatformMisc::RequestExit(false);
|
|
}
|
|
else
|
|
{
|
|
// If we did open the process, that doesn't mean it is still running
|
|
// The process object stays alive as long as there are handles to it
|
|
// We need to check if the process has signaled, which indicates that it has exited
|
|
uint32 WaitResult = WaitForSingleObject(ParentProcessHandle, 0);
|
|
if (WaitResult != WAIT_TIMEOUT)
|
|
{
|
|
checkf(IFileManager::Get().FileSize(*FilePath) == INDEX_NONE, TEXT("Exiting due to WaitForSingleObject(ParentProcessHandle) signaling and the input file is present!"));
|
|
UE_LOG(LogShaders, Log, TEXT("WaitForSingleObject signaled, Parent process no longer running, exiting"));
|
|
FPlatformMisc::RequestExit(false);
|
|
}
|
|
CloseHandle(ParentProcessHandle);
|
|
}
|
|
}
|
|
|
|
const double CurrentTime = FPlatformTime::Seconds();
|
|
// If we have been idle for 20 seconds then exit
|
|
if (CurrentTime - LastCompileTime > 20.0)
|
|
{
|
|
UE_LOG(LogShaders, Log, TEXT("No jobs found for 20 seconds, exiting"));
|
|
FPlatformMisc::RequestExit(false);
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
};
|
|
|
|
static FName NAME_PCD3D_SM5(TEXT("PCD3D_SM5"));
|
|
static FName NAME_PCD3D_SM4(TEXT("PCD3D_SM4"));
|
|
static FName NAME_PCD3D_ES3_1(TEXT("PCD3D_ES31"));
|
|
static FName NAME_PCD3D_ES2(TEXT("PCD3D_ES2"));
|
|
static FName NAME_GLSL_150(TEXT("GLSL_150"));
|
|
static FName NAME_GLSL_150_MAC(TEXT("GLSL_150_MAC"));
|
|
static FName NAME_SF_PS4(TEXT("SF_PS4"));
|
|
static FName NAME_SF_XBOXONE(TEXT("SF_XBOXONE"));
|
|
static FName NAME_GLSL_430(TEXT("GLSL_430"));
|
|
static FName NAME_GLSL_150_ES2(TEXT("GLSL_150_ES2"));
|
|
static FName NAME_GLSL_150_ES2_NOUB(TEXT("GLSL_150_ES2_NOUB"));
|
|
static FName NAME_GLSL_150_ES31(TEXT("GLSL_150_ES31"));
|
|
static FName NAME_GLSL_ES2(TEXT("GLSL_ES2"));
|
|
static FName NAME_GLSL_ES2_WEBGL(TEXT("GLSL_ES2_WEBGL"));
|
|
static FName NAME_GLSL_ES2_IOS(TEXT("GLSL_ES2_IOS"));
|
|
static FName NAME_SF_METAL(TEXT("SF_METAL"));
|
|
static FName NAME_SF_METAL_MRT(TEXT("SF_METAL_MRT"));
|
|
static FName NAME_GLSL_310_ES_EXT(TEXT("GLSL_310_ES_EXT"));
|
|
static FName NAME_SF_METAL_SM5(TEXT("SF_METAL_SM5"));
|
|
static FName NAME_VULKAN_ES3_1_ANDROID(TEXT("SF_VULKAN_ES31_ANDROID"));
|
|
static FName NAME_VULKAN_ES3_1(TEXT("SF_VULKAN_ES31"));
|
|
static FName NAME_VULKAN_ES3_1_UB(TEXT("SF_VULKAN_ES31_UB"));
|
|
static FName NAME_VULKAN_SM4(TEXT("SF_VULKAN_SM4"));
|
|
static FName NAME_VULKAN_SM5(TEXT("SF_VULKAN_SM5"));
|
|
static FName NAME_SF_METAL_SM4(TEXT("SF_METAL_SM4"));
|
|
static FName NAME_SF_METAL_MACES3_1(TEXT("SF_METAL_MACES3_1"));
|
|
static FName NAME_GLSL_ES3_1_ANDROID(TEXT("GLSL_ES3_1_ANDROID"));
|
|
|
|
static EShaderPlatform FormatNameToEnum(FName ShaderFormat)
|
|
{
|
|
if (ShaderFormat == NAME_PCD3D_SM5) return SP_PCD3D_SM5;
|
|
if (ShaderFormat == NAME_PCD3D_SM4) return SP_PCD3D_SM4;
|
|
if (ShaderFormat == NAME_PCD3D_ES3_1) return SP_PCD3D_ES3_1;
|
|
if (ShaderFormat == NAME_PCD3D_ES2) return SP_PCD3D_ES2;
|
|
if (ShaderFormat == NAME_GLSL_150) return SP_OPENGL_SM4;
|
|
if (ShaderFormat == NAME_GLSL_150_MAC) return SP_OPENGL_SM4_MAC;
|
|
if (ShaderFormat == NAME_SF_PS4) return SP_PS4;
|
|
if (ShaderFormat == NAME_SF_XBOXONE) return SP_XBOXONE;
|
|
if (ShaderFormat == NAME_GLSL_430) return SP_OPENGL_SM5;
|
|
if (ShaderFormat == NAME_GLSL_150_ES2) return SP_OPENGL_PCES2;
|
|
if (ShaderFormat == NAME_GLSL_150_ES2_NOUB) return SP_OPENGL_PCES2;
|
|
if (ShaderFormat == NAME_GLSL_150_ES31) return SP_OPENGL_PCES3_1;
|
|
if (ShaderFormat == NAME_GLSL_ES2) return SP_OPENGL_ES2_ANDROID;
|
|
if (ShaderFormat == NAME_GLSL_ES2_WEBGL) return SP_OPENGL_ES2_WEBGL;
|
|
if (ShaderFormat == NAME_GLSL_ES2_IOS) return SP_OPENGL_ES2_IOS;
|
|
if (ShaderFormat == NAME_SF_METAL) return SP_METAL;
|
|
if (ShaderFormat == NAME_SF_METAL_MRT) return SP_METAL_MRT;
|
|
if (ShaderFormat == NAME_GLSL_310_ES_EXT) return SP_OPENGL_ES31_EXT;
|
|
if (ShaderFormat == NAME_SF_METAL_SM5) return SP_METAL_SM5;
|
|
if (ShaderFormat == NAME_VULKAN_SM4) return SP_VULKAN_SM4;
|
|
if (ShaderFormat == NAME_VULKAN_SM5) return SP_VULKAN_SM5;
|
|
if (ShaderFormat == NAME_VULKAN_ES3_1_ANDROID) return SP_VULKAN_ES3_1_ANDROID;
|
|
if (ShaderFormat == NAME_VULKAN_ES3_1) return SP_VULKAN_PCES3_1;
|
|
if (ShaderFormat == NAME_VULKAN_ES3_1_UB) return SP_VULKAN_PCES3_1;
|
|
if (ShaderFormat == NAME_SF_METAL_SM4) return SP_METAL_SM4;
|
|
if (ShaderFormat == NAME_SF_METAL_MACES3_1) return SP_METAL_MACES3_1;
|
|
if (ShaderFormat == NAME_GLSL_ES3_1_ANDROID) return SP_OPENGL_ES3_1_ANDROID;
|
|
return SP_NumPlatforms;
|
|
}
|
|
|
|
static void CompileDirect(const TArray<const class IShaderFormat*>& ShaderFormats)
|
|
{
|
|
// Find all the info required for compiling a single shader
|
|
TArray<FString> Tokens, Switches;
|
|
FCommandLine::Parse(FCommandLine::Get(), Tokens, Switches);
|
|
|
|
FString InputFile;
|
|
|
|
FName FormatName;
|
|
FString Entry = TEXT("Main");
|
|
bool bPipeline = false;
|
|
EShaderFrequency Frequency = SF_Pixel;
|
|
TArray<FString> UsedOutputs;
|
|
bool bIncludeUsedOutputs = false;
|
|
uint64 CFlags = 0;
|
|
for (const FString& Token : Tokens)
|
|
{
|
|
if (Switches.Contains(Token))
|
|
{
|
|
if (Token.StartsWith(TEXT("format=")))
|
|
{
|
|
FormatName = FName(*Token.RightChop(7));
|
|
}
|
|
else if (Token.StartsWith(TEXT("entry=")))
|
|
{
|
|
Entry = Token.RightChop(6);
|
|
}
|
|
else if (Token.StartsWith(TEXT("cflags=")))
|
|
{
|
|
CFlags = FCString::Atoi64(*Token.RightChop(7));
|
|
}
|
|
else if (!FCString::Strcmp(*Token, TEXT("ps")))
|
|
{
|
|
Frequency = SF_Pixel;
|
|
}
|
|
else if (!FCString::Strcmp(*Token, TEXT("vs")))
|
|
{
|
|
Frequency = SF_Vertex;
|
|
}
|
|
else if (!FCString::Strcmp(*Token, TEXT("hs")))
|
|
{
|
|
Frequency = SF_Hull;
|
|
}
|
|
else if (!FCString::Strcmp(*Token, TEXT("ds")))
|
|
{
|
|
Frequency = SF_Domain;
|
|
}
|
|
else if (!FCString::Strcmp(*Token, TEXT("gs")))
|
|
{
|
|
Frequency = SF_Geometry;
|
|
}
|
|
else if (!FCString::Strcmp(*Token, TEXT("cs")))
|
|
{
|
|
Frequency = SF_Compute;
|
|
}
|
|
else if (!FCString::Strcmp(*Token, TEXT("pipeline")))
|
|
{
|
|
bPipeline = true;
|
|
}
|
|
else if (Token.StartsWith(TEXT("usedoutputs=")))
|
|
{
|
|
FString Outputs = Token.RightChop(12);
|
|
bIncludeUsedOutputs = true;
|
|
FString LHS, RHS;
|
|
while (Outputs.Split(TEXT("+"), &LHS, &RHS))
|
|
{
|
|
Outputs = RHS;
|
|
UsedOutputs.Add(LHS);
|
|
}
|
|
UsedOutputs.Add(Outputs);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (InputFile.Len() == 0)
|
|
{
|
|
InputFile = Token;
|
|
}
|
|
}
|
|
}
|
|
|
|
FString Dir = FPlatformProcess::UserTempDir();
|
|
|
|
FShaderCompilerInput Input;
|
|
Input.EntryPointName = Entry;
|
|
Input.ShaderFormat = FormatName;
|
|
Input.SourceFilename = InputFile;
|
|
Input.Target.Platform = FormatNameToEnum(FormatName);
|
|
Input.Target.Frequency = Frequency;
|
|
Input.bSkipPreprocessedCache = true;
|
|
|
|
uint32 CFlag = 0;
|
|
while (CFlags != 0)
|
|
{
|
|
if ((CFlags & 1) != 0)
|
|
{
|
|
Input.Environment.CompilerFlags.Add(CFlag);
|
|
}
|
|
CFlags = (CFlags >> (uint64)1);
|
|
++CFlag;
|
|
}
|
|
|
|
Input.bCompilingForShaderPipeline = bPipeline;
|
|
Input.bIncludeUsedOutputs = bIncludeUsedOutputs;
|
|
Input.UsedOutputs = UsedOutputs;
|
|
|
|
FShaderCompilerOutput Output;
|
|
|
|
for (const IShaderFormat* Format : ShaderFormats)
|
|
{
|
|
TArray<FName> SupportedFormats;
|
|
Format->GetSupportedFormats(SupportedFormats);
|
|
for (FName SupportedName : SupportedFormats)
|
|
{
|
|
if (SupportedName == FormatName)
|
|
{
|
|
Format->CompileShader(FormatName, Input, Output, Dir);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
UE_LOG(LogShaders, Warning, TEXT("Unable to find shader compiler backend for format %s!"), *FormatName.ToString());
|
|
}
|
|
|
|
|
|
/**
|
|
* Main entrypoint, guarded by a try ... except.
|
|
* This expects 4 parameters:
|
|
* The image path and name
|
|
* The working directory path, which has to be unique to the instigating process and thread.
|
|
* The parent process Id
|
|
* The thread Id corresponding to this worker
|
|
*/
|
|
static int32 GuardedMain(int32 argc, TCHAR* argv[], bool bDirectMode)
|
|
{
|
|
GEngineLoop.PreInit(argc, argv, TEXT("-NOPACKAGECACHE -Multiprocess"));
|
|
#if DEBUG_USING_CONSOLE
|
|
GLogConsole->Show( true );
|
|
#endif
|
|
|
|
// We just enumerate the shader formats here for debugging.
|
|
const TArray<const class IShaderFormat*>& ShaderFormats = GetShaderFormats();
|
|
check(ShaderFormats.Num());
|
|
TMap<FString, uint16> FormatVersionMap;
|
|
for (int32 Index = 0; Index < ShaderFormats.Num(); Index++)
|
|
{
|
|
TArray<FName> OutFormats;
|
|
ShaderFormats[Index]->GetSupportedFormats(OutFormats);
|
|
check(OutFormats.Num());
|
|
for (int32 InnerIndex = 0; InnerIndex < OutFormats.Num(); InnerIndex++)
|
|
{
|
|
UE_LOG(LogShaders, Display, TEXT("Available Shader Format %s"), *OutFormats[InnerIndex].ToString());
|
|
uint16 Version = ShaderFormats[Index]->GetVersion(OutFormats[InnerIndex]);
|
|
FormatVersionMap.Add(OutFormats[InnerIndex].ToString(), Version);
|
|
}
|
|
}
|
|
|
|
LastCompileTime = FPlatformTime::Seconds();
|
|
|
|
if (bDirectMode)
|
|
{
|
|
CompileDirect(ShaderFormats);
|
|
}
|
|
else
|
|
{
|
|
#if PLATFORM_WINDOWS
|
|
//@todo - would be nice to change application name or description to have the ThreadId in it for debugging purposes
|
|
SetConsoleTitle(argv[3]);
|
|
#endif
|
|
|
|
FWorkLoop WorkLoop(argv[2], argv[1], argv[4], argv[5], FormatVersionMap);
|
|
WorkLoop.Loop();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int32 GuardedMainWrapper(int32 ArgC, TCHAR* ArgV[], const TCHAR* CrashOutputFile, bool bDirectMode)
|
|
{
|
|
// We need to know whether we are using XGE now, in case an exception
|
|
// is thrown before we parse the command line inside GuardedMain.
|
|
GShaderCompileUseXGE = (ArgC > 6) && FCString::Strcmp(ArgV[6], TEXT("-xge")) == 0;
|
|
|
|
int32 ReturnCode = 0;
|
|
#if PLATFORM_WINDOWS
|
|
if (FPlatformMisc::IsDebuggerPresent())
|
|
#endif
|
|
{
|
|
ReturnCode = GuardedMain(ArgC, ArgV, bDirectMode);
|
|
}
|
|
#if PLATFORM_WINDOWS
|
|
else
|
|
{
|
|
// Don't want 32 dialogs popping up when SCW fails
|
|
GUseCrashReportClient = false;
|
|
__try
|
|
{
|
|
GIsGuarded = 1;
|
|
ReturnCode = GuardedMain(ArgC, ArgV, bDirectMode);
|
|
GIsGuarded = 0;
|
|
}
|
|
__except( ReportCrash( GetExceptionInformation() ) )
|
|
{
|
|
FArchive& OutputFile = *IFileManager::Get().CreateFileWriter(CrashOutputFile,FILEWRITE_NoFail);
|
|
|
|
int32 OutputVersion = ShaderCompileWorkerOutputVersion;
|
|
OutputFile << OutputVersion;
|
|
|
|
if (GFailedErrorCode == ESCWErrorCode::Success)
|
|
{
|
|
GFailedErrorCode = ESCWErrorCode::GeneralCrash;
|
|
}
|
|
int32 ErrorCode = (int32)GFailedErrorCode;
|
|
OutputFile << ErrorCode;
|
|
|
|
// Note: Can't use FStrings here as SEH can't be used with destructors
|
|
int32 CallstackLength = FCString::Strlen(GErrorHist);
|
|
OutputFile << CallstackLength;
|
|
|
|
int32 ExceptionInfoLength = FCString::Strlen(GErrorExceptionDescription);
|
|
OutputFile << ExceptionInfoLength;
|
|
|
|
OutputFile.Serialize(GErrorHist, CallstackLength * sizeof(TCHAR));
|
|
OutputFile.Serialize(GErrorExceptionDescription, ExceptionInfoLength * sizeof(TCHAR));
|
|
|
|
int32 NumBatches = 0;
|
|
OutputFile << NumBatches;
|
|
|
|
// Close the output file.
|
|
delete &OutputFile;
|
|
|
|
if (GShaderCompileUseXGE)
|
|
{
|
|
ReturnCode = 1;
|
|
WriteXGESuccessFile(ArgV[1]);
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
FEngineLoop::AppPreExit();
|
|
FEngineLoop::AppExit();
|
|
|
|
return ReturnCode;
|
|
}
|
|
|
|
IMPLEMENT_APPLICATION(ShaderCompileWorker, "ShaderCompileWorker")
|
|
|
|
|
|
/**
|
|
* Application entry point
|
|
*
|
|
* @param ArgC Command-line argument count
|
|
* @param ArgV Argument strings
|
|
*/
|
|
|
|
INT32_MAIN_INT32_ARGC_TCHAR_ARGV()
|
|
{
|
|
// FPlatformProcess::OpenProcess only implemented for windows atm
|
|
#if PLATFORM_WINDOWS
|
|
if (ArgC == 4 && FCString::Strcmp(ArgV[1], TEXT("-xgemonitor")) == 0)
|
|
{
|
|
// Open handles to the two processes
|
|
FProcHandle EngineProc = FPlatformProcess::OpenProcess(FCString::Atoi(ArgV[2]));
|
|
FProcHandle BuildProc = FPlatformProcess::OpenProcess(FCString::Atoi(ArgV[3]));
|
|
|
|
if (EngineProc.IsValid() && BuildProc.IsValid())
|
|
{
|
|
// Whilst the build is still in progress
|
|
while (FPlatformProcess::IsProcRunning(BuildProc))
|
|
{
|
|
// Check that the engine is still alive.
|
|
if (!FPlatformProcess::IsProcRunning(EngineProc))
|
|
{
|
|
// The engine has shutdown before the build was stopped.
|
|
// Kill off the build process
|
|
FPlatformProcess::TerminateProc(BuildProc);
|
|
break;
|
|
}
|
|
|
|
FPlatformProcess::Sleep(0.01f);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
#endif
|
|
TCHAR OutputFilePath[PLATFORM_MAX_FILEPATH_LENGTH] = TEXT("");
|
|
bool bDirectMode = false;
|
|
for (int32 Index = 1; Index < ArgC; ++Index)
|
|
{
|
|
if (FCString::Strcmp(ArgV[Index], TEXT("-directcompile")) == 0)
|
|
{
|
|
bDirectMode = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!bDirectMode)
|
|
{
|
|
if (ArgC < 6)
|
|
{
|
|
printf("ShaderCompileWorker is called by UE4, it requires specific command like arguments.\n");
|
|
return -1;
|
|
}
|
|
|
|
// Game exe can pass any number of parameters through with appGetSubprocessCommandline
|
|
// so just make sure we have at least the minimum number of parameters.
|
|
check(ArgC >= 6);
|
|
|
|
FCString::Strncpy(OutputFilePath, ArgV[1], PLATFORM_MAX_FILEPATH_LENGTH);
|
|
FCString::Strncat(OutputFilePath, ArgV[5], PLATFORM_MAX_FILEPATH_LENGTH);
|
|
}
|
|
|
|
const int32 ReturnCode = GuardedMainWrapper(ArgC, ArgV, OutputFilePath, bDirectMode);
|
|
return ReturnCode;
|
|
}
|