Improved VKDescriptorBindingManage

This commit is contained in:
2024-03-06 00:26:23 +08:00
parent ff6a644e8f
commit 5f1c60a24a
5 changed files with 42 additions and 43 deletions

View File

@@ -26,7 +26,10 @@ constexpr size_t VK_DESCRIPTOR_TYPE_RANGE_SIZE=VK_DESCRIPTOR_TYPE_END_RANGE-VK_D
#endif//VK_DESCRIPTOR_TYPE_RANGE_SIZE
using CharPointerList=hgl::List<const char *>;
using BindingMapping=Map<uint32_t,int>;
using BindingMapping =Map<uint32_t,int>;
using BindingMap =Map<AnsiString, int>;
using BindingMapArray =BindingMap[VK_DESCRIPTOR_TYPE_RANGE_SIZE];
class VulkanInstance;
class GPUPhysicalDevice;

View File

@@ -1,8 +1,9 @@
#ifndef HGL_GRAPH_DESCRIPTOR_BINDING_MANAGE_INCLUDE
#ifndef HGL_GRAPH_DESCRIPTOR_BINDING_MANAGE_INCLUDE
#define HGL_GRAPH_DESCRIPTOR_BINDING_MANAGE_INCLUDE
#include<hgl/type/Map.h>
#include<hgl/type/String.h>
#include<hgl/graph/VK.h>
#include<hgl/graph/VKDescriptorSetType.h>
namespace hgl
{
@@ -11,10 +12,15 @@ namespace hgl
class DeviceBuffer;
class Texture;
class Material;
class MaterialParameters;
/**
* 描述符绑定器<Br>
* 一般用于注册通用数据,为材质进行自动绑定。
*/
class DescriptorBinding
{
DescriptorSetType set_type;
DescriptorSetType set_type; ///<描述符合集类型
Map<AnsiString,DeviceBuffer *> ubo_map;
Map<AnsiString,DeviceBuffer *> ssbo_map;
@@ -93,6 +99,12 @@ namespace hgl
texture_map.DeleteByValue(tex);
}
private:
void BindUBO(MaterialParameters *,const BindingMap &);
public:
bool Bind(Material *);
};//class DescriptorBinding
}//namespace graph

View File

@@ -5,9 +5,6 @@
#include<hgl/graph/VKShaderDescriptorSet.h>
VK_NAMESPACE_BEGIN
using BindingMap=Map<AnsiString,int>;
using BindingMapArray=BindingMap[VK_DESCRIPTOR_TYPE_RANGE_SIZE];
class MaterialDescriptorManager
{
UTF8String mtl_name;