SpiecsEngine
 
Loading...
Searching...
No Matches
RendererCache.h
Go to the documentation of this file.
1/**
2* @file RendererCache.h
3* @brief The RendererCache Class Definitions.
4* @author Spices.
5*/
6
7#pragma once
8#include "Core/Core.h"
9#include <any>
10
11namespace Spices {
12
13 /**
14 * @brief Caches of Renderer data.
15 * This class treats all stored caches as garbage and actively cleans them up.
16 */
18 {
19 public:
20
21 /**
22 * @brief Constructor Function.
23 */
24 RendererCache() = default;
25
26 /**
27 * @brief Destructor Function.
28 */
29 virtual ~RendererCache()
30 {
32
34 }
35
36 /**
37 * @brief Push a garbage to caches.
38 * @param[in] any anything.
39 */
40 template<typename T>
41 void PushToCaches(T&& any)
42 {
44
45 std::unique_lock<std::mutex> lock(m_Mutex);
46
47 m_Caches.push_back(any);
48 }
49
50 /**
51 * @brief Clear all caches.
52 */
54 {
56
57 std::unique_lock<std::mutex> lock(m_Mutex);
58
59 m_Caches.clear();
60 }
61
62 private:
63
64 /**
65 * @brief Renderer caches data.
66 */
68
69 /**
70 * @brief This caches mutex.
71 */
72 std::mutex m_Mutex;
73 };
74}
#define EVENT_CLASS_TYPE(type)
Defines Event type.
Definition Event.h:74
#define EVENT_CLASS_CATEGORY(category)
Defines Event category.
Definition Event.h:82
static constexpr uint32_t MAX_DIRECTIONALLIGHT_NUM
Definition Renderer.h:46
static constexpr uint32_t MAX_POINTLIGHT_MUN
Definition Renderer.h:47
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
#define SPICES_PROFILE_VK_ZONE(cmdbuf, name)
#define SPICES_PROFILE_FRAME
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
Definition VulkanUtils.h:68
virtual ~Application()
Destructor Function.
Application()
Constructor Function.
static void Run()
Run Our World.
Application Class. Our Engine Start here.
Definition Application.h:20
Console Entity Class.
Definition Console.h:82
static void UnLoadAll()
Forcing UnLoad all VulkanDescriptorSet.
DescriptorSetCombineBits
DescriptorSetCombine types.
static DescriptorSetInfo & GetByName(const String2 &name)
Get a DescriptorSetInfo by owner's name.
static DescriptorSetInfo & GetByName(const std::string &name)
Get a DescriptorSetInfo by owner's name.
virtual ~DescriptorSetManager()=default
Destructor Function.
static void UnLoadForce(const String2 &name)
Forcing UnLoad a VulkanDescriptorSet.
static std::shared_ptr< VulkanDescriptorSet > Registry(const String2 &name, uint32_t set)
Registry a VulkanDescriptorSet, create one if find none.
static void UnLoad(const String2 &name)
UnLoad a VulkanDescriptorSet.
DescriptorSetManager()=default
Constructor Function.
static void UnLoad(const std::string &name)
UnLoad a VulkanDescriptorSet.
static std::shared_ptr< VulkanDescriptorSet > Registry(const std::string &name, uint32_t set)
Registry a VulkanDescriptorSet, create one if find none.
static std::mutex m_Mutex
Mutex of this DescriptorSetManager.
static DescriptorManagerContainer m_DescriptorSets
The container of all descriptor sets, identified with owner's name and set number.
static void UnLoadForce(const std::string &name)
Forcing UnLoad a VulkanDescriptorSet.
This Class manages all descriptor sets this project.
Entity Class. This class defines the specific behaves of Entity.
Definition Entity.h:20
This Class is the basic Event Class. Inherit from it and create specific event class.
Definition Event.h:96
uint32_t m_PickMaterial
Identify of selected material.
Definition FrameInfo.h:89
FrameInfo(const FrameInfo &)=delete
Copy Constructor Function.
uint32_t m_FrameIndex
FrameIndex, varying during 0 - (MaxFrameInFlight - 1). Used almost anywhere.
Definition FrameInfo.h:69
FrameInfo & operator=(const FrameInfo &)=delete
Copy Assignment Operation.
virtual ~FrameInfo()=default
Destructor Function.
static FrameInfo & Get()
Get FrameInfo.
Definition FrameInfo.cpp:14
std::shared_ptr< World > m_World
The shared pointer of specific world.
Definition FrameInfo.h:94
scl::linked_unordered_map< int, std::string > m_PickEntityID
Definition FrameInfo.h:82
RendererType m_RendererType
The renderer type of current world.
Definition FrameInfo.h:99
FrameInfo()=default
Constructor Function.
uint32_t m_ImageIndex
ImageIndex, varying during 0 - (MaxFrameInFlight - 1). Used in swapchain index and framebuffer index.
Definition FrameInfo.h:75
FrameInfo Class. This class defines the FrameInfo data.
Definition FrameInfo.h:32
static void DrawTreeTitle(const std::string &treeName, std::function< void()> optionFunc, std::function< void()> treeFunc)
Draw a stylized tree title bar.
The ImGuiH Class. This class defines helper function for slate render.
Definition ImguiHelper.h:61
std::shared_ptr< Console > m_Console
The shared pointer of Console.
virtual ~ImguiConsole() override=default
Destructor Function.
bool m_EnableCmdInput
The boolean of enable Cmd Input.
ImguiConsole(const std::string &panelName, FrameInfo &frameInfo, std::shared_ptr< Console > console)
Constructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
ImGuiTextFilter m_Filter
The Filter of console.
int m_Level
The information level that console show.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
static int TextEditCallbackStub(ImGuiInputTextCallbackData *data)
Input Text Call back function.
The ImguiConsole Class. This class defines how to render a Console.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
ImguiContentBrowser(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual ~ImguiContentBrowser() override=default
Destructor Function.
The ImguiContentBrowser Class. This class defines how to render a Content Browser.
The ImguiCreateEntity Class. This class defines how to render a Create.
The ImguiEdit Class. This class defines how to render a edit menu.
Definition ImguiEdit.h:23
The ImguiFile Class. This class defines how to render a file menu.
Definition ImguiFile.h:18
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
bool OnKeyPressed(KeyPressedEvent &e)
Event Dispatcher target. Registry on Key Resized.
virtual ~ImguiGizmos() override=default
Destructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
Definition ImguiGizmos.h:45
int m_GizmoType
Gizmo Type, Transpose, rotate, scale, universal.
Definition ImguiGizmos.h:84
ImguiSlate * m_Owner
The owner, usually is a ImguiViewport class.
Definition ImguiGizmos.h:79
bool bEnableGizmo
Is Enable Gizmo.
Definition ImguiGizmos.h:89
ImguiGizmos(const std::string &panelName, FrameInfo &frameInfo, ImguiSlate *owner)
Constructor Function.
Definition ImguiGizmos.h:27
bool IsOver() const
Is mouse is over gizmo.
Definition ImguiGizmos.h:63
The ImguiGizmos Class. This class defines how to render a viewport gizmo.
Definition ImguiGizmos.h:18
The ImguiHelp Class. This class defines how to render a Help.
Definition ImguiHelp.h:23
ImguiInfoBar(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
scl::linked_unordered_map< std::string, std::shared_ptr< SlateInfoBar > > m_InfoBars
InfoBar instances.
std::shared_ptr< SlateInfoBar > m_SelectedInfoBar
Selected InfoBar.
void Push(std::shared_ptr< SlateInfoBar > instance)
Add a InfoBar instance to this.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual ~ImguiInfoBar() override=default
Destructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
The ImguiInfoBar Class. This class defines how to render a Operation Panel.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
std::shared_ptr< ImguiCreateEntity > m_Create
std::shared_ptr< ImguiWindow > m_Window
std::shared_ptr< ImguiEdit > m_Edit
The shared pointer of ImguiEdit.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
ImguiMainMenu(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
std::shared_ptr< ImguiHelp > m_Help
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
std::shared_ptr< ImguiFile > m_File
The shared pointer of ImguiFile.
virtual ~ImguiMainMenu() override=default
Destructor Function.
The ImguiMainMenu Class. This class defines how to render a main menu.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
ImguiMaterialPanel(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual ~ImguiMaterialPanel() override=default
Destructor Function.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
The ImguiMaterialPanel Class. This class defines how to render a Material Property.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
virtual ~ImguiOperation() override=default
Destructor Function.
ImguiOperation(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
The ImguiOperation Class. This class defines how to render a Operation Panel.
static void DrawComponent(const std::string &name, Entity entity)
Draw Entity Component on Property Panel.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
ImguiProperty(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
virtual ~ImguiProperty() override=default
Destructor Function.
The ImguiProperty Class. This class defines how to render a Property.
bool m_IsHovered
True if Hovered.
Definition ImguiUtils.h:176
ImVec2 & GetPanelSize()
Get Panel Size.
Definition ImguiUtils.h:114
virtual ~ImguiSlate()=default
Destructor Function.
void Begin(float alpha=1.0f, ImGuiWindowFlags flags=0)
Begin a common slate.
void SetWindowState(bool isSlateOn)
Set Slate is render able or not.
Definition ImguiUtils.h:106
void Begin(const std::string &panelName, float alpha=1.0f, ImGuiWindowFlags flags=0)
Begin a common slate with name.
virtual void OnUpdate(TimeStep &ts)=0
This interface is called on SlateSystem Update.
bool IsHovered() const
Get is IsHovered.
Definition ImguiUtils.h:132
ImVec2 m_PanelPos
This slate's position in desktop.
Definition ImguiUtils.h:156
FrameInfo & m_FrameInfo
The FrameData reference.
Definition ImguiUtils.h:166
void End()
End a slate.
ImVec2 & GetPanelPos()
Get Panel Pos.
Definition ImguiUtils.h:120
ImGuiWindowFlags m_WindowFlags
Flags of this window slate.
Definition ImguiUtils.h:191
ImVec2 m_PanelSize
This slate's size.
Definition ImguiUtils.h:151
virtual void QueryIsResizedThisFrame(const ImVec2 &thisFrameSize)
Query whether viewport is resized this frame.
bool IsResizedThisFrame() const
Get boolean of whether resized this frame.
Definition ImguiUtils.h:138
virtual void OnEvent(Event &event)=0
This interface is called on global event function pointer execute.
ImguiSlate(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function. Init with Slate's name.
Definition ImguiUtils.h:35
virtual void OnRender()=0
This interface is called on SlateRenderer Render.
void LoadSlateIcon(ImTextureID &id, const std::string &iconFile)
Load a Texture from ResourcePool.
bool m_IsResized
Boolean of whether resized this frame.
Definition ImguiUtils.h:186
std::string m_PanelName
This slate's name.
Definition ImguiUtils.h:161
const std::string & GetName() const
Get this panel Name.
Definition ImguiUtils.h:144
bool IsFocused() const
Get is IsFocused.
Definition ImguiUtils.h:126
bool m_IsFocused
True if Focus.
Definition ImguiUtils.h:171
This Class defines the basic behaves of specific slate. When we add an new Slate, we need inherit fro...
Definition ImguiUtils.h:27
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
Definition ImguiStage.h:50
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual ~ImguiStage() override=default
Destructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
Definition ImguiStage.h:40
ImguiStage(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
The ImguiStage Class. This class defines how to render a Stage.
Definition ImguiStage.h:18
uint32_t m_Index
This viewport index.
std::shared_ptr< ImguiViewportToolBar > m_ToolBar
The shared pointer of ImguiGizmos.
std::shared_ptr< ImguiGizmos > m_Gizmos
The shared pointer of ImguiGizmos.
bool OnWindowResizeOver(WindowResizeOverEvent &event) const
Event Dispatcher target. Registry on Windows Resized.
virtual ~ImguiViewport() override=default
Destructor Function.
std::shared_ptr< scl::behave_state_list< void > > m_ToggleStateList
Toggle behave state list.
bool m_IsToggled
True if this slate toggled this frame.
void Toggle() const
Toggle viewport.
bool OnToggleSlate(KeyPressedEvent &event) const
Toggle focused slate.
ImguiViewport(const std::string &panelName, FrameInfo &frameInfo, uint32_t index=0)
Constructor Function.
bool OnSlateResize(SlateResizeEvent &event) const
Event Dispatcher target. Registry on Slate(Viewport) Resized.
virtual void QueryIsResizedThisFrame(const ImVec2 &thisFrameSize) override
Query whether viewport is resized this frame. Clamp min m_panelsize value to 1 here,...
virtual void OnRender() override
This interface is called On SlateRenderer Render.
std::shared_ptr< ImguiFloatingInfo > m_FloatingInfo
The shared pointer of ImguiFloatingInfo.
std::pair< uint32_t, uint32_t > GetMousePosInViewport() const
Get Mouse Position Relative Viewport(Might be negative value).
std::shared_ptr< ImguiGizmos > GetGizmo()
Get Gizmo Shared Pointer.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
std::shared_ptr< SlateImage > m_ViewportContext
SlateImage of SceneColor.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
The ImguiViewport Class. This class defines how to render a viewport.
The ImguiWindow Class. This class defines how to render a window menu.
Definition ImguiWindow.h:33
This Class is inherited from KeyEvent Class.
Definition KeyEvent.h:57
static void Init()
Init Log.
Definition Log.cpp:24
static void ShutDown()
Shutdown Log.
Definition Log.cpp:82
Material Class. This class contains a branch of parameter and shader, also descriptor.
Definition Material.h:62
virtual std::string ToString() const override
Serialize this Event Class to string.
Definition WorldEvent.h:60
MeshAddedWorldEvent()=default
Constructor Function.
virtual ~MeshAddedWorldEvent() override=default
Destructor Function.
This Class is inherited from Event Class.
Definition WorldEvent.h:43
MeshComponent Class. This class defines the specific behaves of MeshComponent.
NativeScriptSystem Class. This class defines the specific behaves of NativeScriptSystem.
static std::shared_ptr< NsightPerfGPUProfilerOneshotCollection > m_NsightPerfGPUProfilerOneshotCollection
This Single Instance.
void BeginRange(VkCommandBuffer cmd, const std::string &name, size_t nestingLevel, uint32_t index)
Begin recording a Oneshot Collection Range.
std::vector< nv::perf::mini_trace::APITracerVulkan > m_ApiTracers
APITracerVulkan Per FlightFrame.
virtual ~NsightPerfGPUProfilerOneshotCollection()=default
Destructor Function.
static NsightPerfGPUProfilerOneshotCollection & Get()
Get this Single Instance.
NsightPerfGPUProfilerOneshotCollection(VulkanState &state)
Constructor Function.
void EndRange(VkCommandBuffer cmd, size_t index)
End recording a Oneshot Collection Range.
nv::perf::sampler::PeriodicSamplerOneShotVulkan m_PeriodicSamplerOneShot
PeriodicSamplerOneShotVulkan.
void BeginFrame(VulkanState &state, VkCommandBuffer commandBuffer)
Begin a Frame.
static void CreateInstance(VulkanState &state)
Create this Single Instance.
std::vector< size_t > m_FrameLevelTraceIndice
FrameLevelTraceIndice.
Wrapper of Nvidia Nsight Performance OneshotCollection.
NVPW_Device_ClockStatus m_ClockStatus
Used to restore clock state when exiting.
static std::shared_ptr< NsightPerfGPUProfilerReportGenerator > m_NsightPerfGPUProfilerReportGenerator
This Single Instance.
virtual ~NsightPerfGPUProfilerReportGenerator()=default
Destructor Function.
void BeginFrame(VkQueue queue, uint32_t queueFamilyIndex)
Begin a Frame. OnFrameStart and OnFrameEnd will not perform any operation until collection is initiat...
void EndFrame(VulkanState &state)
End a Frame. The vkQueueWaitIdle() call in the code sequence above is a workaround for a driver/OS is...
void CollectionNextFrame()
Capture next frame and generate report.
static void CreateInstance(VulkanState &state)
Create this Single Instance.
void PushRange(VkCommandBuffer commandBuffer, const std::string &pRangeName) const
Struct VulkanRangeCommands provides a reliable set of function pointers, that are safe to call on any...
nv::perf::profiler::ReportGeneratorVulkan m_NvPerf
Nvidia Nsight Performance ReportGenerator.
NsightPerfGPUProfilerReportGenerator(VulkanState &state)
Constructor Function.
void PopRange(VkCommandBuffer commandBuffer) const
Pop Range.
static NsightPerfGPUProfilerReportGenerator & Get()
Get this Single Instance.
Wrapper of Nvidia NsightPerf GPU Performance ReportGenerator.
Querier(StatisticsBits type)
Constructor Function.
Definition Querier.h:69
virtual void BeginQuery(VkCommandBuffer commandBuffer)=0
Begin QueryPool.
StatisticsBits
Statistics types.
Definition Querier.h:24
std::unique_ptr< VulkanQueryPool > m_QueryPool
QueryPool of RenderPass.
Definition Querier.h:111
virtual void StorePoolResult()=0
Store QueryPool Result.
std::shared_ptr< Result > m_Result
Result of QueryPool.
Definition Querier.h:116
std::shared_ptr< Querier::Result > GetPoolResult() const
Get QueryPool Stored Result.
Definition Querier.h:98
virtual void EndQuery(VkCommandBuffer commandBuffer)=0
End QueryPool.
StatisticsBits m_Type
Specific Querier Type.
Definition Querier.h:121
StatisticsBits GetStatisticsType() const
Get this Querier type. @reutrn Returns Querier type.
Definition Querier.h:104
uint32_t StatisticsFlags
Definition Querier.h:32
virtual ~Querier()=default
Destructor Function.
Basic interface of Queries.
Definition Querier.h:17
RenderFrontend(const RenderFrontend &)=delete
RenderFrontend & operator=(const RenderFrontend &)=delete
std::unique_ptr< VulkanRenderBackend > m_RenderBackend
void RenderFrame(TimeStep &ts, FrameInfo &frameInfo)
virtual ~RenderFrontend()=default
void BeginFrame(FrameInfo &frameInfo)
void EndFrame(FrameInfo &frameInfo)
void OnEvent(Event &event)
void IterStatisticsResult(Querier::StatisticsFlags flags, F &&fn)
Iter all Statistics Result.
void BeginStatistics(VkCommandBuffer commandBuffer, Querier::StatisticsFlags flags) const
Begin Statistics.
void StoreStatistics() const
Store statistics result.
virtual ~RenderPassStatistics()=default
Destructor Function.
RenderPassStatistics(VulkanState &state, Querier::StatisticsFlags flags)
Constructor Function.
void EndStatistics(VkCommandBuffer commandBuffer, Querier::StatisticsFlags flags) const
End Statistics.
Statistics of RenderPass(Renderer).
virtual void OnSystemInitialize() override
This interface defines the behave on specific system initialized. Called when system Pushed to System...
RenderSystem(const std::string &systemName)
Constructor Function. Init class variable. Usually call it.
virtual void OnSystemUpdate(TimeStep &ts) override
This interface defines the behave on specific system updated every frame.
virtual void OnEvent(Event &event) override
This interface defines the behave on global event function pointer is called.
virtual void OnSystemShutDown() override
This interface defines the behave on specific system shutdown. Called when system poped from SystemMa...
virtual ~RenderSystem() override
Destructor Function.
std::unique_ptr< RenderFrontend > m_RenderFrontend
The RenderFrontend shared pointer.
ResourceSystem Class. This class defines the specific behaves of RenderSystem.
std::vector< std::any > m_Caches
Renderer caches data.
void PushToCaches(T &&any)
Push a garbage to caches.
std::mutex m_Mutex
This caches mutex.
virtual ~RendererCache()
Destructor Function.
RendererCache()=default
Constructor Function.
void ClearCaches()
Clear all caches.
Caches of Renderer data. This class treats all stored caches as garbage and actively cleans them up.
std::shared_ptr< RendererSubPass > AddSubPass(const std::string &subPassName, uint32_t index, Querier::StatisticsFlags flags) const
Add a subp ass to this renderer pass.
uint32_t m_MaxLayers
Max Attachment layer.
scl::linked_unordered_map< std::string, VkAttachmentDescription > m_AttachmentDescriptions
VkAttachmentDescription this RenderPass handled.
uint32_t AddAttachment(const std::string &attachmentName, const VkAttachmentDescription &description, const VkClearValue &clearValue, uint32_t layers, const VkImageView &view)
Add a attachment to this renderer pass.
std::vector< VkImageView > m_ImageViews
VkImageView this RenderPass handled.
bool IsUseSwapChain() const
Determine whether the RendererPass is using swapchain image.
std::shared_ptr< VulkanDevice > m_Device
VulkanDevice.
VkFramebuffer & GetFramebuffer(uint32_t index) const
Get VkFramebuffer by index.
VkRenderPass & Get() const
Get VkRenderPass.
uint32_t AddAttachment(const std::string &attachmentName, const VkAttachmentDescription &description, uint32_t layers, const VkClearValue &clearValue)
Add a attachment to this renderer pass.
std::string m_PassName
RenderPass's name.
std::unique_ptr< VulkanRenderPass > m_RenderPass
VulkanRenderPass this RenderPass handled.
std::vector< VkClearValue > & GetClearValues()
Get ClearValues.
std::shared_ptr< scl::linked_unordered_map< std::string, std::shared_ptr< RendererSubPass > > > m_SubPasses
SubPass this RenderPass handled.
void BuildRendererPass()
Build RenderPass.
std::vector< VkClearValue > m_ClearValues
VkClearValue this RenderPass handled.
RendererPass(const std::string &passName, std::shared_ptr< VulkanDevice > vulkanDevice)
Constructor Function.
std::shared_ptr< scl::linked_unordered_map< std::string, std::shared_ptr< RendererSubPass > > > GetSubPasses()
Get SubPasses held by this renderer pass.
bool m_IsSwapChainImageInUse
True if the RendererPass is using swapchain image.
std::string & GetName()
Get Renderer pass name.
This class is a wrapper of VulkanRenderPass. Used during Renderer.
std::unordered_map< std::string, std::unique_ptr< RendererResource > > m_RendererResource
The hashmap of all RendererResource.
RendererResourcePool(const RendererResourcePool &)=delete
Copy Constructor Function.
VkDescriptorImageInfo * AccessResource(const RendererResourceCreateInfo &info=RendererResourceCreateInfo{}, uint32_t mipLevel=0)
Get Resource with specific name, create it if it have not been created.
void OnSlateResize(uint32_t width, uint32_t height) const
Event Called on Slate resize.
RendererResourcePool()=default
Constructor Function.
RendererResourcePool & operator=(const RendererResourcePool &)=delete
Copy Assignment Operation.
std::shared_ptr< VulkanImage > AccessRowResource(const std::string &name)
Get Row Resource with specific name.
virtual ~RendererResourcePool()=default
Destructor Function.
RendererResourcePool Class. This class is a pool of all framebuffer's attachment.
std::unique_ptr< Texture2D > m_Texture
The texture this class Wrapped.
RendererResourceCreateInfo m_Info
The information of this resource.
RendererResource(const RendererResourceCreateInfo &info)
Constructor Function. Init member variables.
std::unique_ptr< Texture2D > & GetTexture()
Get Texture this class wrapped.
bool IsResizeable() const
Get isResizeable variable.
void OnResized(uint32_t width, uint32_t height)
Called On SwapChain Resized. Event received from VulkanRenderBackEnd.
virtual ~RendererResource()=default
Destructor Function.
bool m_IsResizeable
True if this resource can resize.
RendererResource Class. This class is a wrapper of framebuffer attachment.
void SetBuffer(const UInt2 &i2, void *data, uint64_t size=VK_WHOLE_SIZE, uint64_t offset=0)
Set Buffer data.
std::vector< VkAttachmentReference > m_ColorAttachmentReference
Subpass used color attachment.
void StoreStatistics() const
Store statistics this frame.
std::string m_SubpassName
Sub pass Name.
std::vector< VkSubpassDependency > & GetDependency()
Get a VkSubpassDependency.
void EndStatistics(VkCommandBuffer commandBuffer, Querier::StatisticsFlags flags=Querier::ALL) const
End Statistics this frame.
std::unordered_map< UInt2, std::shared_ptr< VulkanBuffer > > m_Buffers
All Buffers used this sub pass.
std::vector< VkAttachmentReference > m_InputAttachmentReference
Sub pass used input attachment.
void AddInputAttachmentReference(const VkAttachmentReference &attachmentReference)
Add a Input Attachment to sub pass.
void AddSubPassDependency(uint32_t srcsubpass, uint32_t dstsubpass, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask)
Add VkSubpassDependency.
std::shared_ptr< RenderPassStatistics > & GetStatistics()
Get RenderPassStatistics.
std::shared_ptr< VulkanBuffer > & GetBuffers(const UInt2 &i2)
Get a buffer with index.
VkSubpassDescription m_SubPassDescriptions
VkSubpassDescription.
std::vector< VkPipelineColorBlendAttachmentState > & GetColorBlend()
Get VkPipelineColorBlendAttachmentState.
std::vector< VkAttachmentReference > m_DepthAttachmentReference
Sub pass used depth attachment.
uint32_t m_Index
Index of sub pass in pass.
void AddColorAttachmentReference(const VkAttachmentReference &attachmentReference, const VkPipelineColorBlendAttachmentState &colorBlend)
Add a Color Attachment to sub pass.
VkPushConstantRange & GetPushConstant()
Get VkPushConstantRange.
VkSubpassDescription & GetDescription()
Get a VkSubpassDescription.
VkPushConstantRange m_PushConstantRange
VkPushConstantRange.
void AddFirstSubPassDependency()
Add First VkSubpassDependency.
std::vector< VkPipelineColorBlendAttachmentState > m_ColorBlends
Sub pass used VkPipelineColorBlendAttachmentState.
std::vector< VkSubpassDependency > m_SubPassDependency
VkSubpassDependency.
uint32_t GetIndex() const
Get sub pass index of pass.
void BeginStatistics(VkCommandBuffer commandBuffer, Querier::StatisticsFlags flags=Querier::ALL) const
Begin Statistics this frame.
void BuildSubPassDescription()
Build VkSubpassDescription.
void SetPushConstant(T fn)
Set Pipeline PushConstant.
RendererSubPass(const std::string &subPassName, uint32_t index, Querier::StatisticsFlags flags)
Constructor Function.
void AddDepthAttachmentReference(const VkAttachmentReference &attachmentReference)
Add a Depth Attachment to sub pass.
void BuildSubPassDependency(uint32_t index)
Build VkSubpassDependency.
const std::string & GetName()
Get sub pass name.
bool isUsePushConstant
True if sub pass use a PushConstant.
virtual ~RendererSubPass()=default
Destructor Function.
std::shared_ptr< RenderPassStatistics > m_Statistics
Statistics of RenderPass.
bool IsUsePushConstant() const
Get isUsePushConstant.
This Class Combines some data relative to sub pass. Usually as a member variable of RendererPass.
virtual void InternalBarriers(VkBuffer buffer, VkAccessFlags srcAccessMask=VK_ACCESS_SHADER_WRITE_BIT, VkAccessFlags dstAccessMask=VK_ACCESS_SHADER_READ_BIT, VkPipelineStageFlags srcStageMask=VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VkPipelineStageFlags dstStageMask=VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) override
Add a Buffer Barrier from this queue to this queue.
virtual std::shared_ptr< RendererSubPass > & GetStatisticsRendererPass() override
Get RenderPass in statistics. @reutrn Return RenderPass.
Definition Renderer.cpp:893
ComputeRenderBehaveBuilder(Renderer *renderer, uint32_t currentFrame, uint32_t currentImage, const std::array< VkCommandBuffer, MaxFrameInFlight > &cmdBuffers)
Constructor Function. Bind pipeline and all buffer type descriptor set.
virtual void AddBarriers(VkBuffer buffer, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex=VulkanRenderBackend::GetState().m_GraphicQueueFamily, uint32_t dstQueueFamilyIndex=VulkanRenderBackend::GetState().m_ComputeQueueFamily, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) override
Add a Buffer Barrier from graphic queue to this compute queue.
virtual void BindDescriptorSet(const DescriptorSetInfo &infos, const std::string &name, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_COMPUTE) override
Binding DescriptorSet with DescriptorSetInfo and name. For Binding a Material DescriptorSet.
virtual void InternalBarriers(VulkanImage *image, VkAccessFlags srcAccessMask=VK_ACCESS_SHADER_WRITE_BIT, VkAccessFlags dstAccessMask=VK_ACCESS_SHADER_READ_BIT, VkPipelineStageFlags srcStageMask=VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VkPipelineStageFlags dstStageMask=VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) override
Add a Image Barrier from this queue to this queue.
void Dispatch(uint32_t x, uint32_t y, uint32_t z) const
Dispatch Compute Shader.
virtual void ReleaseBarriers(VulkanImage *image, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex=VulkanRenderBackend::GetState().m_ComputeQueueFamily, uint32_t dstQueueFamilyIndex=VulkanRenderBackend::GetState().m_GraphicQueueFamily, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) override
Add a Image Barrier from this compute queue to graphic queue.
virtual void InternalBarriers(VkAccessFlags srcAccessMask=VK_ACCESS_SHADER_WRITE_BIT, VkAccessFlags dstAccessMask=VK_ACCESS_SHADER_READ_BIT, VkPipelineStageFlags srcStageMask=VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VkPipelineStageFlags dstStageMask=VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) override
Add a Memory Barrier from this queue to this queue.
virtual void BeginRenderPass() override
Begin this Renderer's RenderPass.
Definition Renderer.cpp:900
virtual ~ComputeRenderBehaveBuilder() override=default
Destructor Function.
virtual void BindPipeline(const std::string &materialName, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_COMPUTE) override
Bind the pipeline created by CreatePipeline(). Called on RenderBehaveBuilder instanced.
virtual void BindDescriptorSet(const DescriptorSetInfo &infos, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_COMPUTE) override
Binding DescriptorSet with DescriptorSetInfo. For Binding a Renderer DescriptorSet.
virtual void BeginNextSubPass(const std::string &subPassName) override
End a preview sub pass and stat next sub pass.
Definition Renderer.cpp:787
virtual void AddBarriers(VulkanImage *image, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex=VulkanRenderBackend::GetState().m_GraphicQueueFamily, uint32_t dstQueueFamilyIndex=VulkanRenderBackend::GetState().m_ComputeQueueFamily, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) override
Add a Image Barrier from graphic queue to this compute queue.
virtual void ReleaseBarriers(VkBuffer buffer, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex=VulkanRenderBackend::GetState().m_ComputeQueueFamily, uint32_t dstQueueFamilyIndex=VulkanRenderBackend::GetState().m_GraphicQueueFamily, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) override
Add a Buffer Barrier from this compute queue to graphic queue.
virtual void EndRenderPass() override
End this Renderer's RenderPass.
This class helps to bind pipeline and bind buffer. Specific for pure Compute Renderer....
Definition Renderer.h:1739
Renderer * m_Renderer
Specific Renderer pointer. Passed while this class instanced.
Definition Renderer.h:961
DGCLayoutBuilder & AddDrawMeshTaskInput()
Add Draw Mesh Task Command to Input.
DGCLayoutBuilder & AddVertexBufferInput()
Add Binding Vertex Buffer to Input.
std::string m_SubPassName
Specific SubPass Name. Passed while this class instanced.
Definition Renderer.h:967
DGCLayoutBuilder(const std::string &subPassName, Renderer *renderer)
Constructor Function.
std::vector< VkIndirectCommandsLayoutTokenNV > m_InputInfos
Stores command inputs.
Definition Renderer.h:972
DGCLayoutBuilder & AddShaderGroupInput()
Add Binding Shader Group Command to Input.
DGCLayoutBuilder & AddIndexBufferInput()
Add Binding Index Buffer to Input.
DGCLayoutBuilder & AddDrawIndexedInput()
Add Draw Indexed Command to Input.
void Build() const
Create GDC Layout.
virtual ~DGCLayoutBuilder()=default
Destructor Function.
DGCLayoutBuilder & AddPushConstantInput()
Add Binding PushConstant Command to Input.
std::shared_ptr< VulkanDeviceGeneratedCommandsNV > m_HandledDGCData
Current SubPass DGC Data.
Definition Renderer.h:977
This Class is a helper for Building GDC Layout. Only instanced during CreateDeviceGeneratedCommandsLa...
Definition Renderer.h:896
DescriptorSetBuilder & AddAccelerationStructure(uint32_t set, uint32_t binding, VkShaderStageFlags stageFlags)
Add the Acceleration Structure set binding to descriptor set layout.
DescriptorSetBuilder & AddBindLessTexture(uint32_t set, uint32_t binding, VkShaderStageFlags stageFlags, const std::vector< std::string > &textureNames)
Init the BindLess texture set binding to descriptor set layout.
DescriptorSetBuilder & AddTexture(uint32_t set, uint32_t binding, VkShaderStageFlags stageFlags, const std::vector< std::string > &textureNames)
Add the texture set binding to descriptor set layout.
void Build(const VkAccelerationStructureKHR &accel=VK_NULL_HANDLE)
Create all buffer type descriptor set. Create pipeline layout.
std::unordered_map< uint32_t, std::unordered_map< uint32_t, std::vector< VkDescriptorImageInfo > > > m_ImageInfos
DescriptorSet Image type binging info. [set] - [binding] - [info].
Definition Renderer.h:742
String2 m_DescriptorSetId
The Descriptor Set Manager ID descriptorSet belongs to.
Definition Renderer.h:730
std::unordered_map< uint32_t, std::unordered_map< uint32_t, VkDescriptorBufferInfo > > m_BufferInfos
DescriptorSet Buffer type binging info. [set] - [binding] - [info].
Definition Renderer.h:736
virtual ~DescriptorSetBuilder()=default
Destructor Function.
DescriptorSetBuilder & AddStorageBuffer(uint32_t set, uint32_t binding, VkShaderStageFlags stageFlags, std::shared_ptr< VulkanBuffer > buffer)
Add buffer object in collection, and add it's set binding to descriptorsetlayout, and sets descriptor...
DescriptorSetBuilder & AddStorageBuffer(uint32_t set, uint32_t binding, uint64_t size, VkShaderStageFlags stageFlags)
Create local buffer object in collection, and add it's set binding to descriptorsetlayout,...
DescriptorSetBuilder & AddStorageTexture(uint32_t set, uint32_t binding, VkShaderStageFlags stageFlags, const std::vector< std::string > &textureNames, VkFormat format=VK_FORMAT_R8G8B8A8_UNORM, TextureType type=TextureType::Texture2D)
Add the storage texture set binding to descriptor set layout.
DescriptorSetBuilder & AddStorageTextureMipmaps(uint32_t set, uint32_t binding, VkShaderStageFlags stageFlags, const std::string &textureName, VkFormat format=VK_FORMAT_R8G8B8A8_UNORM, TextureType type=TextureType::Texture2D, std::function< void(RendererResourceCreateInfo &)> func=nullptr)
Add the storage texture set binding with mipmap to descriptor set layout.
DescriptorSetBuilder & AddUniformBuffer(uint32_t set, uint32_t binding, uint64_t size, VkShaderStageFlags stageFlags)
Create local buffer object in collection, and add it's set binding to descriptorsetlayout,...
DescriptorSetBuilder(const std::string &subPassName, Renderer *renderer)
Constructor Function.
std::shared_ptr< RendererSubPass > m_HandledSubPass
Handled Sub pass.
Definition Renderer.h:725
DescriptorSetBuilder & AddPushConstant(uint32_t size)
Set VkPushConstantRange by a specific push constant struct.
Renderer * m_Renderer
Specific Renderer pointer. Passed while this class instanced.
Definition Renderer.h:720
DescriptorSetBuilder & AddInput(uint32_t set, uint32_t binding, VkShaderStageFlags stageFlags, const std::vector< std::string > &inputAttachmentNames)
Add the texture set binding to descriptor set layout.
DescriptorSetBuilder & AddAttachmentTexture(uint32_t set, uint32_t binding, VkShaderStageFlags stageFlags, const std::vector< std::string > &textureNames)
Add the attachment as texture to descriptor set layout.
This Class is a helper for Building Specific Renderer DescriptorSet. Only instanced during CreateDesc...
Definition Renderer.h:520
PipelineBuilder & SetBindingDescriptions(const std::vector< VkVertexInputBindingDescription > &inputs)
Set bindingDescriptions.
PipelineBuilder & NullAttributeDescriptions()
Set attributeDescriptions to NULL.
std::shared_ptr< RendererSubPass > m_HandledSubPass
Handled Sub pass.
Definition Renderer.h:883
std::shared_ptr< Material > m_Material
Referenced Material.
Definition Renderer.h:878
PipelineBuilder & SetPipelineLayout(VkPipelineLayout &layout)
Set pipelineLayout to given value.
void Build()
Build Pipeline.
PipelineBuilder & SetDefault()
Set PipelineConfigInfo to default value.
PipelineBuilder(std::shared_ptr< RendererSubPass > subPass, std::shared_ptr< Material > material, Renderer *renderer)
Constructor Function.
Renderer * m_Renderer
Specific Renderer pointer. Passed while this class instanced.
Definition Renderer.h:873
PipelineBuilder & SetAttributeDescriptions(const std::vector< VkVertexInputAttributeDescription > &inputs)
Set attributeDescriptions.
void BuildDeviceGeneratedCommand(const std::string &pipelineName, const std::string &materialName, VulkanDeviceGeneratedCommandsNV *indirectPtr)
Build Raytracing Pipeline.
PipelineBuilder & NullBindingDescriptions()
Set bindingDescriptions to NULL.
PipelineConfigInfo m_pipelineConfig
PipelineConfigInfo for create Pipeline.
Definition Renderer.h:888
virtual ~PipelineBuilder()=default
Destructor Function.
PipelineBuilder & SetColorAttachments()
Set pAttachments to correct value.
void BuildCompute()
Build Compute Pipeline.
PipelineBuilder & SetCullMode(VkCullModeFlags cullMode)
Set cullMode to given value.
PipelineBuilder & SetSubPassIndex()
Set subpass to correct value.
void BuildRayTracing(const std::unordered_map< std::string, uint32_t > &hitGroups)
Build Raytracing Pipeline.
void BuildMesh()
Build Mesh Pipeline.
PipelineBuilder & SetRenderPass()
Set renderPass to correct value..
This Class is a helper for Building Specific Renderer Pipeline. Only instanced during CreatePipeline(...
Definition Renderer.h:750
VulkanRayTracing * m_VulkanRayTracing
Referenced VulkanRayTracing.
Definition Renderer.h:1730
virtual std::shared_ptr< RendererSubPass > & GetStatisticsRendererPass() override
Get RenderPass in statistics. @reutrn Return RenderPass.
virtual void BindDescriptorSetAsync(const DescriptorSetInfo &infos, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) override
Binding DescriptorSet with DescriptorSetInfo Async. For Binding a Renderer DescriptorSet.
void TraceRays(const VkStridedDeviceAddressRegionKHR *rgenRegion, const VkStridedDeviceAddressRegionKHR *missRegion, const VkStridedDeviceAddressRegionKHR *hitRegion, const VkStridedDeviceAddressRegionKHR *callRegion) const
Call vkCmdTraceRaysKHR here.
virtual void EndRenderPass() override
End this Renderer's RenderPass.
virtual void BindDescriptorSet(const DescriptorSetInfo &infos, const std::string &name, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) override
Binding DescriptorSet with DescriptorSetInfo and name. For Binding a Material DescriptorSet.
RayTracingRenderBehaveBuilder(Renderer *renderer, VulkanRayTracing *rayTracing, uint32_t currentFrame, uint32_t currentImage)
Constructor Function. Bind pipeline and all buffer type descriptor set.
void TraceRays() const
Call vkCmdTraceRaysKHR here.
virtual void BindPipeline(VkPipeline pipeline, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) override
Bind the pipeline created by CreatePipeline(). Called on RenderBehaveBuilder instanced.
virtual void BindPipelineAsync(const std::string &materialName, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) override
Bind the pipeline created by CreatePipeline() Async. Called on RenderBehaveBuilder instanced.
void TraceRaysAsync(const VkStridedDeviceAddressRegionKHR *rgenRegion, const VkStridedDeviceAddressRegionKHR *missRegion, const VkStridedDeviceAddressRegionKHR *hitRegion, const VkStridedDeviceAddressRegionKHR *callRegion) const
Call vkCmdTraceRaysKHR here Async.
virtual void BeginRenderPass() override
Begin this Renderer's RenderPass.
virtual void BeginNextSubPass(const std::string &subPassName) override
End a preview sub pass and stat next sub pass.
virtual void BindPipeline(const std::string &materialName, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) override
Bind the pipeline created by CreatePipeline(). Called on RenderBehaveBuilder instanced.
virtual void BindDescriptorSet(const DescriptorSetInfo &infos, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) override
Binding DescriptorSet with DescriptorSetInfo. For Binding a Renderer DescriptorSet.
virtual ~RayTracingRenderBehaveBuilder() override=default
Destructor Function.
virtual void BindDescriptorSetAsync(const DescriptorSetInfo &infos, const std::string &name, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) override
Binding DescriptorSet with DescriptorSetInfo and name Async. For Binding a Material DescriptorSet.
This class helps to bind pipeline and bind buffer. Specific for RayTracing Renderer....
Definition Renderer.h:1558
virtual void InternalBarriers(VkAccessFlags srcAccessMask=VK_ACCESS_SHADER_WRITE_BIT, VkAccessFlags dstAccessMask=VK_ACCESS_SHADER_READ_BIT, VkPipelineStageFlags srcStageMask=VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VkPipelineStageFlags dstStageMask=VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE)
Add a Memory Barrier from this queue to this queue.
std::shared_ptr< VulkanDeviceGeneratedCommandsNV > m_HandledDGCData
Current subPass DGCData.
Definition Renderer.h:1549
virtual void AddBarriers(VkBuffer buffer, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex=VulkanRenderBackend::GetState().m_GraphicQueueFamily, uint32_t dstQueueFamilyIndex=VulkanRenderBackend::GetState().m_ComputeQueueFamily, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE)
Add a Buffer Barrier from compute queue to this graphic queue.
virtual ~RenderBehaveBuilder()=default
Destructor Function.
virtual void BindDescriptorSetAsync(const DescriptorSetInfo &infos, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_GRAPHICS)
Binding DescriptorSet with DescriptorSetInfo Async. For Binding a Renderer DescriptorSet.
uint32_t m_CurrentFrame
Current frame index. Passed while this class instanced.
Definition Renderer.h:1522
virtual void ReleaseBarriers(VulkanImage *image, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex=VulkanRenderBackend::GetState().m_GraphicQueueFamily, uint32_t dstQueueFamilyIndex=VulkanRenderBackend::GetState().m_ComputeQueueFamily, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE)
Add a Image Barrier from this graphic queue to compute queue.
virtual void BindDescriptorSet(const DescriptorSetInfo &infos, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_GRAPHICS)
Binding DescriptorSet with DescriptorSetInfo. For Binding a Renderer DescriptorSet.
virtual std::shared_ptr< RendererSubPass > & GetStatisticsRendererPass()
Get RenderPass in statistics. @reutrn Return RenderPass.
Definition Renderer.cpp:544
void BeginNextSubPassAsync(const std::string &subPassName)
End a preview sub pass and stat next sub pass.
Definition Renderer.cpp:818
uint32_t GetSubPassIndex() const
Get current subPass index in renderPass.
Definition Renderer.h:1507
virtual void BindPipeline(const std::string &materialName, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_GRAPHICS)
Bind the pipeline created by CreatePipeline(). Called on RenderBehaveBuilder instanced.
Definition Renderer.cpp:629
virtual void BindDescriptorSet(const DescriptorSetInfo &infos, const std::string &name, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_GRAPHICS)
Binding DescriptorSet with DescriptorSetInfo and name. For Binding a Material DescriptorSet.
virtual void InternalBarriers(VulkanImage *image, VkAccessFlags srcAccessMask=VK_ACCESS_SHADER_WRITE_BIT, VkAccessFlags dstAccessMask=VK_ACCESS_SHADER_READ_BIT, VkPipelineStageFlags srcStageMask=VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VkPipelineStageFlags dstStageMask=VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE)
Add a Image Barrier from this queue to this queue.
virtual void BindDescriptorSetAsync(const DescriptorSetInfo &infos, const std::string &name, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_GRAPHICS)
Binding DescriptorSet with DescriptorSetInfo and name Async. For Binding a Material DescriptorSet.
void DrawFullScreenTriangleAsync() const
Draw a Triangle full screen Async.
void UpdatePushConstantAsync(void *data) const
Update local push constant buffer Async.
Definition Renderer.h:2602
std::shared_ptr< RendererSubPass > m_HandledSubPass
Handled Sub pass.
Definition Renderer.h:1544
virtual void BeginNextSubPass(const std::string &subPassName)
End a preview sub pass and stat next sub pass.
Definition Renderer.cpp:765
virtual void InternalBarriers(VkBuffer buffer, VkAccessFlags srcAccessMask=VK_ACCESS_SHADER_WRITE_BIT, VkAccessFlags dstAccessMask=VK_ACCESS_SHADER_READ_BIT, VkPipelineStageFlags srcStageMask=VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VkPipelineStageFlags dstStageMask=VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE)
Add a Buffer Barrier from this queue to this queue.
void UpdatePushConstantAsync(F func)
Update local push constant buffer Async.
Definition Renderer.h:2503
void UpdateUniformBuffer(uint32_t set, uint32_t binding, void *data) const
Update a local buffer.
Definition Renderer.h:2624
void EndRecording() const
End recording all this behaveS does.
Definition Renderer.cpp:561
virtual void BindPipelineAsync(const std::string &materialName, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_GRAPHICS)
Bind the pipeline created by CreatePipeline() Async. Called on RenderBehaveBuilder instanced.
Definition Renderer.cpp:651
virtual void ReleaseBarriers(VkBuffer buffer, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex=VulkanRenderBackend::GetState().m_ComputeQueueFamily, uint32_t dstQueueFamilyIndex=VulkanRenderBackend::GetState().m_GraphicQueueFamily, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE)
Add a Buffer Barrier from this graphic queue to compute queue.
uint32_t m_CurrentImage
Current frame index. Passed while this class instanced.
Definition Renderer.h:1529
void UpdateStorageBuffer(uint32_t set, uint32_t binding, void *data, uint64_t size=VK_WHOLE_SIZE, uint64_t offset=0) const
Update a local buffer.
Definition Renderer.h:2634
void UpdatePushConstant(void *data, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) const
Update local push constant buffer.
Definition Renderer.h:2581
void InternalRegionBarrier(VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) const
Add a memory Barrier.
uint32_t m_SubPassIndex
Current subPass Index.
Definition Renderer.h:1534
void PreprocessDGCAsync_NV() const
Preprocess Device Generated CommandsBuffer Async.
void InternalRegionBarrierAsync(VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask) const
Add a memory Barrier.
void DrawFullScreenTriangle(const VkCommandBuffer &cmdBuffer=VK_NULL_HANDLE) const
Draw a Triangle full screen.
void SetViewPortAsync() const
DynamicState Set Viewport and Scissor Async.
Definition Renderer.cpp:715
void Recording(const std::string &caption) const
Recording all this behaves does.
Definition Renderer.cpp:551
void UpdateStorageBuffer(uint32_t set, uint32_t binding, std::shared_ptr< VulkanBuffer > buffer) const
Update a local buffer.
Definition Renderer.h:2650
void UpdateAccelerationStructure(uint32_t set, uint32_t binding, const VkAccelerationStructureKHR &accel) const
Update AccelerationStructure in descriptorSet.
Definition Renderer.h:2665
void RunDGC(VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) const
Run DGC Buffer.
Renderer * m_Renderer
Specific Renderer pointer. Passed while this class instanced.
Definition Renderer.h:1515
virtual void BeginRenderPass()
Begin this Renderer's RenderPass.
Definition Renderer.cpp:840
void Await(std::function< void(const VkCommandBuffer &cmdBuffer)> func) const
Await Async Commands.
Definition Renderer.cpp:583
void Wait(std::future< VkCommandBuffer > &futureCmdBuffer) const
Wait for merge secondary commandBuffers.
Definition Renderer.cpp:600
void RunDGCAsync() const
Run DGC Buffer Async.
RenderBehaveBuilder(Renderer *renderer, uint32_t currentFrame, uint32_t currentImage)
Constructor Function. Bind pipeline and all buffer type descriptor set.
Definition Renderer.cpp:476
void ExecuteDGCAsync_NV() const
Execute Device Generated CommandsBuffer Async.
void UpdatePushConstant(F func, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE)
Update local push constant buffer.
Definition Renderer.h:2471
void UpdateStorageBuffer(uint32_t set, uint32_t binding, F func)
Update a local buffer.
Definition Renderer.h:2559
VkCommandBuffer m_CommandBuffer
Current CommandBuffer.
Definition Renderer.h:1539
std::future< VkCommandBuffer > Async(std::function< void(const VkCommandBuffer &cmdBuffer)> func) const
Async Commands.
Definition Renderer.cpp:571
void BeginRenderPassAsync()
Begin this Renderer's RenderPass Async.
Definition Renderer.cpp:925
void SetViewPort(const VkCommandBuffer &cmdBuffer=VK_NULL_HANDLE) const
DynamicState Set Viewport and Scissor.
Definition Renderer.cpp:668
virtual void EndRenderPass()
End this Renderer's RenderPass.
Definition Renderer.cpp:981
void UpdateUniformBuffer(uint32_t set, uint32_t binding, F func)
Update a local buffer.
Definition Renderer.h:2537
void PreprocessDGC_NV(VkCommandBuffer cmdBuffer=VK_NULL_HANDLE) const
Preprocess Device Generated CommandsBuffer.
virtual void BindPipeline(VkPipeline pipeline, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE, VkPipelineBindPoint bindPoint=VK_PIPELINE_BIND_POINT_GRAPHICS)
Bind the pipeline created by CreatePipeline(). Called on RenderBehaveBuilder instanced.
Definition Renderer.cpp:640
virtual void AddBarriers(VulkanImage *image, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex=VulkanRenderBackend::GetState().m_ComputeQueueFamily, uint32_t dstQueueFamilyIndex=VulkanRenderBackend::GetState().m_GraphicQueueFamily, VkCommandBuffer cmdBuffer=VK_NULL_HANDLE)
Add a Image Barrier from compute queue to this graphic queue.
void ExecuteDGC_NV(const VkCommandBuffer &cmdBuffer=VK_NULL_HANDLE) const
Execute Device Generated CommandsBuffer.
This class helps to bind pipeline and bind buffer. Only instanced during Render().
Definition Renderer.h:985
RendererPassBuilder & EndSubPass()
End recording a sub pass.
std::shared_ptr< RendererSubPass > m_HandledRendererSubPass
Handled Sub pass.
Definition Renderer.h:512
RendererPassBuilder & AddInputAttachment(const std::string &attachmentName, const TextureType &type, T func)
Add a input attachment.
virtual ~RendererPassBuilder()=default
Destructor Function.
void Build() const
Build the RendererPass.
RendererPassBuilder & AddColorAttachment(const std::string &attachmentName, const TextureType &type, T func)
Add a color attachment.
Renderer * m_Renderer
Specific Renderer pointer. Passed while this class instanced.
Definition Renderer.h:507
RendererPassBuilder & AddSubPass(const std::string &subPassName, Querier::StatisticsFlags flags=Querier::ALL)
Add a new SubPass to Renderer Pass.
RendererPassBuilder(const std::string &rendererPassName, Renderer *renderer)
Constructor Function.
std::string m_RendererPassName
RendererPass Name.
Definition Renderer.h:501
RendererPassBuilder & AddDepthAttachment(const std::string &attachmentName, const TextureType &type, T func)
Add a depth attachment.
RendererPassBuilder & AddSelfDependency(VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask)
Add subPass Self Dependency.
RendererPassBuilder & AddSwapChainAttachment(T func)
Add a swapchain image attachment.
This Class is a helper for Building RendererPass. Only instanced during CreateRendererPass().
Definition Renderer.h:392
std::string m_RendererName
Specific renderer name, Passed by instanced.
Definition Renderer.h:2017
void RegistryDGCPipeline(const std::string &materialName, const std::string &subPassName, VulkanDeviceGeneratedCommandsNV *indirectPtr)
Registry dgc pipeline to Specific Renderer.
Definition Renderer.cpp:162
virtual void CreateRendererPass()=0
The interface is called during OnSystemInitialize(). Create specific render pass.
std::shared_ptr< VulkanDeviceGeneratedCommandsNV > FillIndirectRenderData(const std::string &subPassName, std::shared_ptr< std::vector< uint32_t > > view)
Fill in World RenderAble data to IndirectBuffer.
Definition Renderer.h:2058
void IterStatistics(F &&func)
Iterator the specific RenderPass Statistics in Renderer.
Definition Renderer.h:2451
std::shared_ptr< RendererPass > m_Pass
RendererPass.
Definition Renderer.h:2012
std::shared_ptr< VulkanDescriptorPool > m_DescriptorPool
This variable is passed while renderer instanced.
Definition Renderer.h:1997
virtual void CreateDeviceGeneratedCommandsLayout()
This interface is called during OnSystemInitialize(). Create Device Generated Commands Layout.
Definition Renderer.h:226
void RegistryMaterial(const std::string &materialName, const std::string &subPassName)
Registry material to Specific Renderer.
Definition Renderer.cpp:96
std::shared_ptr< RendererPass > & GetPasses()
Get RendererPass.
Definition Renderer.h:187
bool m_IsActive
Whether this renderer is active(submit commands in RendererBehaveBuilder).
Definition Renderer.h:2037
virtual void OnSlateResize()
Definition Renderer.cpp:66
virtual void Render(TimeStep &ts, FrameInfo &frameInfo)=0
The interface is called every frame. Defines what data needs to be renderer and how to render.
virtual ~Renderer()=default
Destructor Function. We destroy pipeline layout and free descriptors that holed by this renderer here...
virtual void OnMeshAddedWorld()
Definition Renderer.cpp:86
std::shared_ptr< Material > GetDefaultMaterial(const std::string &subPassName) const
Get default material using sub pass Name.
Definition Renderer.cpp:220
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.
Definition Renderer.h:2273
scl::thread_unordered_map< std::string, std::shared_ptr< VulkanPipeline > > m_Pipelines
Renderer stored material pipelines.
Definition Renderer.h:2022
void GetDirectionalLightMatrix(FrameInfo &frameInfo, std::array< glm::mat4, MAX_DIRECTIONALLIGHT_NUM > &directionalLight)
Definition Renderer.cpp:400
void CreateDefaultMaterial()
Create Specific Renderer Default Material.
Definition Renderer.cpp:233
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.
Definition Renderer.cpp:271
void IterWorldCompWithBreak(FrameInfo &frameInfo, F func)
Iterator the specific Component in World With break.
Definition Renderer.h:2332
Renderer(const std::string &rendererName, VulkanState &vulkanState, const std::shared_ptr< VulkanDescriptorPool > &DescriptorPool, const std::shared_ptr< VulkanDevice > &device, const std::shared_ptr< RendererResourcePool > &rendererResourcePool, bool isLoadDefaultMaterial=true)
Constructor Function. Init member variables.
Definition Renderer.cpp:16
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.
Definition Renderer.h:2380
bool m_IsLoadDefaultMaterial
Whether should load a default renderer material.
Definition Renderer.h:2032
std::shared_ptr< std::vector< uint32_t > > GetEntityWithComponent(World *world)
Get entities with component in world.
Definition Renderer.h:2256
std::shared_ptr< RendererCache > m_RenderCache
RendererCache.
Definition Renderer.h:2047
virtual void CreateDescriptorSet()=0
This interface is called during OnSystemInitialize(). Create all sub pass descriptorSet.
void IterWorldComp(FrameInfo &frameInfo, F func)
Iterator the specific Component in World.
Definition Renderer.h:2308
void IterWorldCompWithRange(FrameInfo &frameInfo, const std::vector< uint32_t > &ranges, F func)
Iterator the specific Component in World With range.
Definition Renderer.h:2355
std::shared_ptr< RendererResourcePool > m_RendererResourcePool
RendererResourcePool, Passed by instanced.
Definition Renderer.h:2007
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.
Definition Renderer.h:2428
static std::shared_ptr< scl::behave_state_list< void, Renderer::RenderBehaveBuilder *, VkCommandBuffer > > m_StatisticsStateList
Statistics StateList.
Definition Renderer.h:1985
virtual void OnWindowResizeOver()
This interface is called on Window resized over (registry by swapchain). If the specific renderer use...
Definition Renderer.h:128
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.
Definition Renderer.h:270
DescriptorSetManager::DescriptorSetCombineFlags m_DescriptorSetCombine
Combination of DescriptorSet.
Definition Renderer.h:2027
Renderer(const Renderer &)=delete
Copy Constructor Function.
virtual void CreatePipeline(std::shared_ptr< Material > material, VkPipelineLayout &layout, std::shared_ptr< RendererSubPass > subPass)=0
Create Specific Material Pipeline.
std::tuple< glm::mat4, glm::mat4, unsigned int, float > GetActiveCameraMatrix(FrameInfo &frameInfo)
Get The activated camera entity's view matrix and projection matrix.
Definition Renderer.cpp:304
virtual void OnSystemInitialize()
This interface is called on render system is registered. Initialize the specific renderer's pipeline,...
Definition Renderer.cpp:38
std::shared_ptr< VulkanDevice > m_Device
VulkanDevice , Passed by instanced.
Definition Renderer.h:2002
void ResetRendererState()
Reset Renderer State to disActive.
Definition Renderer.h:206
void IterWorldCompWithBreakWithRange(FrameInfo &frameInfo, const std::vector< uint32_t > &ranges, F func)
Iterator the specific Component in World With break With range.
Definition Renderer.h:2405
VulkanState & m_VulkanState
This variable is passed while renderer instanced.
Definition Renderer.h:1992
std::unordered_map< std::string, std::shared_ptr< VulkanDeviceGeneratedCommandsNV > > m_DGCData
Data of dgc DGC Draw.
Definition Renderer.h:2042
void GetDirectionalLight(FrameInfo &frameInfo, std::array< SpicesShader::DirectionalLight, SpicesShader::DIRECTIONALLIGHT_BUFFER_MAXNUM > &dLightBuffer)
Get DirectionalLightComponent's render data in World.
Definition Renderer.cpp:371
void GetPointLight(FrameInfo &frameInfo, std::array< SpicesShader::PointLight, SpicesShader::POINTLIGHT_BUFFER_MAXNUM > &pLightBuffer)
Get PointLightComponent's render data in World.
Definition Renderer.cpp:445
void CreateDGCMaterial(const std::string &subPass, VulkanDeviceGeneratedCommandsNV *indirectPtr)
Create Specific Renderer DGC Material.
Definition Renderer.cpp:258
Renderer & operator=(const Renderer &)=delete
Copy Assignment Operation.
Renderer Class. This class defines the basic behaves of renderer. When we add an new Renderer,...
Definition Renderer.h:57
ResourceSystem Class. Handles resource load/unload event.
SlateImage(const std::string &textureName, const std::string &materialName)
Constructor Function.
void ReBuildMaterial()
Rebuild this Material.
std::shared_ptr< Material > m_Material
This Slate image draw material.
Definition SlateImage.h:65
virtual ~SlateImage()
Destructor Function.
std::string m_TextureName
Texture name.
Definition SlateImage.h:70
std::shared_ptr< Material > GetMaterial()
Get this Material.
Definition SlateImage.h:53
ImTextureID GetTextureID()
Get this TextureID.
Definition SlateImage.h:47
void ReBuildTextureID()
Rebuild this ImTextureID.
ImTextureID m_TextureID
ImTextureID.
Definition SlateImage.h:60
std::string m_MaterialName
Material name.
Definition SlateImage.h:75
Slate image draw context.
Definition SlateImage.h:18
This Class defines InfoBar instance.
std::shared_ptr< ImguiSlate > GetSlate(const std::string &name)
Get Slate by name.
std::unordered_map< std::string, std::shared_ptr< ImguiSlate > > m_SlatesRenderContainer
The container of all slate handle.
std::shared_ptr< ImguiViewport > GetViewPort()
virtual ~SlateRegister()=default
Destructor Function.
void OnEvent(Event &event)
This function will be called on global Event function pointer is called.
std::unordered_map< std::string, std::shared_ptr< ImguiSlate > > m_SlatesEventContainer
The container of all slate handle.
void OnRender() const
This function is called on SlateRenderer::Render.
void OnUpdate(TimeStep &ts) const
SlateRegister & operator=(const SlateRegister &)=delete
Copy Assignment Operation.
SlateRegister()=default
Constructor Function.
std::shared_ptr< T > Register(bool isPrimary, const std::string &panelName, Args &&... args)
This function registry slate instance.
SlateRegister(const SlateRegister &)=delete
Copy Constructor Function.
This Class is the manager of all slate, it keeps all slate handle.
This Class is inherited from Event Class. Called by Viewport Resize.
Definition SlateEvent.h:18
virtual ~SlateSystem() override
Destructor Function.
static std::shared_ptr< SlateRegister > m_SlateRegister
The slate register.
Definition SlateSystem.h:74
static std::shared_ptr< SlateRegister > GetRegister()
Get slate register.
Definition SlateSystem.h:67
virtual void OnSystemInitialize() override
This interface defines the behaves on specific system initialized. Called when system Pushed to Syste...
SlateSystem(const std::string &systemName)
Constructor Function. Init class variable. Usually call it.
Definition SlateSystem.h:30
virtual void OnSystemShutDown() override
This interface defines the behaves on specific system shutdown. Called when system popped from System...
virtual void OnEvent(Event &event) override
This interface defines the behaves on global event function pointer is called.
virtual void OnSystemUpdate(TimeStep &ts) override
This interface defines the behaves on specific system updated every frame.
SlateSystem Class. This class defines the specific behaves of SlateSystem.
Definition SlateSystem.h:21
SystemManager()
Constructor Function.
static SystemManager & Get()
Get Static SystemManager.
SystemManager & PopSystem(const std::string &systemName)
Push a system to this manager.
SystemManager Class. This class defines the behave of SystemManager.
System(const std::string &systemName)
Constructor Function. Init class variable. Usually call it.
System Class. This class defines the basic behaves of System. When we create an new System,...
Texture2DArray(const RendererResourceCreateInfo &info)
Constructor Function. Used for create render resource.
virtual ~Texture2DArray() override=default
Destructor Function.
Texture2DArray(const std::string &path)
Constructor Function. Init class variable, load date immediately. Usually call it.
Texture2DArray()
Constructor Function.
Texture2D Class. This class defines the basic behaves of Texture2DArray.
virtual ~Texture2DCube() override=default
Destructor Function.
Texture2DCube(const RendererResourceCreateInfo &info)
Constructor Function. Used for create render resource.
Texture2DCube(const std::string &path)
Constructor Function. Init class variable, load date immediately. Usually call it.
Texture2DCube()
Constructor Function.
Texture2DCube Class. This class defines the basic behaves of Texture2DCube.
Texture2D Class. This class defines the basic behaves of texture2D.
Definition Texture2D.h:20
TextureLoader Class. This class only defines static function for load data from image file.
void Flush()
Refresh time in each engine loop.
Definition TimeStep.cpp:26
const uint64_t & fs() const
Get frames count.
Definition TimeStep.h:63
This Class handles our engine time step during frames. Global Unique.
Definition TimeStep.h:22
Transcoder of Texture Container format and Transform format and GPU compress format.
Definition Transcoder.h:17
TransformComponent Class. This class defines the specific behaves of TransformComponent.
This Class is a Wrapper of VulkanBuffer.
virtual ~VulkanCommandBuffer() override=default
Destructor Function. VkCommandBuffer is created by VkCommandPool, we do not need destroy it here manu...
VulkanCommandBuffer(VulkanState &vulkanState)
Constructor Function. Create VkCommandBuffer.
static void CustomGraphicCmd(VulkanState &vulkanState, T func)
Create a new command buffer and record custom cmd, submit to graphic queue, execute it immediately.
VulkanCommandBuffer Class. This class defines the VulkanCommandBuffer behaves. This class is just a w...
int m_GraphicThreadId
Thread Unique Graphic ThreadId.
int m_ComputeThreadId
Thread Unique Compute ThreadId.
static VulkanCommandPoolThreadWrapper & GetInst()
Get this instance.
virtual ~VulkanCommandPoolThreadWrapper()
Destructor Function.
VulkanCommandPoolThreadWrapper()
Constructor Function.
Wrapper of Instance/Delete VkCommandPool in thread.
static std::vector< VkCommandPool > m_ThreadGraphicCommandPool
Thread Graphic VkCommandPool map.
static VkCommandPool & GetThreadComputeCommandPool()
Get Thread Compute VkCommandPool by thread id.
static bool m_IsPoolActive
True if this Pool is actived.
VulkanCommandPool(VulkanState &vulkanState)
Constructor Function. Create VkCommandPool.
virtual ~VulkanCommandPool() override
Destructor Function.
static std::mutex m_ComputeCommandPoolMutex
Mutex for GraphicCommandPool.
static VkCommandPool & GetThreadGraphicCommandPool()
Get Thread Graphic VkCommandPool by thread id.
static std::mutex m_GraphicCommandPoolMutex
Mutex for GraphicCommandPool.
static std::vector< VkCommandPool > m_ThreadComputeCommandPool
Thread Compute VkCommandPool map.
VulkanCommandPool Class. This class defines the VulkanCommandPool behaves. This class is just a wrapp...
VulkanDescriptorPool Class. This class is the wrapper of VkDescriptorPool.
This Class is a wrapper of VkDescriptorSet.
VulkanDeviceGeneratedCommandsNV Class. This class defines the VulkanDeviceGeneratedCommandsNV behaves...
VkSampleCountFlagBits GetMaxUsableSampleCount() const
Get device's max usable sample count.
bool IsQueueMeetDemand(const VkPhysicalDevice &device, const VkSurfaceKHR &surface)
Check all Queue we need meet;.
static SwapChainSupportDetails QuerySwapChainSupport(const VkPhysicalDevice &device, const VkSurfaceKHR &surface, GLFWwindow *window)
Query physical device's SwapChainSupport.
const SwapChainSupportDetails & GetSwapChainSupport()
Get SwapChain Utils.
static VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV & GetDGCProperties()
Get DeviceGeneratedCommandsPropertiesNV.
QueueHelper m_QueueHelper
QueueHelper.
static VkPhysicalDeviceFeatures m_DeviceFeatures
Selected Physical Device Features.
static VkPhysicalDeviceProperties & GetDeviceProperties()
Get VkPhysicalDeviceProperties.
virtual ~VulkanDevice() override
Destructor Function.
static VkPhysicalDeviceRayTracingPipelinePropertiesKHR m_RayTracingProperties
Device RayTracing Properties.
static VkPhysicalDeviceFeatures & GetDeviceFeatures()
Get VkPhysicalDeviceFeatures.
bool IsPropertyMeetDemand(const VkPhysicalDevice &device)
Check all Property we need meet.
static VkPhysicalDeviceRayTracingPipelinePropertiesKHR & GetRTPipelineProperties()
Get RayTracingPipelineProperties.
bool IsFeatureMeetDemand(const VkPhysicalDevice &device)
Check all Feature we need meet.
void GetExtensionRequirements()
Get all physical device extension requirements our engine needed. Source 1 : user Setting.
static VkPhysicalDeviceProperties m_DeviceProperties
Selected Physical Device Properties.
static VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV m_DGCProperties
Device DGC Properties.
VulkanDevice(VulkanState &vulkanState)
Constructor Function. Create vkDevice.
bool SelectPhysicalDevice(const VkInstance &instance, const VkSurfaceKHR &surface, GLFWwindow *window)
select a suitable physical device.
SwapChainSupportDetails m_SwapChainSupportDetails
SwapChainSupportDetails.
bool IsExtensionMeetDemand(const VkPhysicalDevice &device)
Check all Extension we need meet;.
std::vector< const char * > m_ExtensionProperties
Device Extension Properties.
void RequerySwapChainSupport()
Requery device's SwapChainSupportDetails. Mainly VkExtent2D.
const QueueHelper & GetQueueHelper() const
Get QueueHelper variable.
VulkanInstance Class. This class defines the VulkanDevice behave. This class is just a wrapper of vkd...
VkImage & GetImage()
Definition VulkanImage.h:86
VkImageType m_ImageType
Image Type.
void CopyImageToMemoryHost(const std::vector< VkImageToMemoryCopyEXT > &copies) const
int m_Width
Image width.
VkFormat m_Format
The image format.
bool IsHostCopyable() const
Check if this image format can copy from host to gpu directly.
static bool IsHostCopyable(VulkanState &state, VkFormat format)
Check if this image format can copy from host to gpu directly.
uint32_t GetWidth() const
Get this Width.
VkDescriptorSet & GetDescriptorSet()
Get VkDescriptorSet.
void CreateDescriptorSet(uint32_t binding)
Create DescriptorSet with single image.
VmaAllocation m_Alloc
VMA allocation.
void CopyImageToMemoryHost(void *data) const
VkDescriptorImageInfo * GetImageInfo(VkImageLayout imageLayout=VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, uint32_t mipLevel=0)
void CopyMemoryToImageHost(const void *data) const
Copy the Memory's data to this VkImage.
void CreateSampler()
Create a Sampler.
void CopyImageToBuffer(VkBuffer dstBuffer, const std::vector< VkBufferImageCopy > &regions)
void CopyImageTexelToBuffer(uint32_t x, uint32_t y, void *out_rgba)
VkDescriptorSetLayout m_DescriptorSetLayout
VkDescriptorSetLayout.
void CreateImage(VulkanState &vulkanState, const std::string &name, VkImageType type, uint32_t width, uint32_t height, uint32_t layers, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkMemoryPropertyFlags properties, uint32_t mipLevels)
void DestroyDescriptorSetLayout() const
Destroy the DescriptorSetLayout if Created a DescriptorSet.
VkDeviceMemory m_ImageMemory
The image video memory.
void CopyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height, const std::vector< VkBufferImageCopy > &regions) const
Copy the Buffer's data to this VkImage. Used to create image data (include mipmaps),...
uint32_t GetMipLevels() const
Get this MipLevels.
void CopyMemoryToImageHost(const std::vector< VkMemoryToImageCopyEXT > &copies) const
Copy the Memory's data to this VkImage. Used to create image data (include mipmaps),...
VkSampler m_TextureSampler
The image sampler.
bool m_IsCreateSet
True if Called Create DescriptorSet.
virtual ~VulkanImage() override
Destructor Function.
VulkanImage(VulkanState &vulkanState, const std::string &name, VkImageType type, uint32_t width, uint32_t height, uint32_t layers, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkMemoryPropertyFlags properties, uint32_t mipLevels)
uint32_t m_MipLevels
Image mipmaps num.
void CreateImageView(VkFormat format, VkImageViewType viewType, VkImageAspectFlags aspectFlags, bool isCreateMipmapView=false)
Create Image View.
int m_Height
Image height.
void Barrier(VkCommandBuffer commandBuffer, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex, uint32_t dstQueueFamilyIndex) const
Wrapper of Call vkCmdImageBarrier.
VkDescriptorImageInfo m_ImageInfo
VkDescriptorImageInfo.
VkDescriptorSet m_DescriptorSet
VkDescriptorSet.
void TransitionImageLayout(VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout)
void CopyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) const
Copy the Buffer's data to this VkImage.
VkImageView & GetView(uint32_t mipLevel=0)
Definition VulkanImage.h:80
uint32_t GetLayers() const
Get this Layers.
Definition VulkanImage.h:92
std::vector< VkImageView > m_ImageViews
The image view.
VulkanImage(VulkanState &vulkanState)
Constructor Function. Init class variable. Init a empty VulkanImage, used in TextureLoad.
Definition VulkanImage.h:29
uint32_t GetHeight() const
Get this Height.
Definition VulkanImage.h:98
VkImage m_Image
The VkImage this Class Wrapped.
uint32_t m_Layers
Image layer(texture cube: 6).
VkFormat GetFormat() const
Get this Format.
void GenerateMipmaps(VkFormat imageFormat, int32_t texWidth, int32_t texHeight) const
Generate mipmaps with the VkImage.
void SetVulkanDebugCallbackFuncPointer()
Set Vulkan's debug message callback function pointer. Working with DEBUG mode.
virtual ~VulkanInstance() override
Destructor Function.
VkDebugUtilsMessengerCreateInfoEXT m_DebugMessengerCreateInfo
Debug Utils Messages used to execute message callback function. Also debug vkInstance create.
void CreateVulkanSurface() const
Create a Surface Object.
std::vector< const char * > m_LayerProperties
Instance Layer Properties.
VulkanInstance(VulkanState &vulkanState, const std::string &name, const std::string &engineName)
Constructor Function. Create vkInstance and vkSurface.
std::vector< const char * > m_ExtensionProperties
Instance Extension Properties.
bool CheckExtensionRequirementsSatisfied()
Iter all our extensions, check whether all satisfied or not.
VkDebugUtilsMessengerEXT m_DebugMessenger
Parameter for Create/Destroy DebugUtilsMessengerEXT.
void FillDebugMessengerCreateInfo()
Set m_DebugMessengerCreateInfo variable.
void GetExtensionRequirements()
Get all instance extension requirements our engine needed. Source 1 : glfw requirements....
bool ChecklayerRequirementsSatisfied()
Iter all our layers, check whether all satisfied or not.
void GetLayerRequirements()
Get all instance layer requirements our engine needed. Source 1 : user Setting.
VulkanInstance Class. This class defines the VulkanInstance behaves. This class is just a wrapper of ...
virtual ~VulkanMemoryAllocator() override
Destructor Function.
VulkanMemoryAllocator(VulkanState &vulkanState)
Constructor Function. Create Specific ThreadPool.
VulkanObject(VulkanState &vulkanState)
Constructor Function. Init member variables.
VulkanObject Class. This class defines the basic behaves of VulkanObject. When we create an new Vulka...
This class is a wrapper of VkPipelineLayout and VkPipeline.
VkQueryType m_QueryType
Query Type.
void EndQuery(VkCommandBuffer commandBuffer, uint32_t index=0) const
End query previous commands.
void WriteTimeStamp(VkCommandBuffer commandBuffer, uint32_t index) const
Write a TimeStamp to queryPool.
void Reset(VkCommandBuffer commandBuffer) const
Reset QueryPool. Call it on frame start.
void QueryResults(uint64_t *result) const
Query results from Pool.
virtual ~VulkanQueryPool() override
Destructor Function.
uint32_t m_QueryCount
Query Count.
VulkanQueryPool(VulkanState &vulkanState, VkQueryType type, uint32_t count=1, uint32_t stride=8, VkQueryPipelineStatisticFlags statistics=0)
Constructor Function. Create VkQueryPool.
VkQueryPool Get() const
Get VkQueryPool Handler.
void BeginQuery(VkCommandBuffer commandBuffer, uint32_t index=0) const
Begin to query next commands.
uint32_t m_Stride
Data stride.
VkQueryPool m_QueryPool
VkQueryPool Handler.
This Class is a Wrapper of VulkanQueryPool.
void EndFrame(FrameInfo &frameInfo)
End record the frame with vulkan render backend.
void RecreateSwapChain()
Called OnSlateResize.
std::shared_ptr< VulkanMemoryAllocator > m_VmaAllocator
VulkanMemoryAllocator.
std::unique_ptr< VulkanSwapChain > m_VulkanSwapChain
VulkanSwapChain.
virtual ~VulkanRenderBackend()
Destructor Function.
std::unique_ptr< VulkanCommandPool > m_VulkanCommandPool
VulkanCommandPool.
VulkanRenderBackend()
Constructor Function.
static std::shared_ptr< VulkanDescriptorPool > GetDescriptorPool()
Get DescriptorPool in use.
static VulkanState m_VulkanState
The VulkanState in use.
std::unique_ptr< VulkanCommandBuffer > m_VulkanCommandBuffer
VulkanCommandBuffer.
bool isWindowClosed()
Determine whether window is closed.
static std::shared_ptr< VulkanDescriptorPool > m_VulkanDescriptorPool
The VulkanDescriptorPool in use.
static std::shared_ptr< RendererResourcePool > m_RendererResourcePool
The RendererResourcePool in use.
static VulkanState & GetState()
Get VulkanState in use.
std::unique_ptr< VulkanWindows > m_VulkanWindows
VulkanWindows.
bool OnMeshAddedWorldEvent(WorldEvent &event)
This function is called on world mark query tick.
void RenderFrame(TimeStep &ts, FrameInfo &frameInfo)
Draw World.
void OnEvent(Event &event)
This function is called on global event function is called.
static std::shared_ptr< RendererResourcePool > GetRendererResourcePool()
Get RendererResourcePool in use.
void BeginFrame(FrameInfo &frameInfo)
Start record a new frame with vulkan render backend.
VulkanRenderBackend & operator=(const VulkanRenderBackend &)=delete
Copy Assignment Operation.
bool OnWindowResizeOver(WindowResizeOverEvent &event)
This function is called on window is resized over.
std::shared_ptr< VulkanDevice > m_VulkanDevice
VulkanDevice.
std::unique_ptr< VulkanInstance > m_VulkanInstance
VulkanInstance.
bool OnSlateResize(SlateResizeEvent &event)
This function is called on viewport is resized.
VulkanRenderBackend(const VulkanRenderBackend &)=delete
Copy Constructor Function.
This class defines the render backend behaves of Vulkan.
virtual ~VulkanRenderPass() override
Destructor Function.
VkRenderPass m_RenderPass
The RenderPass this class mainly manage.
VulkanRenderPass(VulkanState &vulkanState, const std::string &passName, std::shared_ptr< VulkanDevice > vulkanDevice, VkRenderPassCreateInfo &createInfo, std::vector< VkImageView > &imageViews, uint32_t layers, bool isUseSwapChianImage)
Constructor Function. Create VkRenderPass and VkFramebuffer.
VkFramebuffer & GetFramebuffer(uint32_t index)
Get Framebuffer by index.
std::array< VkFramebuffer, MaxFrameInFlight > m_SwapChainFramebuffers
The FrameBuffers.
std::shared_ptr< VulkanDevice > m_VulkanDevice
The shared pointer of VulkanDevice.
VkRenderPass & Get()
Get VkRenderPass.
VulkanRenderPass Class. This class defines the VulkanRenderPass behaves. This class is just a wrapper...
VulkanSwapChain(VulkanState &vulkanState, std::shared_ptr< VulkanDevice > vulkanDevice)
Constructor Function. Create vkInstance and vkSurface.
void DestroySyncObjects() const
Destroy Sync Objects.
static VkFormat FindDepthFormat(const VkPhysicalDevice &physicalDevice)
Check whether Depth Image's Format is supported by physical device.
void Destroy() const
Destroy this.
std::shared_ptr< VulkanDevice > m_VulkanDevice
The shared pointer of VulkanDevice.
void Create() const
Create this.
static VkFormat findSupportedFormat(const VkPhysicalDevice &physicalDevice, const std::vector< VkFormat > &candidates, VkImageTiling tiling, VkFormatFeatureFlags features)
Check whether specific formats is supported by physical device.
virtual ~VulkanSwapChain() override
Destructor Function.
void CreateSyncObjects() const
Create Sync Objects.
VulkanSwapChain Class. This class defines the VulkanSwapChain behaves. This class is just a wrapper o...
static void Destroy()
Destroy all ThreadQueue.
static scl::thread_queue< std::shared_ptr< VulkanThreadQueue > > m_ComputeQueues
Compute VulkanThreadQueue.
static void CreateGraphic(VulkanState &vulkanState, VkQueue queue)
Create Graphic VulkanThreadQueue.
VkQueue m_Queue
This Thread VkQueue.
void Submit(VkCommandBuffer commandBuffer) const
Submit the CommandBuffer in this Queue.
void Wait() const
Wait for queue execute.
static void PushToGraphic(std::shared_ptr< VulkanThreadQueue > &queue)
Push queue to Graphic ThreadQueue.
static std::shared_ptr< VulkanThreadQueue > FetchGraphicQueue()
Fetch valid Graphic Queue.
static std::shared_ptr< VulkanThreadQueue > FetchComputeQueue()
Fetch valid Compute Queue.
static void CreateCompute(VulkanState &vulkanState, VkQueue queue)
Create Compute VulkanThreadQueue.
virtual ~VulkanThreadQueue() override
Destructor Function.
static void PushToCompute(std::shared_ptr< VulkanThreadQueue > &queue)
Push queue to Compute ThreadQueue.
static scl::thread_queue< std::shared_ptr< VulkanThreadQueue > > m_GraphicQueues
Graphic VulkanThreadQueue.
VulkanThreadQueue(VulkanState &vulkanState, VkQueue queue)
Constructor Function.
VulkanThreadQueue Class. This class is a wrapper of Thread VkQueue.
VulkanWindows(VulkanState &vulkanState, const WindowInfo &initInfo)
Constructor Function. Create Windows.
bool m_WindowsResized
True if viewPort is resized.
virtual ~VulkanWindows() override
Destructor Function.
void SetInternalCallBack() const
Set all needed GLFW events call back.
void SetResized(bool isResized)
Set m_WindowsResized variable.
WindowInfo m_WindowInfo
Window's info. not viewport's info.
bool IsResized() const
Get m_WindowsResized variable.
VulkanWindows Class. This class defines the windows behaves.
virtual ~WorldEvent() override=default
Destructor Function.
WorldEvent()=default
Constructor Function.
This Class is inherited from Event Class. Inherit from it and create specific KeyEvent class....
Definition WorldEvent.h:20
World Class. This class defines the basic behaves of World. When we create an new world,...
Definition World.h:41
behave_state_node< Ret, Args... > * AddNode()
Add a empty node to this list.
virtual ~behave_state_list()=default
Destructor Function.
behave_state_list()
Constructor Function.
uint32_t m_CurrentState
current state.
void SetState(uint32_t state)
Set Current State.
std::vector< std::unique_ptr< behave_state_node< Ret, Args... > > > m_List
Linear Node list.
behave_state_node< Ret, Args... > * GetState() const
Get current state node.
void IncreateState()
Current State move forward.
void ResetState()
Current State move to start.
behave_state_list. wrapper of combing all state behaves.
std::unordered_map< std::string, std::function< Ret(Args...)> > m_Behavies
Function behaves map.
void ExecuteBehave(const std::string &name, Args... args)
Execute a behave in this state.
behave_state_node()=default
Constructor Function.
virtual ~behave_state_node()=default
Destructor Function.
void PushBehave(const std::string &name, const std::function< Ret(Args...)> &fn)
Push a behave to this state.
behave_state_list single node. defines behaves in single state.
The container combines hashmap and list together. Used in the case that we want iter a hashmap in ord...
void Push(T &&item)
Push a item to this queue.
Definition ThreadQueue.h:77
std::mutex m_Mutex
Mutex of this queue.
Definition ThreadQueue.h:58
thread_queue()
Constructor Function.
Definition ThreadQueue.h:23
T Pop()
Pop a item from this queue.
Definition ThreadQueue.h:88
void Clear()
Clear this queue.
std::atomic_int m_Count
Count of tasks.
Definition ThreadQueue.h:68
std::condition_variable m_NotEmpty
Not empty condition.
Definition ThreadQueue.h:63
bool IsEmpty() const
Is this queue is empty. @reutrn Returns true if empty.
Definition ThreadQueue.h:46
virtual ~thread_queue()=default
Destructor Function.
std::queue< T > m_Queue
This wrapped queue.
Definition ThreadQueue.h:73
Thread safe Queue.
Definition ThreadQueue.h:17
Thread safe unordered_map.
TextureType
The enum of all Texture Type.
Definition Texture.h:20
VMAMemoryPropertyFlagExtendBits
Map to VmaAllocationCreateFlagBits while use VMA for memory create.
@ VMA_MEMORY_PROPERTY_DEDICATED_MEMORY_BIT
VkMemoryPropertyFlagBits.
@ EventCategoryWorld
Definition Event.h:68
@ MeshAdded
World Event.
static constexpr int NThreadQueue
Thread Queue Count.
RendererType
Definition FrameInfo.h:22
This struct included all infos usd to create a VkPipeline.
virtual ~Result()=default
Destructor Function.
bool valid
True if result is valid.
Definition Querier.h:54
Result()
Constructor Function.
Definition Querier.h:44
virtual void Combine(Result *result)=0
Combine result with another Result.
Basic definition of result.
Definition Querier.h:40
std::optional< uint32_t > graphicqueuefamily
The graphic queue's in used identify.
std::optional< uint32_t > presentqueuefamily
The present queue's in used identify.
std::optional< uint32_t > transferqueuefamily
The transfer queue's in used identify.
std::optional< uint32_t > computequeuefamily
The compute queue's in used identify.
bool isComplete() const
Whether all queues that we need is valid.
This struct contains all queues's identify we need.
virtual ~RendererResourceCreateInfo()=default
Destructor Function.
uint32_t height
Texture' height..
uint32_t mipLevel
Texture's mipmap level.
RendererResourceCreateInfo()=default
Constructor Function.
uint32_t layer
Texture's layer(1 for Texture2D, 6 for TextureCube, any for TextureArray).
VkAttachmentDescription description
Texture's description info.
bool isDepthResource
True if this resource is a DepthResource.
TextureType type
Texture's Class Type.
RendererResourceCreateInfo(const std::string &name)
Constructor Function.
float sizeScale
Texture's size scale.
VkImageUsageFlagBits usage
Image Usage.
bool isResizeable
True if this resource needs resize(sync with viewport's size).
std::string name
Texture's name.
This struct defines the data used to create a texture2d. From render pass.
double string
Definition Math.h:63
VkExtent2D surfaceSize
The VkSurface Size.
std::vector< VkSurfaceFormatKHR > formats
All supported VkSurfaceFormatKHR.
VkSurfaceFormatKHR format
The selected VkSurfaceFormatKHR.
VkSurfaceCapabilitiesKHR capabilities
VkSurfaceCapabilitiesKHR.
VkPresentModeKHR presentMode
The selected VkPresentModeKHR.
VkExtent2D viewPortSize
The ViewPort Size. Init value. Reset by resize event.
std::vector< VkPresentModeKHR > presentModes
All supported VkPresentModeKHR.
SwapChain Utils. Queried from device.
double unsigned int
Definition Math.h:17
uint32_t m_ComputeQueueFamily
uint32_t m_GraphicQueueFamily
This struct contains all Vulkan object in used global.
Definition VulkanUtils.h:74
GLFWimage image
GLFWimage.
WindowIcon(const std::string &iconPath)
Constructor Function. Load the icon file immediately.
virtual ~WindowIcon()
Destructor Function.
This struct helps load the icon of window.
std::shared_ptr< WindowIcon > icon
Window's icon.
std::string name
Window's name.
int width
Window's width.
int height
Window's height.
This struct defines the basic information of window.