@@ -26,6 +26,11 @@ VULKAN_ENGINE_NAMESPACE_BEGIN
2626
2727namespace Core {
2828
29+ /*
30+ Data containing a dependicy image's location belonging to a previows pass
31+ */
32+ struct ImageDependency ;
33+
2934/*
3035Core abstract class needed for a renderer to work.
3136It controls the flow of the renderer state, what information and how it is being
@@ -47,13 +52,12 @@ class BasePass
4752 Graphics::RenderPass m_renderpass = {};
4853 std::vector<Graphics::Framebuffer> m_framebuffers;
4954 uint32_t m_framebufferImageDepth; // In case if multilayered rendering.
55+ // In case is not graphical or need auxiliar data, other graphic data can be stored onto these images
56+ std::vector<Graphics::Image> m_resourceImages;
5057
51- Extent2D m_imageExtent;
52- std::string m_name;
53-
54- // Key: Vec2 (Renderpass ID, Framebuffer ID)
55- // Value: Framebuffer's image attachment IDs
56- std::unordered_map<iVec2, std::vector<uint32_t >> m_imageDepedanceTable;
58+ Extent2D m_imageExtent;
59+ std::string m_name;
60+ std::vector<ImageDependency> m_imageDependencies; // Previous passes image dependency list
5761
5862 // Query
5963 bool m_initiatized = false ;
@@ -106,6 +110,9 @@ class BasePass
106110 inline std::vector<Graphics::Framebuffer> const get_framebuffers () const {
107111 return m_framebuffers;
108112 }
113+ inline std::vector<Graphics::Image> const get_resource_images () const {
114+ return m_resourceImages;
115+ }
109116 inline void set_attachment_clear_value (VkClearValue value, size_t attachmentLayout = 0 ) {
110117 m_renderpass.attachmentsInfo [attachmentLayout].clearValue = value;
111118 }
@@ -133,17 +140,14 @@ class BasePass
133140 inline std::unordered_map<std::string, Graphics::ShaderPass*> const get_shaderpasses () const {
134141 return m_shaderPasses;
135142 }
136-
137143 /*
138- Sets a table of depedencies with different passes.
139- - Key: Vec2 (Renderpass ID, Framebuffer ID)
140- - Value: array of framebuffer's image attachment IDs
144+ Sets a vector of depedencies with different passes.
141145 */
142- inline void set_image_dependace_table (std::unordered_map<iVec2, std:: vector<uint32_t >> table ) {
143- m_imageDepedanceTable = table ;
146+ inline void set_image_dependencies (std::vector<ImageDependency> dependencies ) {
147+ m_imageDependencies = dependencies ;
144148 }
145- inline std::unordered_map<iVec2, std:: vector<uint32_t >> get_image_dependace_table () const {
146- return m_imageDepedanceTable ;
149+ inline std::vector<ImageDependency> get_image_dependencies () const {
150+ return m_imageDependencies ;
147151 }
148152
149153#pragma endregion
@@ -185,6 +189,28 @@ class BasePass
185189#pragma endregion
186190};
187191
192+ #pragma region IMAGE DEP
193+
194+ struct ImageDependency {
195+ uint32_t passID = 0 ; // The pass that produces this image
196+ uint32_t fboID = 0 ; // The FBO within the pass that produces this image
197+ bool isFBO = true ; // If set to false, It will take the attachments from the pass resourceImages (Useful if not a
198+ // graphical pass).
199+ std::vector<uint32_t > attachmentIDs; // The attachment indeces within the FBO
200+
201+ ImageDependency (uint32_t passId, u_int fboId, std::vector<uint32_t > attachmentIds)
202+ : passID(passId)
203+ , fboID(fboId)
204+ , attachmentIDs(attachmentIds) {
205+ }
206+ ImageDependency (uint32_t passId, std::vector<uint32_t > attachmentIds)
207+ : passID(passId)
208+ , attachmentIDs(attachmentIds)
209+ , isFBO(false ) {
210+ }
211+ };
212+
213+ #pragma endregion
188214} // namespace Core
189215
190216VULKAN_ENGINE_NAMESPACE_END
0 commit comments