#pragma once #include "vulkan/system/vk_objects.h" #include "r_data/renderstyle.h" #include "hwrenderer/data/buffers.h" #include class VKDataBuffer; class VkRenderPassKey { public: FRenderStyle RenderStyle; int SpecialEffect; int EffectState; int AlphaTest; int VertexFormat; int DrawType; bool operator<(const VkRenderPassKey &other) const { return memcmp(this, &other, sizeof(VkRenderPassKey)); } }; class VkRenderPassSetup { public: VkRenderPassSetup(const VkRenderPassKey &key); std::unique_ptr RenderPass; std::unique_ptr Pipeline; std::unique_ptr Framebuffer; private: void CreatePipeline(const VkRenderPassKey &key); void CreateRenderPass(); void CreateFramebuffer(); }; class VkVertexFormat { public: int NumBindingPoints; size_t Stride; std::vector Attrs; }; class VkRenderPassManager { public: VkRenderPassManager(); void Init(); void BeginFrame(); VkRenderPassSetup *GetRenderPass(const VkRenderPassKey &key); int GetVertexFormat(int numBindingPoints, int numAttributes, size_t stride, const FVertexBufferAttribute *attrs); std::unique_ptr DynamicSetLayout; std::unique_ptr TextureSetLayout; std::unique_ptr PipelineLayout; std::unique_ptr DescriptorPool; std::map> RenderPassSetup; std::unique_ptr SceneColor; std::unique_ptr SceneDepthStencil; std::unique_ptr SceneColorView; std::unique_ptr SceneDepthStencilView; std::unique_ptr SceneDepthView; std::unique_ptr DynamicSet; std::vector VertexFormats; private: void CreateDynamicSetLayout(); void CreateTextureSetLayout(); void CreatePipelineLayout(); void CreateDescriptorPool(); void CreateDynamicSet(); };