engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | 所有成员列表
FRDGBuilder类 参考

Use the render graph builder to build up a graph of passes and then call Execute() to process them. 更多...

#include <RenderGraphBuilder.h>

Public 成员函数

template<typename ParameterStructType , typename ExecuteLambdaType >
FRDGPassRef AddPass (FRDGEventName &&Name, const ParameterStructType *ParameterStruct, ERDGPassFlags Flags, ExecuteLambdaType &&ExecuteLambda)
 Adds a lambda pass to the graph with an accompanied pass parameter struct. 更多...
 
template<typename ExecuteLambdaType >
FRDGPassRef AddPass (FRDGEventName &&Name, ERDGPassFlags Flags, ExecuteLambdaType &&ExecuteLambda)
 Adds a lambda pass to the graph without any parameters. 更多...
 
void * Alloc (uint32 SizeInBytes, uint32 AlignInBytes)
 Allocates raw memory using an allocator tied to the lifetime of the graph.
 
template<typename ObjectType , typename... TArgs>
ObjectType * AllocObject (TArgs &&... Args)
 Allocates a C++ object using an allocator tied to the lifetime of the graph. 更多...
 
template<typename ParameterStructType >
ParameterStructType * AllocParameters ()
 Allocates a parameter struct with a lifetime tied to graph execution.
 
template<typename PODType >
PODType * AllocPOD ()
 Allocates POD memory using an allocator tied to the lifetime of the graph. 更多...
 
FRDGBufferRef CreateBuffer (const FRDGBufferDesc &Desc, const TCHAR *Name, ERDGBufferFlags Flags=ERDGBufferFlags::None)
 Create graph tracked buffer from a descriptor. 更多...
 
FRDGBufferSRVRef CreateSRV (const FRDGBufferSRVDesc &Desc)
 Create graph tracked SRV for a buffer from a descriptor.
 
FRDGTextureSRVRef CreateSRV (const FRDGTextureSRVDesc &Desc)
 Create graph tracked SRV for a texture from a descriptor.
 
FRDGTextureRef CreateTexture (const FRDGTextureDesc &Desc, const TCHAR *Name, ERDGTextureFlags Flags=ERDGTextureFlags::None)
 Create graph tracked texture from a descriptor. 更多...
 
FRDGBufferUAVRef CreateUAV (const FRDGBufferUAVDesc &Desc, ERDGUnorderedAccessViewFlags Flags=ERDGUnorderedAccessViewFlags::None)
 Create graph tracked UAV for a buffer from a descriptor.
 
FRDGTextureUAVRef CreateUAV (const FRDGTextureUAVDesc &Desc, ERDGUnorderedAccessViewFlags Flags=ERDGUnorderedAccessViewFlags::None)
 Create graph tracked UAV for a texture from a descriptor.
 
template<typename ParameterStructType >
TRDGUniformBufferRef< ParameterStructType > CreateUniformBuffer (ParameterStructType *ParameterStruct)
 Creates a graph tracked uniform buffer which can be attached to passes. 更多...
 
void Execute ()
 Executes the queued passes, managing setting of render targets (RHI RenderPasses), resource transitions and queued texture extraction.
 
FRDGTextureRef FindExternalTexture (FRHITexture *Texture) const
 Finds an RDG texture associated with the external texture, or returns null if none is found.
 
const TRefCountPtr< FRDGPooledBuffer > & GetPooledBuffer (FRDGBufferRef Buffer) const
 Performs an immediate query for the underlying pooled buffer. 更多...
 
const TRefCountPtr< IPooledRenderTarget > & GetPooledTexture (FRDGTextureRef Texture) const
 Performs an immediate query for the underlying pooled texture. 更多...
 
void PreallocateTexture (FRDGTextureRef Texture)
 For graph-created resources, this forces immediate allocation of the underlying pooled resource, effectively promoting it to an external resource. 更多...
 
void QueueBufferExtraction (FRDGBufferRef Buffer, TRefCountPtr< FRDGPooledBuffer > *OutPooledBufferPtr)
 Queues a pooled buffer extraction to happen at the end of graph execution. 更多...
 
void QueueTextureExtraction (FRDGTextureRef Texture, TRefCountPtr< IPooledRenderTarget > *OutPooledTexturePtr)
 Queues a pooled render target extraction to happen at the end of graph execution. 更多...
 
FRDGBufferRef RegisterExternalBuffer (const TRefCountPtr< FRDGPooledBuffer > &ExternalPooledBuffer, const TCHAR *NameIfNotRegistered, ERDGBufferFlags Flags=ERDGBufferFlags::None)
 Register an external buffer with a custom name. 更多...
 
FRDGBufferRef RegisterExternalBuffer (const TRefCountPtr< FRDGPooledBuffer > &ExternalPooledBuffer, ERDGBufferFlags Flags=ERDGBufferFlags::None)
 Register a external buffer to be tracked by the render graph.
 
FRDGTextureRef RegisterExternalTexture (const TRefCountPtr< IPooledRenderTarget > &ExternalPooledTexture, const TCHAR *NameIfNotRegistered, ERenderTargetTexture RenderTargetTexture=ERenderTargetTexture::ShaderResource, ERDGTextureFlags Flags=ERDGTextureFlags::None)
 Register an external texture with a custom name. 更多...
 
FRDGTextureRef RegisterExternalTexture (const TRefCountPtr< IPooledRenderTarget > &ExternalPooledTexture, ERenderTargetTexture Texture=ERenderTargetTexture::ShaderResource, ERDGTextureFlags Flags=ERDGTextureFlags::None)
 Registers a external pooled render target texture to be tracked by the render graph. 更多...
 
void RemoveUnusedBufferWarning (FRDGBufferRef Buffer)
 Flag a buffer that is produced by a pass but never used or extracted to not emit an 'unused' warning.
 
void RemoveUnusedTextureWarning (FRDGTextureRef Texture)
 Flag a texture that is produced by a pass but never used or extracted to not emit an 'unused' warning.
 
void SetBufferAccessFinal (FRDGBufferRef Buffer, ERHIAccess Access)
 Sets the access to transition to after execution. 更多...
 
void SetTextureAccessFinal (FRDGTextureRef Texture, ERHIAccess Access)
 Sets the access to transition to after execution. 更多...
 

静态 Public 成员函数

static void TickPoolElements ()
 Per-frame update of the render graph resource pool.
 

Public 属性

FRHICommandListImmediate & RHICmdList
 The RHI command list used for the render graph.
 

详细描述

Use the render graph builder to build up a graph of passes and then call Execute() to process them.

Resource barriers and lifetimes are derived from RDG parameters in the pass parameter struct provided to each AddPass call. The resulting graph is compiled, culled, and executed in Execute(). The builder should be created on the stack and executed prior to destruction.

成员函数说明

◆ AddPass() [1/2]

template<typename ParameterStructType , typename ExecuteLambdaType >
FRDGPassRef FRDGBuilder::AddPass ( FRDGEventName &&  Name,
const ParameterStructType *  ParameterStruct,
ERDGPassFlags  Flags,
ExecuteLambdaType &&  ExecuteLambda 
)

Adds a lambda pass to the graph with an accompanied pass parameter struct.

RDG resources declared in the struct (via _RDG parameter macros) are safe to access in the lambda. The pass parameter struct should be allocated by AllocParameters(), and once passed in, should not be mutated. It is safe to provide the same parameter struct to multiple passes, so long as it is kept immutable. The lambda is deferred until execution unless the immediate debug mode is enabled. All lambda captures should assume deferral of execution.

The lambda must include a single RHI command list as its parameter. The exact type of command list depends on the workload. For example, use FRHIComputeCommandList& for Compute / AsyncCompute workloads. Raster passes should use FRHICommandList&. Prefer not to use FRHICommandListImmediate& unless actually required.

Declare the type of GPU workload (i.e. Copy, Compute / AsyncCompute, Graphics) to the pass via the Flags argument. This is used to determine async compute regions, render pass setup / merging, RHI transition accesses, etc. Other flags exist for specialized purposes, like forcing a pass to never be culled (NeverCull). See ERDGPassFlags for more info.

The pass name is used by debugging / profiling tools.

◆ AddPass() [2/2]

template<typename ExecuteLambdaType >
FRDGPassRef FRDGBuilder::AddPass ( FRDGEventName &&  Name,
ERDGPassFlags  Flags,
ExecuteLambdaType &&  ExecuteLambda 
)

Adds a lambda pass to the graph without any parameters.

This useful for deferring RHI work onto the graph timeline, or incrementally porting code to use the graph system. NeverCull and SkipRenderPass (if Raster) are implicitly added to Flags. AsyncCompute is not allowed. Accessing RHI resources which are tracked by the graph is only allowed if the UntrackedAccess flag is specified. It is never permitted to access a created (i.e. not externally registered) RDG resource in an independent pass, as the RHI lifetime is not guaranteed.

◆ AllocObject()

template<typename ObjectType , typename... TArgs>
ObjectType * FRDGBuilder::AllocObject ( TArgs &&...  Args)

Allocates a C++ object using an allocator tied to the lifetime of the graph.

Will destruct the object.

◆ AllocPOD()

template<typename PODType >
PODType * FRDGBuilder::AllocPOD ( )

Allocates POD memory using an allocator tied to the lifetime of the graph.

Does not construct / destruct.

◆ CreateBuffer()

FRDGBufferRef FRDGBuilder::CreateBuffer ( const FRDGBufferDesc &  Desc,
const TCHAR *  Name,
ERDGBufferFlags  Flags = ERDGBufferFlags::None 
)

Create graph tracked buffer from a descriptor.

The CPU memory is guaranteed to be valid through execution of the graph, at which point it is released. The underlying RHI buffer lifetime is only guaranteed for passes which declare the buffer in the pass parameter struct. The name is the name used for GPU debugging tools.

◆ CreateTexture()

FRDGTextureRef FRDGBuilder::CreateTexture ( const FRDGTextureDesc &  Desc,
const TCHAR *  Name,
ERDGTextureFlags  Flags = ERDGTextureFlags::None 
)

Create graph tracked texture from a descriptor.

The CPU memory is guaranteed to be valid through execution of the graph, at which point it is released. The underlying RHI texture lifetime is only guaranteed for passes which declare the texture in the pass parameter struct. The name is the name used for GPU debugging tools and the the VisualizeTexture/Vis command.

◆ CreateUniformBuffer()

template<typename ParameterStructType >
TRDGUniformBufferRef< ParameterStructType > FRDGBuilder::CreateUniformBuffer ( ParameterStructType *  ParameterStruct)

Creates a graph tracked uniform buffer which can be attached to passes.

These uniform buffers require some care because they will bulk transition all resources. The graph will only transition resources which are not also bound for write access by the pass.

◆ GetPooledBuffer()

const TRefCountPtr< FRDGPooledBuffer > & FRDGBuilder::GetPooledBuffer ( FRDGBufferRef  Buffer) const

Performs an immediate query for the underlying pooled buffer.

This is only allowed for registered or preallocated buffers.

◆ GetPooledTexture()

const TRefCountPtr< IPooledRenderTarget > & FRDGBuilder::GetPooledTexture ( FRDGTextureRef  Texture) const

Performs an immediate query for the underlying pooled texture.

This is only allowed for registered or preallocated textures.

◆ PreallocateTexture()

void FRDGBuilder::PreallocateTexture ( FRDGTextureRef  Texture)

For graph-created resources, this forces immediate allocation of the underlying pooled resource, effectively promoting it to an external resource.

This will increase memory pressure, but allows for querying the pooled resource with GetPooled{Texture, Buffer}. This is primarily used as an aid for porting code incrementally to RDG.

◆ QueueBufferExtraction()

void FRDGBuilder::QueueBufferExtraction ( FRDGBufferRef  Buffer,
TRefCountPtr< FRDGPooledBuffer > *  OutPooledBufferPtr 
)

Queues a pooled buffer extraction to happen at the end of graph execution.

For graph-created buffers, this extends the lifetime of the GPU resource until execution, at which point the pointer is filled. If specified, the buffer is transitioned to the AccessFinal state, or kDefaultAccessFinal otherwise.

◆ QueueTextureExtraction()

void FRDGBuilder::QueueTextureExtraction ( FRDGTextureRef  Texture,
TRefCountPtr< IPooledRenderTarget > *  OutPooledTexturePtr 
)

Queues a pooled render target extraction to happen at the end of graph execution.

For graph-created textures, this extends the lifetime of the GPU resource until execution, at which point the pointer is filled. If specified, the texture is transitioned to the AccessFinal state, or kDefaultAccessFinal otherwise.

◆ RegisterExternalBuffer()

FRDGBufferRef FRDGBuilder::RegisterExternalBuffer ( const TRefCountPtr< FRDGPooledBuffer > &  ExternalPooledBuffer,
const TCHAR *  NameIfNotRegistered,
ERDGBufferFlags  Flags = ERDGBufferFlags::None 
)

Register an external buffer with a custom name.

The name is only used if the buffer has not already been registered.

◆ RegisterExternalTexture() [1/2]

FRDGTextureRef FRDGBuilder::RegisterExternalTexture ( const TRefCountPtr< IPooledRenderTarget > &  ExternalPooledTexture,
const TCHAR *  NameIfNotRegistered,
ERenderTargetTexture  RenderTargetTexture = ERenderTargetTexture::ShaderResource,
ERDGTextureFlags  Flags = ERDGTextureFlags::None 
)

Register an external texture with a custom name.

The name is only used if the texture has not already been registered.

◆ RegisterExternalTexture() [2/2]

FRDGTextureRef FRDGBuilder::RegisterExternalTexture ( const TRefCountPtr< IPooledRenderTarget > &  ExternalPooledTexture,
ERenderTargetTexture  Texture = ERenderTargetTexture::ShaderResource,
ERDGTextureFlags  Flags = ERDGTextureFlags::None 
)

Registers a external pooled render target texture to be tracked by the render graph.

The pooled render target may contain two RHI textures–one MSAA and one non-MSAA resolve texture. In most cases they are both the same pointer. RDG textures are 1-to-1 with an RHI texture, so two RDG textures must be registered at most. Use ERenderTargetTexture to select which RHI texture on the pooled render target to register. The name of the registered RDG texture is pulled from the pooled render target.

◆ SetBufferAccessFinal()

void FRDGBuilder::SetBufferAccessFinal ( FRDGBufferRef  Buffer,
ERHIAccess  Access 
)

Sets the access to transition to after execution.

Only valid on external or extracted buffers. Overwrites any previously set final access.

◆ SetTextureAccessFinal()

void FRDGBuilder::SetTextureAccessFinal ( FRDGTextureRef  Texture,
ERHIAccess  Access 
)

Sets the access to transition to after execution.

Only valid on external or extracted textures. Overwrites any previously set final access.


该类的文档由以下文件生成: