#pragma once #include "vulkan/system/vk_objects.h" #include class VulkanFrameBuffer; class VkMaterial; class PPTextureInput; class VkPPRenderPassSetup; class VkDescriptorSetManager { public: VkDescriptorSetManager(VulkanFrameBuffer* fb); ~VkDescriptorSetManager(); void Init(); void Deinit(); void BeginFrame(); void UpdateFixedSet(); void UpdateHWBufferSet(); void ResetHWTextureSets(); VulkanDescriptorSetLayout* GetHWBufferSetLayout() { return HWBufferSetLayout.get(); } VulkanDescriptorSetLayout* GetFixedSetLayout() { return FixedSetLayout.get(); } VulkanDescriptorSetLayout* GetTextureSetLayout(int numLayers); VulkanDescriptorSet* GetHWBufferDescriptorSet() { return HWBufferSet.get(); } VulkanDescriptorSet* GetFixedDescriptorSet() { return FixedSet.get(); } VulkanDescriptorSet* GetNullTextureDescriptorSet(); std::unique_ptr AllocateTextureDescriptorSet(int numLayers); VulkanDescriptorSet* GetInput(VkPPRenderPassSetup* passSetup, const TArray& textures, bool bindShadowMapBuffers); void AddMaterial(VkMaterial* texture); void RemoveMaterial(VkMaterial* texture); private: void CreateHWBufferSetLayout(); void CreateFixedSetLayout(); void CreateHWBufferPool(); void CreateFixedSetPool(); std::unique_ptr AllocatePPDescriptorSet(VulkanDescriptorSetLayout* layout); VulkanFrameBuffer* fb = nullptr; std::unique_ptr HWBufferSetLayout; std::unique_ptr FixedSetLayout; std::vector> TextureSetLayouts; std::unique_ptr HWBufferDescriptorPool; std::unique_ptr FixedDescriptorPool; std::unique_ptr PPDescriptorPool; int TextureDescriptorSetsLeft = 0; int TextureDescriptorsLeft = 0; std::vector> TextureDescriptorPools; std::unique_ptr HWBufferSet; std::unique_ptr FixedSet; std::unique_ptr NullTextureDescriptorSet; std::list Materials; static const int maxSets = 10; };