You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
|
|
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
||
|
|
|
||
|
|
#include "RenderGraphPass.h"
|
||
|
|
|
||
|
|
void FRDGPassParameterStruct::ClearUniformBuffers() const
|
||
|
|
{
|
||
|
|
/** The pass parameter struct is mostly POD, with the exception of uniform buffers.
|
||
|
|
* Since the explicit type of the struct is unknown, the method traverses and destructs
|
||
|
|
* all uniform buffer references manually.
|
||
|
|
*/
|
||
|
|
const auto& Resources = Layout->Resources;
|
||
|
|
|
||
|
|
for (int32 ResourceIndex = 0; ResourceIndex < Resources.Num(); ++ResourceIndex)
|
||
|
|
{
|
||
|
|
const EUniformBufferBaseType MemberType = Resources[ResourceIndex].MemberType;
|
||
|
|
|
||
|
|
if (MemberType == UBMT_REFERENCED_STRUCT)
|
||
|
|
{
|
||
|
|
const uint16 MemberOffset = Resources[ResourceIndex].MemberOffset;
|
||
|
|
|
||
|
|
FUniformBufferRHIRef* UniformBufferPtr = reinterpret_cast<FUniformBufferRHIRef*>(Contents + MemberOffset);
|
||
|
|
*UniformBufferPtr = FUniformBufferRHIRef();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
FRDGPass::FRDGPass(
|
||
|
|
FRDGEventName&& InName,
|
||
|
|
FRDGPassParameterStruct InParameterStruct,
|
||
|
|
ERDGPassFlags InPassFlags)
|
||
|
|
: Name(static_cast<FRDGEventName&&>(InName))
|
||
|
|
, ParameterStruct(InParameterStruct)
|
||
|
|
, PassFlags(InPassFlags)
|
||
|
|
{
|
||
|
|
if (IsCompute())
|
||
|
|
{
|
||
|
|
ensureMsgf(ParameterStruct.GetLayout().NumRenderTargets() == 0, TEXT("Pass %s was declared as ERDGPassFlags::Compute yet has RenderTargets in its ResourceTable"), GetName());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void FRDGPass::Execute(FRHICommandListImmediate& RHICmdList) const
|
||
|
|
{
|
||
|
|
ExecuteImpl(RHICmdList);
|
||
|
|
|
||
|
|
ParameterStruct.ClearUniformBuffers();
|
||
|
|
}
|