Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
foray::stages::MinimalRaytracingStageBase Class Referenceabstract

Minimalist setup for a Raytracing Stage. More...

#include <foray_minimalraytracingstage.hpp>

Inheritance diagram for foray::stages::MinimalRaytracingStageBase:
foray::stages::RenderStage

Public Member Functions

void Init (core::Context *context)
 Destroys, assigns context, calls ApiCreateOutputImages(), ApiCustomObjectsCreate(), ApiCreateOrUpdateDescriptors(), ApiCreatePipelineLayout(), ApiCreateRtPipeline() in this order.
 
virtual void RecordFrame (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo) override
 Calls ApiRecordFramePrepare(), ApiRecordFrameBind(), ApiRecordFrameTraceRays() in this order.
 
virtual void Resize (const VkExtent2D &extent) override
 Calls RenderStage::Resize(..) which resizes any image registered to mImageOutputs, calls ApiCreateOrUpdateDescriptors() afterwards.
 
virtual void Destroy () override
 Calls ApiDestroyRtPipeline(), mPipelineLayout.Destroy(), ApiDestroyDescriptors(), ApiCustomObjectsDestroy() and DestroyOutputImages() in this order.
 
- Public Member Functions inherited from foray::stages::RenderStage
 RenderStage ()=default
 
std::vector< core::ManagedImage * > GetImageOutputs ()
 Gets a vector to all color attachments that will be included in a texture array and can be referenced in the shader pass.
 
core::ManagedImageGetImageOutput (std::string_view name, bool noThrow=false)
 Gets an image output.
 
virtual void OnShadersRecompiled (const std::unordered_set< uint64_t > &recompiled)
 Notifies the stage that the shader compiler instance has recompiled a shader.
 
virtual ~RenderStage ()
 

Protected Member Functions

virtual void ApiCreateOutputImages ()
 Inheriting types should setup their Output Images here and push them onto the RenderStage::mImageOutput collection.
 
virtual void ApiCreatePipelineLayout ()=0
 Inheriting types should create mPipelineLayout here (add descriptorsetlayouts, add pushconstants, build)
 
virtual void ApiCreateRtPipeline ()=0
 Inheriting types should create mPipeline here (load shaders, configure sbts, build)
 
virtual void ApiDestroyRtPipeline ()=0
 Destroys mPipeline and all shaders registered to RenderStage::mShaders.
 
virtual void ApiCustomObjectsCreate ()
 Inheriting types may use this function to initialize stage specific objects such as configuration Ubo buffers.
 
virtual void ApiCustomObjectsDestroy ()
 Inheriting types may use this function to destroy options created during ApiCustomObjectsCreate()
 
virtual void ApiCreateOrUpdateDescriptors ()
 Inheriting types should reassign all descriptor bindings and call create / update on descriptor sets.
 
virtual void ApiDestroyDescriptors ()
 Inheriting types should destroy all descriptor sets used here.
 
virtual void ApiRecordFramePrepare (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo)
 Inheriting types should use this for pipeline barriers and stage specific buffer actions.
 
virtual void ApiRecordFrameBind (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo)=0
 Inheriting types should use this to bind the RtPipeline and all descriptor sets.
 
virtual void ApiRecordFrameTraceRays (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo)=0
 Inheriting types should use this to push constants and invoke tracerays.
 
virtual void ReloadShaders () override
 Calls ApiDestroyRtPipeline(), ApiCreateRtPipeline() in this order.
 
- Protected Member Functions inherited from foray::stages::RenderStage
virtual void DestroyOutputImages ()
 Calls Destroy() on any image in mImageOutputs and clears mImageOutputs.
 

Protected Attributes

util::PipelineLayout mPipelineLayout
 The pipeline layout manages descriptorset and pushconstant layouts.
 
rtpipe::RtPipeline mPipeline
 The pipeline manages shader binding tables.
 
- Protected Attributes inherited from foray::stages::RenderStage
std::unordered_map< std::string, core::ManagedImage * > mImageOutputs
 Inheriting types should emplace their images onto this collection to provide them in GetImageOutput interface.
 
std::vector< uint64_t > mShaderKeys
 Inheriting types should emplace their shader keys onto this collection such that if a shader has been recompiled, ReloadShaders() will be called.
 
core::ContextmContext = nullptr
 Context object the renderstage is built upon.
 

Detailed Description

Minimalist setup for a Raytracing Stage.

Features

Inheriting

Member Function Documentation

◆ ApiCreateOrUpdateDescriptors()

virtual void foray::stages::MinimalRaytracingStageBase::ApiCreateOrUpdateDescriptors ( )
inlineprotectedvirtual

Inheriting types should reassign all descriptor bindings and call create / update on descriptor sets.

◆ ApiCreateOutputImages()

virtual void foray::stages::MinimalRaytracingStageBase::ApiCreateOutputImages ( )
inlineprotectedvirtual

Inheriting types should setup their Output Images here and push them onto the RenderStage::mImageOutput collection.

◆ ApiCreatePipelineLayout()

virtual void foray::stages::MinimalRaytracingStageBase::ApiCreatePipelineLayout ( )
protectedpure virtual

Inheriting types should create mPipelineLayout here (add descriptorsetlayouts, add pushconstants, build)

◆ ApiCreateRtPipeline()

virtual void foray::stages::MinimalRaytracingStageBase::ApiCreateRtPipeline ( )
protectedpure virtual

Inheriting types should create mPipeline here (load shaders, configure sbts, build)

◆ ApiCustomObjectsCreate()

virtual void foray::stages::MinimalRaytracingStageBase::ApiCustomObjectsCreate ( )
inlineprotectedvirtual

Inheriting types may use this function to initialize stage specific objects such as configuration Ubo buffers.

◆ ApiCustomObjectsDestroy()

virtual void foray::stages::MinimalRaytracingStageBase::ApiCustomObjectsDestroy ( )
inlineprotectedvirtual

Inheriting types may use this function to destroy options created during ApiCustomObjectsCreate()

◆ ApiDestroyDescriptors()

virtual void foray::stages::MinimalRaytracingStageBase::ApiDestroyDescriptors ( )
inlineprotectedvirtual

Inheriting types should destroy all descriptor sets used here.

◆ ApiDestroyRtPipeline()

virtual void foray::stages::MinimalRaytracingStageBase::ApiDestroyRtPipeline ( )
protectedpure virtual

Destroys mPipeline and all shaders registered to RenderStage::mShaders.

◆ ApiRecordFrameBind()

virtual void foray::stages::MinimalRaytracingStageBase::ApiRecordFrameBind ( VkCommandBuffer  cmdBuffer,
base::FrameRenderInfo renderInfo 
)
protectedpure virtual

Inheriting types should use this to bind the RtPipeline and all descriptor sets.

◆ ApiRecordFramePrepare()

virtual void foray::stages::MinimalRaytracingStageBase::ApiRecordFramePrepare ( VkCommandBuffer  cmdBuffer,
base::FrameRenderInfo renderInfo 
)
inlineprotectedvirtual

Inheriting types should use this for pipeline barriers and stage specific buffer actions.

◆ ApiRecordFrameTraceRays()

virtual void foray::stages::MinimalRaytracingStageBase::ApiRecordFrameTraceRays ( VkCommandBuffer  cmdBuffer,
base::FrameRenderInfo renderInfo 
)
protectedpure virtual

Inheriting types should use this to push constants and invoke tracerays.

◆ Destroy()

virtual void foray::stages::MinimalRaytracingStageBase::Destroy ( )
overridevirtual

Calls ApiDestroyRtPipeline(), mPipelineLayout.Destroy(), ApiDestroyDescriptors(), ApiCustomObjectsDestroy() and DestroyOutputImages() in this order.

Reimplemented from foray::stages::RenderStage.

◆ Init()

void foray::stages::MinimalRaytracingStageBase::Init ( core::Context context)

◆ RecordFrame()

virtual void foray::stages::MinimalRaytracingStageBase::RecordFrame ( VkCommandBuffer  cmdBuffer,
base::FrameRenderInfo renderInfo 
)
overridevirtual

◆ ReloadShaders()

virtual void foray::stages::MinimalRaytracingStageBase::ReloadShaders ( )
overrideprotectedvirtual

Calls ApiDestroyRtPipeline(), ApiCreateRtPipeline() in this order.

Reimplemented from foray::stages::RenderStage.

◆ Resize()

virtual void foray::stages::MinimalRaytracingStageBase::Resize ( const VkExtent2D &  extent)
overridevirtual

Calls RenderStage::Resize(..) which resizes any image registered to mImageOutputs, calls ApiCreateOrUpdateDescriptors() afterwards.

Parameters
extentNew render extent

Reimplemented from foray::stages::RenderStage.

Member Data Documentation

◆ mPipeline

rtpipe::RtPipeline foray::stages::MinimalRaytracingStageBase::mPipeline
protected

The pipeline manages shader binding tables.

◆ mPipelineLayout

util::PipelineLayout foray::stages::MinimalRaytracingStageBase::mPipelineLayout
protected

The pipeline layout manages descriptorset and pushconstant layouts.


The documentation for this class was generated from the following file: