|
Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
|
Utilizes rasterization to render a GBuffer output. More...
#include <foray_gbuffer.hpp>
Classes | |
| struct | PerImageInfo |
Public Types | |
| enum class | EOutput { Position , Normal , Albedo , Motion , MaterialIdx , MeshInstanceIdx , LinearZ , Depth , MaxEnum } |
Public Member Functions | |
| GBufferStage ()=default | |
| virtual void | Init (core::Context *context, scene::Scene *scene, std::string_view vertexShaderPath="", std::string_view fragmentShaderPath="", bench::DeviceBenchmark *benchmark=nullptr) |
| virtual void | RecordFrame (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo) override |
| Records a frame to cmdBuffer. | |
| virtual void | Resize (const VkExtent2D &extent) override |
| Default implementation accesses mImageOutputs and calls ManagedImage::Resize(extent) on any set image. | |
| virtual void | Destroy () override |
| Destroy the render stage. Finalizes all components. | |
| core::ManagedImage * | GetImageEOutput (EOutput output, bool noThrow=false) |
Public Member Functions inherited from foray::stages::RasterizedRenderStage | |
| RasterizedRenderStage ()=default | |
| virtual void | UpdateDescriptors () |
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::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 Public Attributes | |
| static constexpr std::string_view | PositionOutputName = "Gbuf.Position" |
| static constexpr std::string_view | NormalOutputName = "Gbuf.Normal" |
| static constexpr std::string_view | AlbedoOutputName = "Gbuf.Albedo" |
| static constexpr std::string_view | MotionOutputName = "Gbuf.Motion" |
| static constexpr std::string_view | MaterialIdxOutputName = "Gbuf.MaterialIdx" |
| static constexpr std::string_view | MeshInstanceIdOutputName = "Gbuf.MeshInstanceIdx" |
| static constexpr std::string_view | LinearZOutputName = "Gbuf.LinearZ" |
| static constexpr std::string_view | DepthOutputName = "Gbuf.Depth" |
Protected Member Functions | |
| virtual void | DestroyFrameBufferAndRenderpass () |
| void | CreateImages () |
| void | PrepareRenderpass () |
| virtual void | SetupDescriptors () override |
| virtual void | CreateDescriptorSets () override |
| virtual void | CreatePipelineLayout () override |
| void | CreatePipeline () |
Protected Member Functions inherited from foray::stages::RenderStage | |
| virtual void | ReloadShaders () |
| Override this to reload all shaders and rebuild pipelines after a registered shader has been recompiled. | |
| virtual void | DestroyOutputImages () |
| Calls Destroy() on any image in mImageOutputs and clears mImageOutputs. | |
Protected Attributes | |
| scene::Scene * | mScene |
| std::array< PerImageInfo,(size_t) EOutput::MaxEnum > | mImageInfos |
| std::string | mVertexShaderPath = "" |
| std::string | mFragmentShaderPath = "" |
| core::ShaderModule | mVertexShaderModule |
| core::ShaderModule | mFragmentShaderModule |
| bench::DeviceBenchmark * | mBenchmark = nullptr |
Protected Attributes inherited from foray::stages::RasterizedRenderStage | |
| VkFramebuffer | mFrameBuffer = nullptr |
| VkRenderPass | mRenderpass = nullptr |
| core::DescriptorSet | mDescriptorSet |
| VkPipeline | mPipeline = nullptr |
| util::PipelineLayout | mPipelineLayout |
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::Context * | mContext = nullptr |
| Context object the renderstage is built upon. | |
Static Protected Attributes | |
| static const char * | TIMESTAMP_VERT_BEGIN = "Vertex Begin" |
| static const char * | TIMESTAMP_VERT_END = "Vertex End" |
| static const char * | TIMESTAMP_FRAG_BEGIN = "Fragment Begin" |
| static const char * | TIMESTAMP_FRAG_END = "Fragment End" |
Utilizes rasterization to render a GBuffer output.
|
strong |
|
default |
|
overrideprotectedvirtual |
Reimplemented from foray::stages::RasterizedRenderStage.
|
protected |
|
protected |
|
overrideprotectedvirtual |
Reimplemented from foray::stages::RasterizedRenderStage.
|
overridevirtual |
Destroy the render stage. Finalizes all components.
Reimplemented from foray::stages::RenderStage.
|
protectedvirtual |
| core::ManagedImage * foray::stages::GBufferStage::GetImageEOutput | ( | EOutput | output, |
| bool | noThrow = false |
||
| ) |
|
virtual |
| scene | Scene required for transforms, vertex/index buffers, materials, textures, ... |
| vertexShaderPath | (optional) override with a custom vertex shader |
| fragmentShaderPath | (optional) override with a custom fragment shader |
| benchmark | (optional) enable benchmarking by passing a devicebenchmark object here |
|
protected |
|
overridevirtual |
Records a frame to cmdBuffer.
| cmdBuffer | Command buffer to record to |
| renderInfo | Additional information about the current frame being rendered |
Reimplemented from foray::stages::RenderStage.
|
overridevirtual |
Default implementation accesses mImageOutputs and calls ManagedImage::Resize(extent) on any set image.
| extent | New render size |
Reimplemented from foray::stages::RenderStage.
|
overrideprotectedvirtual |
Reimplemented from foray::stages::RasterizedRenderStage.
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
protected |
|
inlinestaticconstexpr |
|
protected |
|
protected |
|
protected |
|
inlinestaticconstexpr |
|
protected |
|
protected |
|
protected |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |