HatchitGraphics
ht_vkrenderpass.h
1 
25 #pragma once
26 
27 #include <ht_renderpass_base.h>
28 #include <ht_vulkan.h>
29 #include <ht_vktexture.h>
30 #include <ht_vkrendertarget.h>
31 #include <ht_vkrootlayout.h>
32 #include <ht_rootlayout.h> //RootLayoutHandle
33 #include <ht_vkcommandpool.h> //VKCommandPool
34 
35 namespace Hatchit {
36 
37  namespace Graphics {
38 
39  namespace Vulkan {
40 
41  class HT_API VKRenderPass : public RenderPassBase
42  {
43  public:
44  VKRenderPass();
45  ~VKRenderPass();
46 
47  //Required function for RefCounted classes
48  bool Initialize(const Resource::RenderPassHandle& handle, const VkDevice& device,
49  const VkDescriptorPool& descriptorPool, const VKSwapChain* swapchain);
50 
51  //Will this be sent the Objects that it needs to render?
53  void VUpdate() override;
54 
55  bool VBuildCommandList(const ICommandPool* commandPool) override;
56 
57  const VkRenderPass& GetVkRenderPass() const;
58  const VkCommandBuffer& GetVkCommandBuffer() const;
59  const VKRootLayout* GetVKRootLayout() const;
60 
61  const std::vector<RenderTargetHandle>& GetOutputRenderTargets() const;
62 
63  private:
64  //Input
65  uint32_t m_firstInputTargetSetIndex;
66  std::vector<VkDescriptorSet> m_inputTargetDescriptorSets;
67 
68  std::vector<RenderTargetHandle> m_renderTargets;
69 
70  const VKSwapChain* m_swapchain;
71 
72  bool setupRenderPass();
73  bool setupAttachmentImages();
74  bool setupFramebuffer();
75 
76  bool allocateCommandBuffer(const VKCommandPool* commandPool);
77  //Mapping set index to maps of binding indicies and render targets
78  bool setupDescriptorSets(std::map < uint32_t, std::map < uint32_t, VKRenderTarget* >> inputTargets);
79 
80  VkDevice m_device;
81  VkDescriptorPool m_descriptorPool;
82 
83  VkRenderPass m_renderPass;
84  VkCommandBuffer m_commandBuffer;
85 
86  Graphics::RootLayoutHandle m_rootLayoutHandle; //To keep this referenced
87  VKRootLayout* m_rootLayout;
88 
89  //For instance data
90  std::map<MeshHandle, UniformBlock_vk> m_instanceBlocks;
91 
92  std::vector<Image_vk> m_colorImages;
93  Image_vk m_depthImage;
94 
95  VkFramebuffer m_framebuffer;
96  };
97  }
98  }
99 }
Definition: ht_vkrootlayout.h:30
Definition: ht_vkswapchain.h:55
Definition: ht_vkcommandpool.h:35
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Definition: ht_color.h:19
Definition: ht_renderpass_base.h:59
Definition: ht_commandpool.h:31
Definition: ht_vkrenderpass.h:41