upgraded DescriptorBinding
This commit is contained in:
@@ -2,22 +2,30 @@
|
||||
#define HGL_GRAPH_DESCRIPTOR_BINDING_MANAGE_INCLUDE
|
||||
|
||||
#include<hgl/type/Map.h>
|
||||
#include<hgl/graph/VKDescriptorSetType.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
class DeviceBuffer;
|
||||
class Texture;
|
||||
class MaterialParameters;
|
||||
class MaterialInstance;
|
||||
|
||||
class DescriptorBinding
|
||||
{
|
||||
DescriptorSetType set_type;
|
||||
|
||||
Map<AnsiString,DeviceBuffer *> ubo_map;
|
||||
Map<AnsiString,DeviceBuffer *> ssbo_map;
|
||||
Map<AnsiString,Texture *> texture_map;
|
||||
|
||||
public:
|
||||
|
||||
DescriptorBinding(const DescriptorSetType &dst)
|
||||
{
|
||||
set_type=dst;
|
||||
}
|
||||
|
||||
bool AddUBO(const AnsiString &name,DeviceBuffer *buf)
|
||||
{
|
||||
if(!buf)return(false);
|
||||
@@ -84,7 +92,7 @@ namespace hgl
|
||||
texture_map.DeleteByValue(tex);
|
||||
}
|
||||
|
||||
bool Bind(MaterialParameters *);
|
||||
bool Bind(MaterialInstance *);
|
||||
};//class DescriptorBinding
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
@@ -49,11 +49,14 @@ class RenderResource
|
||||
IDResManage<TextureID, Texture> rm_textures; ///<纹理合集
|
||||
IDResManage<RenderableID, Renderable> rm_renderables; ///<渲染实例集合集
|
||||
|
||||
DescriptorBinding global_binding; ///<全局属性描述符绑定管理
|
||||
public:
|
||||
|
||||
//注:并非一定要走这里,这里只是提供一个注册和自动绑定的机制
|
||||
DescriptorBinding global_descriptor; ///<全局属性描述符绑定管理
|
||||
|
||||
public:
|
||||
|
||||
RenderResource(GPUDevice *dev):device(dev){}
|
||||
RenderResource(GPUDevice *dev):device(dev),global_descriptor(DescriptorSetType::Global){}
|
||||
virtual ~RenderResource()=default;
|
||||
|
||||
public: //Add
|
||||
@@ -67,13 +70,6 @@ public: //Add
|
||||
TextureID Add(Texture * t ){return rm_textures.Add(t);}
|
||||
RenderableID Add(Renderable * r ){return rm_renderables.Add(r);}
|
||||
|
||||
public: //全局属性(对应shader中的PerGlobal set合集)
|
||||
|
||||
void AddGlobalUBO(const AnsiString &name,DeviceBuffer *buf){global_binding.AddUBO(name,buf);}
|
||||
void AddGlobalSSBO(const AnsiString &name,DeviceBuffer *buf){global_binding.AddSSBO(name,buf);}
|
||||
|
||||
bool BindGlobal(MaterialInstance *mi){return global_binding.Bind(mi->GetMP(DescriptorSetType::Global));}
|
||||
|
||||
public: // VBO/VAO
|
||||
|
||||
VBO *CreateVBO(VkFormat format,uint32_t count,const void *data,SharingMode sm=SharingMode::Exclusive);
|
||||
|
Reference in New Issue
Block a user