Extended version of MinimalRaytracingStageBase limited to a single output image, descriptorset but providing built in support for scene (Camera, Tlas, Geometry, Materials), EnvironmentMap and Noise Texture.
More...
#include <foray_defaultraytracingstage.hpp>
|
void | Init (core::Context *context, scene::Scene *scene, core::CombinedImageSampler *envMap=nullptr, core::ManagedImage *noiseImage=nullptr) |
| Nominal init for DefaultRaytracingStageBase.
|
|
virtual void | RecordFrame (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo) override |
| Calls RecordFramePrepare(), RecordFrameBind(), RecordFrameTraceRays() in this order.
|
|
virtual void | Resize (const VkExtent2D &extent) override |
| Calls RenderStage::Resize(..) which resizes any image registered to mImageOutputs, calls CreateOrUpdateDescriptors() afterwards.
|
|
virtual void | Destroy () override |
| Calls ApiDestroyRtPipeline(), mPipelineLayout.Destroy(), DestroyDescriptors(), ApiCustomObjectsDestroy() and DestroyOutputImages() in this order.
|
|
core::ManagedImage * | GetRtOutput () |
|
| 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::ManagedImage * | GetImageOutput (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 () |
|
|
static constexpr std::string_view | OutputName = "Rt.Output" |
| Image Output of the Raytracing Stage.
|
|
Extended version of MinimalRaytracingStageBase limited to a single output image, descriptorset but providing built in support for scene (Camera, Tlas, Geometry, Materials), EnvironmentMap and Noise Texture.
Features
- Fully setup descriptorset
- Pipeline Barriers
- Binding Pipeline and DescriptorSet
- Automatically resized output image
- uint (32bit) seed value provided via push constant (offset adjustable via mRngSeedPushCOffset. Disable entirely by setting to ~0U)
Inheriting
◆ ApiCreateRtPipeline()
virtual void foray::stages::DefaultRaytracingStageBase::ApiCreateRtPipeline |
( |
| ) |
|
|
protectedpure virtual |
Inheriting types should create mPipeline here (load shaders, configure sbts, build)
◆ ApiCustomObjectsCreate()
virtual void foray::stages::DefaultRaytracingStageBase::ApiCustomObjectsCreate |
( |
| ) |
|
|
inlineprotectedvirtual |
Inheriting types may use this function to initialize stage specific objects such as configuration Ubo buffers.
◆ ApiCustomObjectsDestroy()
virtual void foray::stages::DefaultRaytracingStageBase::ApiCustomObjectsDestroy |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ ApiDestroyRtPipeline()
virtual void foray::stages::DefaultRaytracingStageBase::ApiDestroyRtPipeline |
( |
| ) |
|
|
protectedpure virtual |
Destroys mPipeline and all shaders registered to RenderStage::mShaders.
◆ CreateOrUpdateDescriptors()
virtual void foray::stages::DefaultRaytracingStageBase::CreateOrUpdateDescriptors |
( |
| ) |
|
|
protectedvirtual |
Creates a fully populated descriptorset. See rtbindpoints and shaders/rt_common/bindpoints.glsl.
◆ CreateOutputImages()
virtual void foray::stages::DefaultRaytracingStageBase::CreateOutputImages |
( |
| ) |
|
|
protectedvirtual |
Initializes mOutput.
mOutput initialized as rgba32f with Swapchains extent and usage flags VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
◆ CreatePipelineLayout()
virtual void foray::stages::DefaultRaytracingStageBase::CreatePipelineLayout |
( |
| ) |
|
|
protectedvirtual |
Creates Pipeline layout with mDescriptorSets layout and an optional single uint pushconstant (see mRngSeedPushCOffset)
◆ Destroy()
virtual void foray::stages::DefaultRaytracingStageBase::Destroy |
( |
| ) |
|
|
overridevirtual |
◆ DestroyDescriptors()
virtual void foray::stages::DefaultRaytracingStageBase::DestroyDescriptors |
( |
| ) |
|
|
protectedvirtual |
Destroys the descriptor set.
◆ GetRtOutput()
◆ Init()
Nominal init for DefaultRaytracingStageBase.
- Parameters
-
scene | Scene provides Camera, Tlas, Geometry and Materials |
envMap | Environment Map |
noiseImage | Noise Texture |
◆ RecordFrame()
virtual void foray::stages::DefaultRaytracingStageBase::RecordFrame |
( |
VkCommandBuffer |
cmdBuffer, |
|
|
base::FrameRenderInfo & |
renderInfo |
|
) |
| |
|
overridevirtual |
◆ RecordFrameBind()
virtual void foray::stages::DefaultRaytracingStageBase::RecordFrameBind |
( |
VkCommandBuffer |
cmdBuffer, |
|
|
base::FrameRenderInfo & |
renderInfo |
|
) |
| |
|
protectedvirtual |
Bind pipeline and descriptorset.
◆ RecordFramePrepare()
virtual void foray::stages::DefaultRaytracingStageBase::RecordFramePrepare |
( |
VkCommandBuffer |
cmdBuffer, |
|
|
base::FrameRenderInfo & |
renderInfo |
|
) |
| |
|
protectedvirtual |
◆ RecordFrameTraceRays()
virtual void foray::stages::DefaultRaytracingStageBase::RecordFrameTraceRays |
( |
VkCommandBuffer |
cmdBuffer, |
|
|
base::FrameRenderInfo & |
renderInfo |
|
) |
| |
|
protectedvirtual |
Push constant and Trace rays.
◆ ReloadShaders()
virtual void foray::stages::DefaultRaytracingStageBase::ReloadShaders |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ Resize()
virtual void foray::stages::DefaultRaytracingStageBase::Resize |
( |
const VkExtent2D & |
extent | ) |
|
|
overridevirtual |
◆ mDescriptorAccelerationStructureInfo
VkWriteDescriptorSetAccelerationStructureKHR foray::stages::DefaultRaytracingStageBase::mDescriptorAccelerationStructureInfo {} |
|
protected |
DescriptorSet::SetDescriptorAt requires persistent .pNext objects.
◆ mDescriptorSet
Main DescriptorSet & Layout.
◆ mEnvironmentMap
(Optional) Environment Map
◆ mNoiseTexture
(Optional) Noise source image
◆ mOutput
◆ mPipeline
The pipeline manages shader binding tables.
◆ mPipelineLayout
The pipeline layout manages descriptorset and pushconstant layouts.
◆ mRngSeedPushCOffset
uint32_t foray::stages::DefaultRaytracingStageBase::mRngSeedPushCOffset = 0 |
|
protected |
If set to anything other than ~0U a uint push constant containing the current frame idx as a seed value is added.
◆ mScene
scene::Scene* foray::stages::DefaultRaytracingStageBase::mScene = nullptr |
|
protected |
Provides Camera, Tlas, Geometry and Materials.
◆ OutputName
constexpr std::string_view foray::stages::DefaultRaytracingStageBase::OutputName = "Rt.Output" |
|
inlinestaticconstexpr |
Image Output of the Raytracing Stage.
The documentation for this class was generated from the following file: