#ifndef HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_SETS_INCLUDE #define HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_SETS_INCLUDE #include VK_NAMESPACE_BEGIN struct ShaderDescriptor { char name[128]; VkDescriptorType desc_type; DescriptorSetsType set_type; uint32_t set; uint32_t binding; uint32_t stage_flag; }; using ShaderDescriptorList=List; class MaterialDescriptorSets { UTF8String mtl_name; ShaderDescriptor *sd_list; uint sd_count; ShaderDescriptorList descriptor_list[VK_DESCRIPTOR_TYPE_RANGE_SIZE]; ShaderDescriptorList descriptor_list_by_set_type[size_t(DescriptorSetsType::RANGE_SIZE)]; Map sd_by_name; Map binding_map[VK_DESCRIPTOR_TYPE_RANGE_SIZE]; int *binding_list[VK_DESCRIPTOR_TYPE_RANGE_SIZE]; private: DescriptorSetLayoutCreateInfo dsl_ci[size_t(DescriptorSetsType::RANGE_SIZE)]; public: MaterialDescriptorSets(const UTF8String &,ShaderDescriptor *,const uint); ~MaterialDescriptorSets(); const UTF8String &GetMaterialName()const{return mtl_name;} const int GetBinding(const VkDescriptorType &desc_type,const AnsiString &name)const; 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 GetSampler (const AnsiString &name )const{return GetBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,name);} const int GetAttachment (const AnsiString &name )const{return GetBinding(VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,name);} const DescriptorSetLayoutCreateInfo *GetDSLCI(const DescriptorSetsType &type)const{return dsl_ci+size_t(type);} const ShaderDescriptorList &GetDescriptorList(const DescriptorSetsType &type)const{return descriptor_list_by_set_type[size_t(type)];} const bool hasSet(const DescriptorSetsType &type)const{return !descriptor_list_by_set_type[size_t(type)].IsEmpty();} };//class MaterialDescriptorSets VK_NAMESPACE_END #endif//HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_SETS_INCLUDE