2022-07-02 08:09:59 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-12-11 17:30:01 +00:00
|
|
|
#include "zvulkan/vulkanobjects.h"
|
2022-07-02 08:09:59 +00:00
|
|
|
#include <list>
|
2022-12-11 17:30:01 +00:00
|
|
|
#include "tarray.h"
|
2022-07-02 08:09:59 +00:00
|
|
|
|
2022-12-11 17:30:01 +00:00
|
|
|
class VulkanRenderDevice;
|
2022-07-02 08:09:59 +00:00
|
|
|
class VkMaterial;
|
|
|
|
class PPTextureInput;
|
|
|
|
class VkPPRenderPassSetup;
|
|
|
|
|
|
|
|
class VkDescriptorSetManager
|
|
|
|
{
|
|
|
|
public:
|
2022-12-11 17:30:01 +00:00
|
|
|
VkDescriptorSetManager(VulkanRenderDevice* fb);
|
2022-07-02 08:09:59 +00:00
|
|
|
~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<VulkanDescriptorSet> AllocateTextureDescriptorSet(int numLayers);
|
|
|
|
|
|
|
|
VulkanDescriptorSet* GetInput(VkPPRenderPassSetup* passSetup, const TArray<PPTextureInput>& textures, bool bindShadowMapBuffers);
|
|
|
|
|
|
|
|
void AddMaterial(VkMaterial* texture);
|
|
|
|
void RemoveMaterial(VkMaterial* texture);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void CreateHWBufferSetLayout();
|
|
|
|
void CreateFixedSetLayout();
|
|
|
|
void CreateHWBufferPool();
|
|
|
|
void CreateFixedSetPool();
|
|
|
|
|
|
|
|
std::unique_ptr<VulkanDescriptorSet> AllocatePPDescriptorSet(VulkanDescriptorSetLayout* layout);
|
|
|
|
|
2022-12-11 17:30:01 +00:00
|
|
|
VulkanRenderDevice* fb = nullptr;
|
2022-07-02 08:09:59 +00:00
|
|
|
|
|
|
|
std::unique_ptr<VulkanDescriptorSetLayout> HWBufferSetLayout;
|
|
|
|
std::unique_ptr<VulkanDescriptorSetLayout> FixedSetLayout;
|
|
|
|
std::vector<std::unique_ptr<VulkanDescriptorSetLayout>> TextureSetLayouts;
|
|
|
|
|
|
|
|
std::unique_ptr<VulkanDescriptorPool> HWBufferDescriptorPool;
|
|
|
|
std::unique_ptr<VulkanDescriptorPool> FixedDescriptorPool;
|
|
|
|
|
|
|
|
std::unique_ptr<VulkanDescriptorPool> PPDescriptorPool;
|
|
|
|
|
|
|
|
int TextureDescriptorSetsLeft = 0;
|
|
|
|
int TextureDescriptorsLeft = 0;
|
|
|
|
std::vector<std::unique_ptr<VulkanDescriptorPool>> TextureDescriptorPools;
|
|
|
|
|
|
|
|
std::unique_ptr<VulkanDescriptorSet> HWBufferSet;
|
|
|
|
std::unique_ptr<VulkanDescriptorSet> FixedSet;
|
|
|
|
std::unique_ptr<VulkanDescriptorSet> NullTextureDescriptorSet;
|
|
|
|
|
|
|
|
std::list<VkMaterial*> Materials;
|
|
|
|
|
|
|
|
static const int maxSets = 10;
|
|
|
|
};
|