2023-03-20 13:55:47 +08:00
|
|
|
#ifndef HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_MANAGER_INCLUDE
|
|
|
|
#define HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_MANAGER_INCLUDE
|
2021-09-13 20:39:25 +08:00
|
|
|
|
|
|
|
#include<hgl/graph/VK.h>
|
2023-03-20 22:09:37 +08:00
|
|
|
#include<hgl/graph/VKShaderDescriptorSet.h>
|
2021-09-13 20:39:25 +08:00
|
|
|
|
|
|
|
VK_NAMESPACE_BEGIN
|
2023-03-20 13:55:47 +08:00
|
|
|
class MaterialDescriptorManager
|
2021-09-13 20:39:25 +08:00
|
|
|
{
|
2021-09-27 20:54:49 +08:00
|
|
|
UTF8String mtl_name;
|
|
|
|
|
2021-09-13 20:39:25 +08:00
|
|
|
Map<AnsiString,int> binding_map[VK_DESCRIPTOR_TYPE_RANGE_SIZE];
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2023-03-20 13:51:25 +08:00
|
|
|
VkDescriptorSetLayoutBinding *all_dslb;
|
|
|
|
|
2023-03-20 13:35:04 +08:00
|
|
|
DescriptorSetLayoutCreateInfo dsl_ci[DESCRIPTOR_SET_TYPE_COUNT];
|
2021-09-13 20:39:25 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2023-03-20 13:55:47 +08:00
|
|
|
MaterialDescriptorManager(const UTF8String &,ShaderDescriptor *,const uint);
|
2023-03-20 22:09:37 +08:00
|
|
|
MaterialDescriptorManager(const UTF8String &,const ShaderDescriptorSetArray &);
|
2023-03-20 13:55:47 +08:00
|
|
|
~MaterialDescriptorManager();
|
2021-09-13 20:39:25 +08:00
|
|
|
|
2021-09-27 20:54:49 +08:00
|
|
|
const UTF8String &GetMaterialName()const{return mtl_name;}
|
|
|
|
|
2021-09-13 20:39:25 +08:00
|
|
|
const int GetBinding(const VkDescriptorType &desc_type,const AnsiString &name)const;
|
|
|
|
|
2023-02-23 13:25:05 +08:00
|
|
|
const int GetUBO (const AnsiString &name,bool dynamic)const{return GetBinding(dynamic?VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,name);}
|
|
|
|
const int GetSSBO (const AnsiString &name,bool dynamic)const{return GetBinding(dynamic?VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,name);}
|
|
|
|
const int GetImageSampler (const AnsiString &name )const{return GetBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,name);}
|
|
|
|
const int GetInputAttachment(const AnsiString &name )const{return GetBinding(VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,name);}
|
2021-09-13 20:39:25 +08:00
|
|
|
|
2023-02-22 21:53:51 +08:00
|
|
|
const DescriptorSetLayoutCreateInfo *GetDSLCI(const DescriptorSetType &type)const{return dsl_ci+size_t(type);}
|
2023-02-22 21:50:18 +08:00
|
|
|
|
2023-03-20 22:09:37 +08:00
|
|
|
const bool hasSet(const DescriptorSetType &type)const{return dsl_ci[size_t(type)].bindingCount>0;}
|
2023-03-19 20:18:56 +08:00
|
|
|
//!sd_list_by_set_type[size_t(type)].IsEmpty();}
|
2023-03-20 13:55:47 +08:00
|
|
|
};//class MaterialDescriptorManager
|
2021-09-13 20:39:25 +08:00
|
|
|
VK_NAMESPACE_END
|
2023-03-20 13:55:47 +08:00
|
|
|
#endif//HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_MANAGER_INCLUDE
|