@@ -34,24 +34,18 @@ struct ImageDependency;
3434/*
3535Core abstract class needed for a renderer to work.
3636It controls the flow of the renderer state, what information and how it is being
37- rendered/computed. It also gives access to the framebuffers containing the rendered data.
37+ rendered/computed.
3838It can be inherited for full user control over the render/compute pipeline.
3939*/
4040class BasePass ;
41- typedef BasePass GraphicPass; // Sintax for graphic passes that draw primitives and rasterized them onto framebuffers
42- typedef BasePass ComputePass; // Sintax for passes focused on GPGPU
43- typedef BasePass RaytracedPass; // Sintax for passes that only use the raytracing mode.
41+ typedef BasePass ComputePass; // Sintax for passes focused on GPGPU
4442class BasePass
4543{
4644 protected:
4745 // Graphic Objects
4846 Graphics::Device* m_device = nullptr ;
4947 Graphics::DescriptorPool m_descriptorPool = {};
5048 std::unordered_map<std::string, Graphics::BaseShaderPass*> m_shaderPasses;
51- // In case it is a graphical pass ... which is the most usual
52- Graphics::RenderPass m_renderpass = {};
53- std::vector<Graphics::Framebuffer> m_framebuffers;
54- uint32_t m_framebufferImageDepth; // In case if multilayered rendering.
5549 // In case is not graphical or need auxiliar data, other graphic data can be stored onto these images
5650 std::vector<Graphics::Image> m_resourceImages;
5751
@@ -66,28 +60,17 @@ class BasePass
6660 bool m_isDefault = false ;
6761 bool m_isGraphical = true ;
6862
69- virtual void
70- setup_attachments (std::vector<Graphics::AttachmentInfo>& attachments,
71- std::vector<Graphics::SubPassDependency>& dependencies) = 0 ; // Only for graphical renderpasses
7263 virtual void setup_uniforms (std::vector<Graphics::Frame>& frames) = 0;
7364 virtual void setup_shader_passes () = 0;
7465
7566 public:
76- BasePass (Graphics::Device* ctx,
77- Extent2D extent,
78- uint32_t framebufferCount = 1 ,
79- uint32_t framebufferDepth = 1 ,
80- bool isDefault = false ,
81- std::string name = " UNNAMED PASS" )
67+ BasePass (Graphics::Device* ctx, Extent2D extent, bool isDefault = false , std::string name = " UNNAMED PASS" )
8268 : m_device(ctx)
83- , m_framebufferImageDepth(framebufferDepth)
8469 , m_isDefault(isDefault)
85- , m_name(name) {
86- !isDefault ? m_framebuffers.resize (framebufferCount)
87- : m_framebuffers.resize (m_device->get_swapchain ().get_present_images ().size ());
88- m_imageExtent = extent;
70+ , m_name(name)
71+ , m_imageExtent(extent) {
8972 }
90- virtual ~BasePass (){
73+ virtual ~BasePass () {
9174 }
9275
9376#pragma region Getters & Setters
@@ -106,19 +89,6 @@ class BasePass
10689 m_imageExtent = extent;
10790 }
10891
109- inline Graphics::RenderPass get_renderpass () const {
110- return m_renderpass;
111- }
112- inline std::vector<Graphics::Framebuffer> const get_framebuffers () const {
113- return m_framebuffers;
114- }
115- inline std::vector<Graphics::Image> const get_resource_images () const {
116- return m_resourceImages;
117- }
118- inline void set_attachment_clear_value (VkClearValue value, size_t attachmentLayout = 0 ) {
119- m_renderpass.attachmentsInfo [attachmentLayout].clearValue = value;
120- }
121-
12292 inline bool resizeable () const {
12393 return m_isResizeable;
12494 }
@@ -151,49 +121,27 @@ class BasePass
151121 inline std::vector<ImageDependency> get_image_dependencies () const {
152122 return m_imageDependencies;
153123 }
124+ inline std::vector<Graphics::Image> const get_resource_images () const {
125+ return m_resourceImages;
126+ }
154127
155128#pragma endregion
156129#pragma region Core Functions
157130 /*
158131 Setups de renderpass. Init, create framebuffers, pipelines and resources ...
159132 */
160- void setup (std::vector<Graphics::Frame>& frames);
133+ virtual void setup (std::vector<Graphics::Frame>& frames);
161134
162135 virtual void render (Graphics::Frame& currentFrame, Scene* const scene, uint32_t presentImageIndex = 0 ) = 0;
163136
164137 virtual void update_uniforms (uint32_t frameIndex, Scene* const scene) {
165138 }
139+ virtual void resize_attachments () {
140+ }
166141 virtual void link_previous_images (std::vector<Graphics::Image> images) {
167142 }
168- /* *
169- * Create framebuffers and images attached to them necessary for the
170- * renderpass to work. It also sets the extent of the renderpass.
171- */
172- virtual void create_framebuffer ();
173- /* *
174- * Destroy framebuffers and images attached to them necessary for the
175- * renderpass to work. If images have a sampler attached to them, contol the
176- * destruction of it too.
177- */
178- virtual void clean_framebuffer ();
179- /* *
180- * Recreates the renderpass with new parameters. Useful for example, when
181- * resizing the screen. It automatically manages framebuffer cleanup and
182- * regeneration
183- *
184- */
185- virtual void update_framebuffer ();
186- /* *
187- * Destroy the renderpass and its shaderpasses. Framebuffers are managed in a
188- * sepparate function for felxibilty matters
189- */
190143 virtual void cleanup ();
191144#pragma endregion
192-
193- /*
194- Public static member.
195- Vignette for rendering textures onto screen.*/
196- static Core::Geometry* vignette;
197145};
198146
199147#pragma region IMAGE DEP
0 commit comments