Foundation
Loading...
Searching...
No Matches
Classes | Functions
Foundation::RenderUtils Namespace Reference

Classes

struct  CSClearBufferData
 
struct  CSDebugTextData
 

Functions

PassHandle createCSClearBackBuffer (Renderer *r, StringView name, float4 clearColor={})
 
PassHandle createCSClearTexture (Renderer *r, StringView name, ResourceHandle resource, RHITextureViewDesc viewDesc, float4 clearColor)
 
PassHandle createCSDebugTextPassBackBuffer (Renderer *r, StringView name, Span< const CSDebugTextData > lines)
 
void createCSMipGenerationPasses (Renderer *renderer, StringView name, RHIDeviceQueueType queue, ResourceHandle src, ResourceHandle dst, RHIResourceFormat srcFormat, RHIResourceFormat dstFormat, RHITextureAspectFlagBits srcAspect, RHITextureAspectFlagBits dstAspect, ResourceHandle srcSampler, uint32_t numMips, uint32_t layer=0)
 Generates full mip-chain with multiple compute dispatches.
 
void createCSMipGenerationSinglePass (Renderer *renderer, StringView name, RHIDeviceQueueType queue, ResourceHandle src, ResourceHandle dst, RHIResourceFormat srcFormat, RHIResourceFormat dstFormat, RHITextureAspectFlag srcAspect, RHITextureAspectFlag dstAspect, ResourceHandle srcSampler, uint32_t numMips, uint32_t numLayer=1, RHIDeviceSampler::SamplerDesc::Reduction reduction=RHIDeviceSampler::SamplerDesc::Reduction::WeightedAverage)
 Generates full mip-chain with a single compute dispatch.
 
template<typename FSetup , typename FRecord >
PassHandle createPSFullscreenPass (Renderer *r, StringView name, FSetup &&setup, FRecord &&record)
 Creates a full-screen triangle pass that writes to the current backbuffer.
 
template<typename FSetup >
PassHandle createPSFullscreenPass (Renderer *r, StringView name, FSetup &&setup)
 
template<typename FSetup , typename FRecord >
PassHandle createPSFullscreenPassRTV (Renderer *r, StringView name, ResourceHandle rtvTexture, RHITextureViewDesc const &rtvViewDesc, RHIExtent2D extent, FSetup &&setup, FRecord &&record)
 Creates a full-screen triangle pass that writes to an arbitrary texture RTV instead of the backbuffer.
 
template<typename FSetup >
PassHandle createPSFullscreenPassRTV (Renderer *r, StringView name, ResourceHandle rtvTexture, RHITextureViewDesc const &rtvViewDesc, FSetup &&setup)
 
PassHandle createPSBackbufferBlitPass (Renderer *r, StringView name, ResourceHandle copy_sampler, ResourceHandle copy_source, RHIResourceFormat srcFormat=RHIResourceFormat::R8G8B8A8Unorm)
 Creates a full-screen triangle pass that renders a texture to the current backbuffer.
 

Function Documentation

◆ createCSClearBackBuffer()

PassHandle Foundation::RenderUtils::createCSClearBackBuffer ( Renderer r,
StringView  name,
float4  clearColor = {} 
)
inline

◆ createCSClearTexture()

PassHandle Foundation::RenderUtils::createCSClearTexture ( Renderer r,
StringView  name,
ResourceHandle  resource,
RHITextureViewDesc  viewDesc,
float4  clearColor 
)
inline

◆ createCSDebugTextPassBackBuffer()

PassHandle Foundation::RenderUtils::createCSDebugTextPassBackBuffer ( Renderer r,
StringView  name,
Span< const CSDebugTextData lines 
)
inline

@breif Draw debug text overlay on top of the existing backbuffer content This is a port of https://github.com/zeux/niagara/blob/master/src/shaders/debugtext.comp.glsl

◆ createCSMipGenerationPasses()

void Foundation::RenderUtils::createCSMipGenerationPasses ( Renderer renderer,
StringView  name,
RHIDeviceQueueType  queue,
ResourceHandle  src,
ResourceHandle  dst,
RHIResourceFormat  srcFormat,
RHIResourceFormat  dstFormat,
RHITextureAspectFlagBits  srcAspect,
RHITextureAspectFlagBits  dstAspect,
ResourceHandle  srcSampler,
uint32_t  numMips,
uint32_t  layer = 0 
)
inline

Generates full mip-chain with multiple compute dispatches.

Note
When src != dst, the first generated mip (i.e. mip 1 of the src) is written to the dst's mip 0.

◆ createCSMipGenerationSinglePass()

void Foundation::RenderUtils::createCSMipGenerationSinglePass ( Renderer renderer,
StringView  name,
RHIDeviceQueueType  queue,
ResourceHandle  src,
ResourceHandle  dst,
RHIResourceFormat  srcFormat,
RHIResourceFormat  dstFormat,
RHITextureAspectFlag  srcAspect,
RHITextureAspectFlag  dstAspect,
ResourceHandle  srcSampler,
uint32_t  numMips,
uint32_t  numLayer = 1,
RHIDeviceSampler::SamplerDesc::Reduction  reduction = RHIDeviceSampler::SamplerDesc::Reduction::WeightedAverage 
)
inline

Generates full mip-chain with a single compute dispatch.

Note
When src != dst, the first generated mip (i.e. mip 1 of the src) is written to the dst's mip 0.

◆ createPSBackbufferBlitPass()

PassHandle Foundation::RenderUtils::createPSBackbufferBlitPass ( Renderer r,
StringView  name,
ResourceHandle  copy_sampler,
ResourceHandle  copy_source,
RHIResourceFormat  srcFormat = RHIResourceFormat::R8G8B8A8Unorm 
)
inline

Creates a full-screen triangle pass that renders a texture to the current backbuffer.

◆ createPSFullscreenPass() [1/2]

template<typename FSetup >
PassHandle Foundation::RenderUtils::createPSFullscreenPass ( Renderer r,
StringView  name,
FSetup &&  setup 
)

◆ createPSFullscreenPass() [2/2]

PassHandle Foundation::RenderUtils::createPSFullscreenPass ( Renderer r,
StringView  name,
FSetup &&  setup,
FRecord &&  record 
)

Creates a full-screen triangle pass that writes to the current backbuffer.

Parameters
setupis called once during setup phase of the pass, after a fullscreen vertex stage is bound.
recordis called once per frame during execution phase of the pass, after the pipeline is set.

◆ createPSFullscreenPassRTV() [1/2]

template<typename FSetup >
PassHandle Foundation::RenderUtils::createPSFullscreenPassRTV ( Renderer r,
StringView  name,
ResourceHandle  rtvTexture,
RHITextureViewDesc const rtvViewDesc,
FSetup &&  setup 
)

◆ createPSFullscreenPassRTV() [2/2]

PassHandle Foundation::RenderUtils::createPSFullscreenPassRTV ( Renderer r,
StringView  name,
ResourceHandle  rtvTexture,
RHITextureViewDesc const rtvViewDesc,
RHIExtent2D  extent,
FSetup &&  setup,
FRecord &&  record 
)

Creates a full-screen triangle pass that writes to an arbitrary texture RTV instead of the backbuffer.

Parameters
rtvTextureResource handle of the texture to render into.
rtvViewDescView descriptor for the render target (format, subresource range, etc.).
setupCalled once during setup phase, after fullscreen vertex stage is bound.
recordCalled once per frame during execution phase, after the pipeline is set.