ULRE/inc/hgl/graph/VKDescriptorSet.h

63 lines
1.9 KiB
C
Raw Normal View History

#ifndef HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE
#define HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE
#include<hgl/graph/VK.h>
#include<hgl/type/Map.h>
2022-02-08 11:12:17 +08:00
#include<hgl/type/SortedSets.h>
VK_NAMESPACE_BEGIN
class DeviceBuffer;
class DescriptorSet
{
VkDevice device;
2021-09-14 20:31:15 +08:00
int binding_count;
VkDescriptorSet desc_set;
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;
2022-02-08 11:12:17 +08:00
SortedSets<uint32_t> binded_sets;
bool is_dirty;
private:
2021-09-14 20:31:15 +08:00
friend class GPUDevice;
DescriptorSet(VkDevice dev,const int bc,VkPipelineLayout pl,VkDescriptorSet ds)
{
2021-09-14 20:31:15 +08:00
device =dev;
binding_count =bc;
desc_set =ds;
pipeline_layout =pl;
is_dirty=true;
}
public:
~DescriptorSet()=default;
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;}
const VkPipelineLayout GetPipelineLayout ()const{return pipeline_layout;}
const bool IsReady ()const{return wds_list.GetCount()==binding_count;}
void Clear();
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);
2019-08-01 15:37:03 +08:00
bool BindSampler(const int binding,Texture *,Sampler *);
bool BindInputAttachment(const int binding,ImageView *);
void Update();
};//class DescriptorSet
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE