UE4 MeshPass 全流程
2022-07-07 17:03:44 23 举报
仅供参考
作者其他创作
大纲/内容
FPrimitiveSceneShaderData
== FPrimitiveSceneShaderData(Scene.PrimitiveSceneProxies)
FSceneRenderer::ComputeViewVisibility(...)
Readback
ComputeAndMarkRelevanceForViewParallel
FScatterCS
...
FPrimitiveUniformShaderParameters
Fill some data of FViewInfo
new FMeshBatchAndRelevance
View.ViewUniformBuffer.UpdateUniformBufferImmediate
UActorComponent::SendRenderDynamicData_Concurrent()
AddStaticMeshes
FMemcpyCS
View.DynamicMeshElementsPassRelevance
ResizeResourceIfNeeded
UUnrealEdEngine::Tick(..)
FrustumCull
Replace VisibleMeshDrawCommands
UActorComponent::ExecuteUnregisterEvents()
FMeshPassProcessor
Update
NewVisibleMeshDrawCommand.Setup
FRendererModule::BeginRenderingViewFamily
ParallelForTemplate
TaskContext.bUseGPUScene
OnVirtualTextureDestroyed
RemovedPrimitiveSceneInfos
DynamicPrimitiveShaderData
END
FCoreDelegates::OnBeginFrame.Broadcast()
RHICmdList.DrawIndexedPrimitive
FMeshDrawCommand
FMeshDrawCommand::SubmitDraw
CachedMeshDrawCommandStateBuckets.ComputeHash
FPrimitiveSceneProxy::GetViewRelevance
Call Stack
CreateLightPrimitiveInteractionsForPrimitive
RHICmdList.SetStencilRef
FDrawCommandRelevancePacket::AddCommandsForMesh
View.CachedViewUniformShaderParameters
FStaticMeshSceneProxy::GetMeshElement
delete PrimitiveSceneInfo->Proxy;delete PrimitiveSceneInfo;
TempVisibleMeshDrawCommands.Reset()
END ParallelFor
PrimitiveIdBufferData
End
IndirectLightingCacheUniformBuffer
FMeshPassProcessor::BuildMeshDrawCommands
IsMobilePlatform
ENQUEUE_RENDER_COMMANDBeginFrameRenderThread
FViewport::Draw(...)
SubmitMeshDrawCommandsRange
FMeshPassDrawListContext::AddCommand
MeshDrawCommand.IndexBuffer
Scene.GPUScene.LightmapUploadBuffer.Add
View.bReverseCullingView.bRenderSceneTwoSided
UpdateGPUScene
FStaticMeshSceneProxy::DrawStaticElements
LockResource
Scene.GPUScene.PrimitiveUploadBuffer.ResourceUploadTo
Per FVertexInputStream
FDynamicPassMeshDrawListContext::AddCommand
FPrimitiveSceneInfo::AddToScene
VisibleMeshDrawCommands
IndirectLightingCacheAllocation
FViewUniformShaderParameters::PrimitiveSceneData
FScene::RemovePrimitive (GameThread)
UnlockResourceGPUScene
NumVisibleStaticMeshElements++
Scene.GPUScene.LightmapUploadBuffer
Used
OcclusionCull
ApplyViewOverridesToMeshDrawCommands
FMeshDrawCommand::GetDynamicInstancingHash
FLightmapSceneShaderData::Setup
Code Run
XXXShader->GetShaderBindings
AddToPrimitiveOctree
UPrimitiveComponent::DestroyRenderState_Concurrent
TempVisibleMeshDrawCommands
bRenderDynamicDataDirty
FRWBufferStructured
FMeshPassProcessor::AddMeshBatch
UPrimitiveComponent::ShouldRecreateProxyOnUpdateTransform()
UActorComponent::MarkForNeededEndOfFrameUpdate()
NumOfStaticMeshBatch = NumLOD * NumSection + NumUnifiedMeshNumUnifiedMesh = NumLOD
FStaticMeshBatch
BuildMeshDrawCommandPrimitiveIdBuffer
Chunk
Main ThreadFEngineLoop::Tick
FStaticMeshBatchRelevance
UPrimitiveComponent::CreateRenderState_Concurrent
ViewRelevance.HasTranslucency()
UpdateGPUSceneInternal
FMeshPassProcessor::SetDrawListContext
RHICmdList.ApplyCachedRenderTargets
FMeshBatchAndRelevance
FPrimitiveSceneInfo::UpdateUniformBuffer
AddedPrimitiveSceneInfos
ENQUEUE_RENDER_COMMANDFScene::UpdateAllPrimitiveSceneInfos
ComputeLODForMeshes
NULL
UpdateAllPrimitiveSceneInfos
FScene::RemoveLight
FParallelMeshDrawCommandPass::DispatchPassSetup
ChunkSize = Chunk.DataSize + sizeof(FTaggedMemory)
Top
FCachedPassMeshDrawListContext::FinalizeCommand
new FStaticMeshBatch
FMaterialRelevance
bUseCachedMeshCommand
bRenderStateDirty
FGraphicsMinimalPipelineStateInitializer
GPUScene.PrimitiveBuffer->SRV
ReflectionCaptures
FPrimitiveSceneInfo::CacheMeshDrawCommands
FSceneRenderer::CreateSceneRenderer(...)
DrawList.Add(NewVisibleMeshDrawCommand)
FDynamicMeshDrawCommandStorage
UseGPUScene
UActorComponent::MarkForNeededEndOfFrameRecreate()
new FStaticMeshBatchRelevance
UEditorEngine::Tick(...)
UWorld::SendAllEndOfFrameUpdates()
bDynamicInstancing
FPrecomputedLightingUniformParameters
NumDynamicBuildRequestElements[PassType] += StaticMeshRelevance.NumElements;DynamicBuildRequests[PassType].Add(&StaticMesh);
FScene::AddLight
OutHasDynamicMeshElementsMasks
FMemory::Memcmp
FSceneRenderer::GatherDynamicMeshElements
FMeshBatchElement
(Render)
FPrimitiveViewRelevance::bDrawRelevance
FTextureRWBuffer2D
UpdateSceneStaticMeshArrays
DrawListStorage.MeshDrawCommands.AddElement
FSceneRenderer::SetupMeshPass
ParallelCommandListSet
UpdateUniformResource
FViewUniformShaderParameters
RHICmdList.DrawIndexedPrimitiveIndirect
FScene::AddPrimitiveSceneInfo_RenderThread
EMeshPass::Type
/** * The following arrays are densely packed primitive data needed by various * rendering passes. PrimitiveSceneInfo->PackedIndex maintains the index * where data is stored in these arrays for a given primitive. *//** Packed array of primitives in the scene. */TArray<FPrimitiveSceneInfo*> Primitives;/** Packed array of all transforms in the scene. */TArray<FMatrix> PrimitiveTransforms;/** Packed array of primitive scene proxies in the scene. */TArray<FPrimitiveSceneProxy*> PrimitiveSceneProxies;/** Packed array of primitive bounds. */TArray<FPrimitiveBounds> PrimitiveBounds;/** Packed array of primitive flags. */TArray<FPrimitiveFlagsCompact> PrimitiveFlagsCompact;/** Packed array of precomputed primitive visibility IDs. */TArray<FPrimitiveVisibilityId> PrimitiveVisibilityIds;/** Packed array of primitive occlusion flags. See EOcclusionFlags. */TArray<uint8> PrimitiveOcclusionFlags;/** Packed array of primitive occlusion bounds. */TArray<FBoxSphereBounds> PrimitiveOcclusionBounds;/** Packed array of primitive components associated with the primitive. */TArray<FPrimitiveComponentId> PrimitiveComponentIds;/** Packed array of runtime virtual texture flags. */TArray<FPrimitiveVirtualTextureFlags> PrimitiveVirtualTextureFlags;/** Packed array of runtime virtual texture lod info. */TArray<FPrimitiveVirtualTextureLodInfo> PrimitiveVirtualTextureLod;TBitArray<> PrimitivesNeedingStaticMeshUpdate;TSet<FPrimitiveSceneInfo*> PrimitivesNeedingStaticMeshUpdateWithoutVisibilityCheck;
XXXPassMeshProcessor::Process
ViewState->SceneSoftwareOcclusion
FScene::UpdateAllPrimitiveSceneInfos
FMeshDrawCommand::SetDrawParametersAndFinalize
View.DynamicMeshElements
SetGraphicsPipelineState
FMeshCommandOneFrameArray
FVisibleMeshDrawCommand::StateBucketId
FStaticMeshSceneProxy::SetMeshElementGeometrySource
FScene::RemovePrimitiveSceneInfo_RenderThread
FPrimitiveSceneShaderData::Setup
LightmapDataOffset
FRelevancePacket::MarkRelevant(StaticRelevance)
Flow Into
bUseGPUScene
FPrimitiveSceneProxy::GetDynamicMeshElements
FDrawVisibleMeshCommandsAnyThreadTask::DoTask
TempVisibleMeshDrawCommands.Add(NewVisibleMeshDrawCommand)
FMeshBatch::PreparePrimitiveUniformBuffer
FMeshPassDrawListContext::FinalizeCommand
MeshDrawCommand.NumPrimitives > 0
FPrimitiveViewRelevance
UActorComponent::DoDeferredRenderUpdates_Concurrent()
Fill FViewCommands
FGPUScene::PrimitiveBufferFGPUScene::LightmapDataBuffer
FLightmapSceneShaderData
Additional Flag
Scene.GPUScene.PrimitiveUploadViewBuffer.ResourceUploadTo
RHICmdList.DrawPrimitiveIndirect
PassMask.Set(EMeshPass::XXX);View.NumVisibleDynamicMeshElements[EMeshPass::XXX] += NumElements;
TaskContext.PrimitiveIdBufferData
Scene.GPUScene.PrimitiveUploadBuffer.Init
UploadDynamicPrimitiveShaderDataForView
FPrimitiveViewRelevance::bDynamicRelevance
FMeshDrawCommandPassSetupTaskContext
FScene::UpdatePrimitiveTransform
View.PrecomputedVisibilityData
UpdateTranslucentMeshSortKeys
FDynamicPassMeshDrawListContext::FinalizeCommand
FDynamicPassMeshDrawListContext
FScene::AddPrimitive (GameThread)
/** A map from static mesh ID to a boolean visibility value. */FSceneBitArray StaticMeshVisibilityMap;/** A map from static mesh ID to a boolean dithered LOD fade out value. */FSceneBitArray StaticMeshFadeOutDitheredLODMap;/** A map from static mesh ID to a boolean dithered LOD fade in value. */FSceneBitArray StaticMeshFadeInDitheredLODMap;
Context.MeshDrawCommands.Sort(FCompareFMeshDrawCommands())
bHZBOcclusion
GenerateDynamicMeshDrawCommands
Create and update some UBO
RHILockVertexBuffer
GPUScene
FMeshElementCollector::AddMesh
ForcedLodModel > 0
MeshDrawCommandStorage.MeshDrawCommands.Add(1)
UPrimitiveComponent::SendRenderTransform_Concurrent()
bRenderTransformDirty
RelevantStaticPrimitives
FMeshBatch
/** The primitive's static elements are rendered for the view. */uint32 bStaticRelevance : 1; /** The primitive's dynamic elements are rendered for the view. */uint32 bDynamicRelevance : 1;/** The primitive is drawn. */uint32 bDrawRelevance : 1;/** The primitive is casting a shadow. */uint32 bShadowRelevance : 1;
WaitForMeshPassSetupTask()
FDeferredShadingSceneRenderer::Render(FRHICommandListImmediate& RHICmdList)
FViewInfo::OneFramePrimitiveShaderDataBufferFSceneViewState::PrimitiveShaderDataBuffer
GetWorld()
Scene.GPUScene.PrimitiveUploadViewBuffer.Init
MeshDrawCommandStorage.MeshDrawCommands.AddElement
FMeshDrawCommandPassSetupTask::AnyThreadTask
FMeshDrawCommandSortKeyunion { uint64 PackedData; struct { uint64 VertexShaderHash: 16; // Order by vertex shader's hash. uint64 PixelShaderHash: 32; // Order by pixel shader's hash. uint64 Masked: 16; // First order by masked. } BasePass; struct { uint64 MeshIdInPrimitive: 16; // Order meshes belonging to the same primitive by a stable id. uint64 Distance: 32; // Order by distance. uint64 Priority: 16; // First order by priority. } Translucent; struct { uint64 VertexShaderHash : 32;// Order by vertex shader's hash. uint64 PixelShaderHash : 32;// First order by pixel shader's hash. } Generic;};
FRelevancePacket::RenderThreadFinalize
FMemStackBase (Use FMemMark Manually Free or Auto Free at Thread End)
Free
FRelevancePacket::ComputeRelevance
UploadDynamicPrimitiveShaderDataForViewInternal
ComputeDynamicMeshRelevance
FPrimitiveSceneInfo::AddStaticMeshes
GGPUSceneValidatePrimitiveBuffer
Scene.GPUScene.LightmapUploadBuffer.ResourceUploadTo
FBatchingSPDI::DrawMesh
FStaticMeshSceneProxy::GetShadowMeshElement
UpdateBounds
/** A map from primitive ID to a boolean visibility value. */FSceneBitArray PrimitiveVisibilityMap;/** Bit set when a primitive is known to be unoccluded. */FSceneBitArray PrimitiveDefinitelyUnoccludedMap;/** A map from primitive ID to a boolean is fading value. */FSceneBitArray PotentiallyFadingPrimitiveMap;/** A map from primitive ID to a boolean is distance culled */FSceneBitArray DistanceCullingPrimitiveMap;
CachedMeshDrawCommandStateBuckets.FindOrAddIdByHash
FMeshDrawCommand::MatchesForDynamicInstancing
FDeferredShadingSceneRenderer::InitViews(...)
VisibleMeshDrawCommand.DrawPrimitiveId
UActorComponent::RecreateRenderState_Concurrent()
ParallelFor
RHICmdList.DrawPrimitive
Per Pass
UpdateVirtualTexture
FMaterialRenderProxy::UpdateDeferredCachedUniformExpressions
Scene.GPUScene.PrimitiveUploadBuffer.Add
Scene.GPUScene.PrimitiveUploadViewBuffer.Add
RHICmdList.SetStreamSource
IsUnreachable()
UpdatedAttachmentRoots.Reset();UpdatedTransforms.Reset();UpdatedCustomPrimitiveParams.Reset();OverridenPreviousTransforms.Reset();DistanceFieldSceneDataUpdates.Reset();RemovedPrimitiveSceneInfos.Reset();AddedPrimitiveSceneInfos.Reset();
UWorld::MarkActorComponentForNeededEndOfFrameUpdate()
UEditorEngine::UpdateSingleViewportClient(...)
FEditorViewportClient::Draw(...)
FParallelMeshDrawCommandPass::DispatchDraw
FVertexFactory
AddPrimitiveToUpdateGPU
收藏
0 条评论
下一页