SpiecsEngine
 
Loading...
Searching...
No Matches
Spices::RayTracingRenderer Class Reference

RayTracingRenderer Class. This class defines the ray tracing behaves. More...

#include <RayTracingRenderer.h>

Inheritance diagram for Spices::RayTracingRenderer:
Spices::Renderer

Public Member Functions

 RayTracingRenderer (const std::string &rendererName, VulkanState &vulkanState, const std::shared_ptr< VulkanDescriptorPool > &descriptorPool, const std::shared_ptr< VulkanDevice > &device, const std::shared_ptr< RendererResourcePool > &rendererResourcePool)
 Constructor Function. Init member variables.
 
virtual ~RayTracingRenderer () override
 Destructor Function.
 
virtual void Render (TimeStep &ts, FrameInfo &frameInfo) override
 The interface is inherited from Renderer.
 
virtual void OnSystemInitialize ()
 This interface is called on render system is registered. Initialize the specific renderer's pipeline, render pass. framebuffer, descriptor, and so on...
 
virtual void OnWindowResizeOver ()
 This interface is called on Window resized over (registry by swapchain). If the specific renderer uses swapchain image attachment during CreateRenderPass(), this interface needs to override, callOnSlateResize here just will be fine.
 
virtual void OnSlateResize ()
 
void RegistryMaterial (const std::string &materialName, const std::string &subPassName)
 Registry material to Specific Renderer.
 
void RegistryDGCPipeline (const std::string &materialName, const std::string &subPassName, VulkanDeviceGeneratedCommandsNV *indirectPtr)
 Registry dgc pipeline to Specific Renderer.
 
template<typename T >
std::shared_ptr< VulkanDeviceGeneratedCommandsNVFillIndirectRenderData (const std::string &subPassName, std::shared_ptr< std::vector< uint32_t > > view)
 Fill in World RenderAble data to IndirectBuffer.
 
template<typename T >
std::shared_ptr< std::vector< uint32_t > > GetEntityWithComponent (World *world)
 Get entities with component in world.
 
std::shared_ptr< RendererPass > & GetPasses ()
 Get RendererPass.
 
std::shared_ptr< MaterialGetDefaultMaterial (const std::string &subPassName) const
 Get default material using sub pass Name.
 
template<typename F >
void IterStatistics (F &&func)
 Iterator the specific RenderPass Statistics in Renderer.
 
void ResetRendererState ()
 Reset Renderer State to disActive.
 

Static Public Member Functions

static VkAccelerationStructureKHR GetAccelerationStructure ()
 Get RayTracing AccelerationStructure.
 

Static Public Attributes

static std::shared_ptr< scl::behave_state_list< void, Renderer::RenderBehaveBuilder *, VkCommandBuffer > > m_StatisticsStateList
 Statistics StateList.
 

Protected Member Functions

virtual void CreateDeviceGeneratedCommandsLayout ()
 This interface is called during OnSystemInitialize(). Create Device Generated Commands Layout.
 
void CreateDefaultMaterial ()
 Create Specific Renderer Default Material.
 
void CreateDGCMaterial (const std::string &subPass, VulkanDeviceGeneratedCommandsNV *indirectPtr)
 Create Specific Renderer DGC Material.
 
VkPipelineLayout CreatePipelineLayout (const std::vector< VkDescriptorSetLayout > &rowSetLayouts, const std::shared_ptr< RendererSubPass > &subPass) const
 Create Pipeline Layout with material's descriptorset and renderer's descriptor set.
 
virtual void CreateDeviceGeneratedCommandsPipeline (const std::string &pipelineName, const std::string &materialName, VkPipelineLayout &layout, std::shared_ptr< RendererSubPass > subPass, VulkanDeviceGeneratedCommandsNV *indirectPtr)
 Create device generated command Pipeline.
 
template<typename F >
std::future< VkCommandBuffer > SubmitCmdsParallel (VkCommandBuffer primaryCmdBuffer, uint32_t subPass, F &&func)
 Submit a group of commands to secondary command buffer, and execute all of them.
 
template<typename T , typename F >
void IterWorldComp (FrameInfo &frameInfo, F func)
 Iterator the specific Component in World.
 
template<typename T , typename F >
void IterWorldCompWithBreak (FrameInfo &frameInfo, F func)
 Iterator the specific Component in World With break.
 
template<typename T , typename F >
void IterWorldCompWithRange (FrameInfo &frameInfo, const std::vector< uint32_t > &ranges, F func)
 Iterator the specific Component in World With range.
 
template<typename T , typename F >
void IterWorldCompWithRange (FrameInfo &frameInfo, const std::vector< uint32_t > &ranges, uint32_t floor, uint32_t ceil, F func)
 Iterator the specific Component in World With range.
 
template<typename T , typename F >
void IterWorldCompWithBreakWithRange (FrameInfo &frameInfo, const std::vector< uint32_t > &ranges, F func)
 Iterator the specific Component in World With break With range.
 
template<typename T , typename F >
void IterWorldCompWithBreakWithRange (FrameInfo &frameInfo, const std::vector< uint32_t > &ranges, uint32_t floor, uint32_t ceil, F func)
 Iterator the specific Component in World With break With range.
 
std::tuple< glm::mat4, glm::mat4, unsigned int, float > GetActiveCameraMatrix (FrameInfo &frameInfo)
 Get The activated camera entity's view matrix and projection matrix.
 
void GetDirectionalLight (FrameInfo &frameInfo, std::array< SpicesShader::DirectionalLight, SpicesShader::DIRECTIONALLIGHT_BUFFER_MAXNUM > &dLightBuffer)
 Get DirectionalLightComponent's render data in World.
 
void GetDirectionalLightMatrix (FrameInfo &frameInfo, std::array< glm::mat4, MAX_DIRECTIONALLIGHT_NUM > &directionalLight)
 
void GetPointLight (FrameInfo &frameInfo, std::array< SpicesShader::PointLight, SpicesShader::POINTLIGHT_BUFFER_MAXNUM > &pLightBuffer)
 Get PointLightComponent's render data in World.
 

Protected Attributes

VulkanStatem_VulkanState
 This variable is passed while renderer instanced.
 
std::shared_ptr< VulkanDescriptorPoolm_DescriptorPool
 This variable is passed while renderer instanced.
 
std::shared_ptr< VulkanDevicem_Device
 VulkanDevice , Passed by instanced.
 
std::shared_ptr< RendererResourcePoolm_RendererResourcePool
 RendererResourcePool, Passed by instanced.
 
std::shared_ptr< RendererPassm_Pass
 RendererPass.
 
std::string m_RendererName
 Specific renderer name, Passed by instanced.
 
scl::thread_unordered_map< std::string, std::shared_ptr< VulkanPipeline > > m_Pipelines
 Renderer stored material pipelines.
 
DescriptorSetManager::DescriptorSetCombineFlags m_DescriptorSetCombine
 Combination of DescriptorSet.
 
bool m_IsLoadDefaultMaterial
 Whether should load a default renderer material.
 
bool m_IsActive
 Whether this renderer is active(submit commands in RendererBehaveBuilder).
 
std::unordered_map< std::string, std::shared_ptr< VulkanDeviceGeneratedCommandsNV > > m_DGCData
 Data of dgc DGC Draw.
 
std::shared_ptr< RendererCachem_RenderCache
 RendererCache.
 

Private Member Functions

virtual void CreateRendererPass () override
 The interface is inherited from Renderer. Create specific render pass.
 
virtual void CreateDescriptorSet () override
 The interface is inherited from Renderer. Create specific descriptor set for sub pass.
 
virtual void OnMeshAddedWorld () override
 
virtual void CreatePipeline (std::shared_ptr< Material > material, VkPipelineLayout &layout, std::shared_ptr< RendererSubPass > subPass) override
 The interface is inherited from Renderer. Create Material Specific Pipeline.
 
void CreateBottomLevelAS (FrameInfo &frameInfo, std::shared_ptr< std::vector< uint32_t > > view, std::shared_ptr< VulkanRayTracing > rayTracingInstance)
 Create BottomLevelAS with all MeshComponents.
 
void CreateTopLevelAS (FrameInfo &frameInfo, std::shared_ptr< std::vector< uint32_t > > view, std::shared_ptr< VulkanRayTracing > rayTracingInstance, bool update=false)
 Create TopLevelAS.
 
void UpdateTopLevelAS (FrameInfo &frameInfo, std::shared_ptr< VulkanRayTracing > rayTracingInstance, bool update=true)
 Update TopLevelAS.
 
void CreateRTShaderBindingTable (std::shared_ptr< VulkanRayTracing > rayTracingInstance)
 Create Shader Binding Table.
 
std::shared_ptr< std::unordered_map< std::string, uint32_t > > GetHitGroupsCache ()
 Get HitGroupsCache.
 
void SetHitGroupsCache (std::shared_ptr< std::unordered_map< std::string, uint32_t > > cache)
 Set HitGroupsCache.
 

Private Attributes

std::shared_ptr< std::unordered_map< std::string, uint32_t > > m_HitGroupsCache
 Hit groups cached data.
 

Static Private Attributes

static std::shared_ptr< VulkanRayTracingm_VulkanRayTracing = nullptr
 In Used VulkanRayTracing.
 

Detailed Description

RayTracingRenderer Class. This class defines the ray tracing behaves.

Definition at line 38 of file RayTracingRenderer.h.


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