2019-04-19 00:46:49 +08:00
|
|
|
|
#ifndef HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE
|
2019-04-18 15:49:13 +08:00
|
|
|
|
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VK.h>
|
2019-04-23 02:46:47 +08:00
|
|
|
|
#include<hgl/type/Map.h>
|
2022-02-08 11:12:17 +08:00
|
|
|
|
#include<hgl/type/SortedSets.h>
|
2019-04-18 15:49:13 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2022-10-14 17:52:35 +08:00
|
|
|
|
class DeviceBuffer;
|
2019-04-19 00:46:49 +08:00
|
|
|
|
|
2023-02-13 11:48:53 +08:00
|
|
|
|
class DescriptorSet
|
2019-04-18 15:49:13 +08:00
|
|
|
|
{
|
2020-09-19 23:49:32 +08:00
|
|
|
|
VkDevice device;
|
2021-09-14 20:31:15 +08:00
|
|
|
|
int binding_count;
|
2019-05-20 17:52:23 +08:00
|
|
|
|
VkDescriptorSet desc_set;
|
2019-04-23 02:46:47 +08:00
|
|
|
|
|
2019-05-05 18:00:26 +08:00
|
|
|
|
VkPipelineLayout pipeline_layout;
|
|
|
|
|
|
2020-10-29 16:50:19 +08:00
|
|
|
|
ObjectList<VkDescriptorBufferInfo> buffer_list;
|
|
|
|
|
ObjectList<VkDescriptorImageInfo> image_list;
|
2020-09-07 20:07:08 +08:00
|
|
|
|
List<VkWriteDescriptorSet> wds_list;
|
2019-05-21 12:02:57 +08:00
|
|
|
|
|
2022-02-08 11:12:17 +08:00
|
|
|
|
SortedSets<uint32_t> binded_sets;
|
2021-09-27 21:09:04 +08:00
|
|
|
|
|
|
|
|
|
bool is_dirty;
|
|
|
|
|
|
2019-04-28 21:25:52 +08:00
|
|
|
|
private:
|
2019-04-18 15:49:13 +08:00
|
|
|
|
|
2021-09-14 20:31:15 +08:00
|
|
|
|
friend class GPUDevice;
|
2019-04-18 15:49:13 +08:00
|
|
|
|
|
2023-02-13 11:48:53 +08:00
|
|
|
|
DescriptorSet(VkDevice dev,const int bc,VkPipelineLayout pl,VkDescriptorSet ds)
|
2019-04-18 15:49:13 +08:00
|
|
|
|
{
|
2021-09-14 20:31:15 +08:00
|
|
|
|
device =dev;
|
|
|
|
|
binding_count =bc;
|
|
|
|
|
desc_set =ds;
|
|
|
|
|
pipeline_layout =pl;
|
2021-09-27 21:09:04 +08:00
|
|
|
|
|
|
|
|
|
is_dirty=true;
|
2019-04-18 15:49:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-28 21:25:52 +08:00
|
|
|
|
public:
|
2019-04-19 00:46:49 +08:00
|
|
|
|
|
2023-02-13 11:48:53 +08:00
|
|
|
|
~DescriptorSet()=default;
|
2019-04-23 02:46:47 +08:00
|
|
|
|
|
2021-09-14 20:31:15 +08:00
|
|
|
|
const uint32_t GetCount ()const{return binding_count;}
|
2021-06-16 20:29:25 +08:00
|
|
|
|
const VkDescriptorSet GetDescriptorSet ()const{return desc_set;}
|
2020-12-10 14:53:26 +08:00
|
|
|
|
const VkPipelineLayout GetPipelineLayout ()const{return pipeline_layout;}
|
2019-04-18 15:49:13 +08:00
|
|
|
|
|
2021-09-27 20:55:27 +08:00
|
|
|
|
const bool IsReady ()const{return wds_list.GetCount()==binding_count;}
|
|
|
|
|
|
2019-05-21 12:02:57 +08:00
|
|
|
|
void Clear();
|
2020-12-10 14:53:26 +08:00
|
|
|
|
|
2022-10-14 17:52:35 +08:00
|
|
|
|
bool BindUBO (const int binding,const DeviceBuffer *buf,bool dynamic=false);
|
|
|
|
|
bool BindUBO (const int binding,const DeviceBuffer *buf,const VkDeviceSize offset,const VkDeviceSize range,bool dynamic=false);
|
|
|
|
|
bool BindSSBO (const int binding,const DeviceBuffer *buf,bool dynamic=false);
|
|
|
|
|
bool BindSSBO (const int binding,const DeviceBuffer *buf,const VkDeviceSize offset,const VkDeviceSize range,bool dynamic=false);
|
2020-12-10 14:53:26 +08:00
|
|
|
|
|
2019-08-01 15:37:03 +08:00
|
|
|
|
bool BindSampler(const int binding,Texture *,Sampler *);
|
2022-03-28 17:41:25 +08:00
|
|
|
|
bool BindInputAttachment(const int binding,ImageView *);
|
2019-05-21 12:02:57 +08:00
|
|
|
|
void Update();
|
2023-02-13 11:48:53 +08:00
|
|
|
|
};//class DescriptorSet
|
2019-04-18 15:49:13 +08:00
|
|
|
|
VK_NAMESPACE_END
|
2019-04-19 00:46:49 +08:00
|
|
|
|
#endif//HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE
|