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

Displays two images of any type next to each other, and get a "pipette" readout at the mouse location. More...

#include <foray_comparerstage.hpp>

Inheritance diagram for foray::stages::ComparerStage:
foray::stages::RenderStage

Classes

struct  InputInfo
 Argument struct for setting inputs. More...
 
struct  PipetteValue
 
struct  PushConstant
 
struct  SubStage
 Value between 0...1 defining the split value. More...
 

Public Types

enum class  EInputType { Float , Int , Uint }
 

Public Member Functions

virtual void Init (core::Context *context, bool flipY)
 Inits the comparer stage. SetInput() calls afterwards are required for function.
 
virtual void RecordFrame (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo) override
 Pipeline barriers and compute shader dispatches.
 
virtual void HandleEvent (const osi::Event *event)
 If called the comparer stage will filter for MouseMoved events to update the pipette value returned.
 
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.
 
virtual void SetInput (uint32_t index, const InputInfo &input)
 Set the input.
 
- 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 ()
 

Static Public Attributes

static constexpr std::string_view OutputName = "Comparer.Out"
 Image output name.
 

Protected Member Functions

void CreateSubStage (SubStage &substage)
 
void DispatchSubStage (SubStage &substage, VkCommandBuffer buffer, base::FrameRenderInfo &renderInfo)
 
void DestroySubStage (SubStage &substage, bool final)
 
void CreateOutputImage ()
 
void LoadShaders ()
 
void CreatePipetteBuffer ()
 
- 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

std::array< SubStage, 2 > mSubStages
 
core::ManagedImage mOutput
 
core::ManagedBuffer mPipetteBuffer
 
void * mPipetteMap = nullptr
 
PipetteValue mPipetteValue
 
std::array< core::ShaderModule, 3 > mShaders
 
fp32_t mMixValue = 0.5
 
glm::ivec2 mMousePos = {}
 
bool mFlipY = false
 
- 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

Displays two images of any type next to each other, and get a "pipette" readout at the mouse location.

Member Enumeration Documentation

◆ EInputType

Enumerator
Float 
Int 
Uint 

Member Function Documentation

◆ CreateOutputImage()

void foray::stages::ComparerStage::CreateOutputImage ( )
protected

◆ CreatePipetteBuffer()

void foray::stages::ComparerStage::CreatePipetteBuffer ( )
protected

◆ CreateSubStage()

void foray::stages::ComparerStage::CreateSubStage ( SubStage substage)
protected

◆ Destroy()

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

Destroy the render stage. Finalizes all components.

Reimplemented from foray::stages::RenderStage.

◆ DestroySubStage()

void foray::stages::ComparerStage::DestroySubStage ( SubStage substage,
bool  final 
)
protected

◆ DispatchSubStage()

void foray::stages::ComparerStage::DispatchSubStage ( SubStage substage,
VkCommandBuffer  buffer,
base::FrameRenderInfo renderInfo 
)
protected

◆ HandleEvent()

virtual void foray::stages::ComparerStage::HandleEvent ( const osi::Event event)
virtual

If called the comparer stage will filter for MouseMoved events to update the pipette value returned.

◆ Init()

virtual void foray::stages::ComparerStage::Init ( core::Context context,
bool  flipY 
)
virtual

Inits the comparer stage. SetInput() calls afterwards are required for function.

◆ LoadShaders()

void foray::stages::ComparerStage::LoadShaders ( )
protected

◆ RecordFrame()

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

Pipeline barriers and compute shader dispatches.

Reimplemented from foray::stages::RenderStage.

◆ Resize()

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

Default implementation accesses mImageOutputs and calls ManagedImage::Resize(extent) on any set image.

Parameters
extentNew render size
Remarks
Inheriting stages may override to update descriptor sets

Reimplemented from foray::stages::RenderStage.

◆ SetInput()

virtual void foray::stages::ComparerStage::SetInput ( uint32_t  index,
const InputInfo input 
)
virtual

Set the input.

Parameters
index0 == left, 1 == right
inputImage Input information

Member Data Documentation

◆ mFlipY

bool foray::stages::ComparerStage::mFlipY = false
protected

◆ mMixValue

fp32_t foray::stages::ComparerStage::mMixValue = 0.5
protected

◆ mMousePos

glm::ivec2 foray::stages::ComparerStage::mMousePos = {}
protected

◆ mOutput

core::ManagedImage foray::stages::ComparerStage::mOutput
protected

◆ mPipetteBuffer

core::ManagedBuffer foray::stages::ComparerStage::mPipetteBuffer
protected

◆ mPipetteMap

void* foray::stages::ComparerStage::mPipetteMap = nullptr
protected

◆ mPipetteValue

PipetteValue foray::stages::ComparerStage::mPipetteValue
protected

◆ mShaders

std::array<core::ShaderModule, 3> foray::stages::ComparerStage::mShaders
protected

◆ mSubStages

std::array<SubStage, 2> foray::stages::ComparerStage::mSubStages
protected

◆ OutputName

constexpr std::string_view foray::stages::ComparerStage::OutputName = "Comparer.Out"
inlinestaticconstexpr

Image output name.


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