You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Fixed a UpdateEarlyZPassMode race condition by moving all UpdateEarlyZPassMode calls to main thread. Render thread could be changing early z pass mode, while main thread was reading this value inside FDeferredShadingSceneRenderer constructor. Thanks Richard Wallis for finding it!
#rb Rolando.Caloca #jira UE-72043, UE-71877 #lockdown Cristina.Riveron #ROBOMERGE-OWNER: lina.halper #ROBOMERGE-AUTHOR: krzysztof.narkowicz #ROBOMERGE-SOURCE: CL 5629897 in //UE4/Release-4.22/... via CL 5629900 #ROBOMERGE-BOT: ANIM (Main -> Dev-Anim) [CL 5631283 by krzysztof narkowicz in Dev-Anim branch]
This commit is contained in:
@@ -577,6 +577,34 @@ static void DoLazyStaticMeshUpdateCVarSinkFunction()
|
||||
|
||||
static FAutoConsoleVariableSink CVarDoLazyStaticMeshUpdateSink(FConsoleCommandDelegate::CreateStatic(&DoLazyStaticMeshUpdateCVarSinkFunction));
|
||||
|
||||
static void UpdateEarlyZPassModeCVarSinkFunction()
|
||||
{
|
||||
static int32 CachedEarlyZPass = CVarEarlyZPass.GetValueOnGameThread();
|
||||
static int32 CachedBasePassWriteDepthEvenWithFullPrepass = CVarBasePassWriteDepthEvenWithFullPrepass.GetValueOnGameThread();
|
||||
|
||||
const int32 EarlyZPass = CVarEarlyZPass.GetValueOnGameThread();
|
||||
const int32 BasePassWriteDepthEvenWithFullPrepass = CVarBasePassWriteDepthEvenWithFullPrepass.GetValueOnGameThread();
|
||||
|
||||
if (EarlyZPass != CachedEarlyZPass
|
||||
|| BasePassWriteDepthEvenWithFullPrepass != CachedBasePassWriteDepthEvenWithFullPrepass)
|
||||
{
|
||||
for (TObjectIterator<UWorld> It; It; ++It)
|
||||
{
|
||||
UWorld* World = *It;
|
||||
if (World && World->Scene)
|
||||
{
|
||||
FScene* Scene = (FScene*)(World->Scene);
|
||||
Scene->UpdateEarlyZPassMode();
|
||||
}
|
||||
}
|
||||
|
||||
CachedEarlyZPass = EarlyZPass;
|
||||
CachedBasePassWriteDepthEvenWithFullPrepass = BasePassWriteDepthEvenWithFullPrepass;
|
||||
}
|
||||
}
|
||||
|
||||
static FAutoConsoleVariableSink CVarUpdateEarlyZPassModeSink(FConsoleCommandDelegate::CreateStatic(&UpdateEarlyZPassModeCVarSinkFunction));
|
||||
|
||||
void FScene::UpdateDoLazyStaticMeshUpdate(FRHICommandListImmediate& CmdList)
|
||||
{
|
||||
bool DoLazyStaticMeshUpdate = CVarDoLazyStaticMeshUpdate.GetValueOnRenderThread() && !GIsEditor && FApp::CanEverRender();
|
||||
@@ -3027,6 +3055,8 @@ bool ShouldForceFullDepthPass(EShaderPlatform ShaderPlatform)
|
||||
|
||||
void FScene::UpdateEarlyZPassMode()
|
||||
{
|
||||
checkSlow(IsInGameThread());
|
||||
|
||||
DefaultBasePassDepthStencilAccess = FExclusiveDepthStencil::DepthWrite_StencilWrite;
|
||||
EarlyZPassMode = DDM_NonMaskedOnly;
|
||||
bEarlyZPassMovable = false;
|
||||
@@ -3064,8 +3094,6 @@ void FScene::UpdateEarlyZPassMode()
|
||||
|
||||
void FScene::ConditionalMarkStaticMeshElementsForUpdate()
|
||||
{
|
||||
UpdateEarlyZPassMode();
|
||||
|
||||
if (bScenesPrimitivesNeedStaticMeshElementUpdate
|
||||
|| CachedDefaultBasePassDepthStencilAccess != DefaultBasePassDepthStencilAccess)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user