renamed type DescriptorSetType to DescriptorSetsType
This commit is contained in:
parent
e56730ec87
commit
7ba2d0cf6f
@ -67,7 +67,7 @@ private:
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp=material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp=material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp)return(false);
|
||||
|
||||
|
@ -38,7 +38,7 @@ constexpr VkFormat gbuffer_depth_format=PF_D16UN;
|
||||
|
||||
struct alignas(16) PhongPointLight
|
||||
{
|
||||
Vector3f color;
|
||||
Vector4f color;
|
||||
Vector4f position;
|
||||
float radius;
|
||||
};//
|
||||
@ -198,7 +198,7 @@ private:
|
||||
sampler=db->CreateSampler(&sampler_create_info);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=sp_gbuffer.material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=sp_gbuffer.material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -209,7 +209,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp=sp_gbuffer.material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp=sp_gbuffer.material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp)
|
||||
return(false);
|
||||
@ -220,7 +220,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=sp_composition.material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=sp_composition.material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -231,7 +231,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp=sp_composition.material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp=sp_composition.material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp)
|
||||
return(false);
|
||||
@ -379,8 +379,8 @@ public:
|
||||
|
||||
// White
|
||||
lights.position = Vector4f(0.0f, 0.0f, 50.0f, 0.0f);
|
||||
lights.color = Vector3f(105.0f);
|
||||
lights.radius = 150.0f;
|
||||
lights.color = Vector4f(1.0f);
|
||||
lights.radius = 15.0f;
|
||||
|
||||
lights.position.x = sin(hgl_rad2deg(timer/100)) * 100.0f;
|
||||
lights.position.y = cos(hgl_rad2deg(timer/100)) * 100.0f;
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
sampler=db->CreateSampler();
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -76,7 +76,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp=material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp=material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp)
|
||||
return(false);
|
||||
|
@ -167,7 +167,7 @@ private:
|
||||
sampler=db->CreateSampler();
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -178,7 +178,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp_texture)
|
||||
return(false);
|
||||
|
@ -61,7 +61,7 @@ private:
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
@ -161,7 +161,7 @@ private:
|
||||
if(!mir->material_instance)return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=mir->material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=mir->material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -172,7 +172,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp_texture=mir->material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp_texture=mir->material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp_texture)
|
||||
return(false);
|
||||
|
@ -130,7 +130,7 @@ private:
|
||||
if(!material_instance)return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp_texture)
|
||||
return(false);
|
||||
@ -213,7 +213,7 @@ private:
|
||||
ubo_phong=db->CreateUBO(sizeof(PhongMaterial),&phong);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp_value)
|
||||
return(false);
|
||||
@ -225,7 +225,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -236,7 +236,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=axis_mi->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=axis_mi->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=ro->material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=ro->material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -143,7 +143,7 @@ public:
|
||||
if(!cube.sampler)return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_texture=cube.material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp_texture=cube.material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp_texture)
|
||||
return(false);
|
||||
|
@ -61,7 +61,7 @@ private:
|
||||
sampler=db->CreateSampler();
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -72,7 +72,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp_texture)
|
||||
return(false);
|
||||
|
@ -71,7 +71,7 @@ private:
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
@ -70,7 +70,7 @@ private:
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
@ -75,7 +75,7 @@ private:
|
||||
sampler=db->CreateSampler();
|
||||
|
||||
{
|
||||
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value);
|
||||
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value);
|
||||
|
||||
if(!mp_texture)
|
||||
return(false);
|
||||
@ -103,7 +103,7 @@ private:
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
@ -71,7 +71,7 @@ private:
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
@ -39,7 +39,7 @@ namespace hgl
|
||||
MVPArrayBuffer *mvp_array;
|
||||
List<RenderableInstance *> ri_list;
|
||||
|
||||
VkDescriptorSet ds_list[(size_t)DescriptorSetType::RANGE_SIZE];
|
||||
VkDescriptorSet ds_list[(size_t)DescriptorSetsType::RANGE_SIZE];
|
||||
DescriptorSets *renderable_desc_sets;
|
||||
|
||||
uint32_t ubo_offset;
|
||||
@ -54,7 +54,7 @@ namespace hgl
|
||||
private:
|
||||
|
||||
Pipeline * last_pipeline;
|
||||
MaterialParameters *last_mp[(size_t)DescriptorSetType::RANGE_SIZE];
|
||||
MaterialParameters *last_mp[(size_t)DescriptorSetsType::RANGE_SIZE];
|
||||
uint32_t last_vbo;
|
||||
|
||||
void Render(RenderableInstance *);
|
||||
|
@ -69,7 +69,7 @@ class DeviceRenderPassManage;
|
||||
class GPUFence;
|
||||
class GPUSemaphore;
|
||||
|
||||
enum class DescriptorSetType
|
||||
enum class DescriptorSetsType
|
||||
{
|
||||
//设计使其对应shader中的set
|
||||
|
||||
@ -82,16 +82,16 @@ enum class DescriptorSetType
|
||||
ENUM_CLASS_RANGE(Global,Renderable)
|
||||
};//
|
||||
|
||||
const DescriptorSetType CheckDescriptorSetType(const char *str);
|
||||
const DescriptorSetsType CheckDescriptorSetsType(const char *str);
|
||||
|
||||
constexpr char *DescriptSetsTypeName[]=
|
||||
{
|
||||
"Global","Material","Value","Renderable"
|
||||
};
|
||||
|
||||
inline const char *GetDescriptorSetsTypeName(const enum class DescriptorSetType &type)
|
||||
inline const char *GetDescriptorSetsTypeName(const enum class DescriptorSetsType &type)
|
||||
{
|
||||
if(!ENUM_CLASS_RANGE_CHECK(DescriptorSetType,type))
|
||||
if(!ENUM_CLASS_RANGE_CHECK(DescriptorSetsType,type))
|
||||
return nullptr;
|
||||
|
||||
return DescriptSetsTypeName[(size_t)type];
|
||||
|
@ -196,9 +196,9 @@ public: //shader & material
|
||||
PipelineLayoutData *CreatePipelineLayoutData(const MaterialDescriptorSets *);
|
||||
void Destroy(PipelineLayoutData *);
|
||||
|
||||
DescriptorSets * CreateDescriptorSets(const PipelineLayoutData *,const DescriptorSetType &type)const;
|
||||
MaterialParameters *CreateMP(const MaterialDescriptorSets *,const PipelineLayoutData *,const DescriptorSetType &);
|
||||
MaterialParameters *CreateMP(Material *,const DescriptorSetType &);
|
||||
DescriptorSets * CreateDescriptorSets(const PipelineLayoutData *,const DescriptorSetsType &type)const;
|
||||
MaterialParameters *CreateMP(const MaterialDescriptorSets *,const PipelineLayoutData *,const DescriptorSetsType &);
|
||||
MaterialParameters *CreateMP(Material *,const DescriptorSetsType &);
|
||||
|
||||
ShaderModule *CreateShaderModule(ShaderResource *);
|
||||
|
||||
|
@ -70,11 +70,11 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
MaterialParameters * GetMP (const DescriptorSetType &type)
|
||||
MaterialParameters * GetMP (const DescriptorSetsType &type)
|
||||
{
|
||||
if(type==DescriptorSetType::Material )return data->mp.m;else
|
||||
if(type==DescriptorSetType::Renderable )return data->mp.r;else
|
||||
if(type==DescriptorSetType::Global )return data->mp.g;else
|
||||
if(type==DescriptorSetsType::Material )return data->mp.m;else
|
||||
if(type==DescriptorSetsType::Renderable )return data->mp.r;else
|
||||
if(type==DescriptorSetsType::Global )return data->mp.g;else
|
||||
return(nullptr);
|
||||
}
|
||||
};//class Material
|
||||
|
@ -10,7 +10,7 @@ struct ShaderDescriptor
|
||||
char name[128];
|
||||
|
||||
VkDescriptorType desc_type;
|
||||
DescriptorSetType set_type;
|
||||
DescriptorSetsType set_type;
|
||||
uint32_t set;
|
||||
uint32_t binding;
|
||||
uint32_t stage_flag;
|
||||
@ -34,7 +34,7 @@ class MaterialDescriptorSets
|
||||
|
||||
private:
|
||||
|
||||
DescriptorSetLayoutCreateInfo sds[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
DescriptorSetLayoutCreateInfo sds[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
|
||||
public:
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
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 DescriptorSetLayoutCreateInfo *GetBinding(const DescriptorSetType &type)const{return sds+size_t(type);}
|
||||
const DescriptorSetLayoutCreateInfo *GetBinding(const DescriptorSetsType &type)const{return sds+size_t(type);}
|
||||
};//class MaterialDescriptorSets
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_SETS_INCLUDE
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
Material *GetMaterial(){return material;}
|
||||
|
||||
MaterialParameters *GetMP(){return mp_value;}
|
||||
MaterialParameters *GetMP(const DescriptorSetType &type);
|
||||
MaterialParameters *GetMP(const DescriptorSetsType &type);
|
||||
};//class MaterialInstance
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_MATERIAL_INSTANCE_INCLUDE
|
||||
|
@ -9,7 +9,7 @@ class MaterialParameters
|
||||
{
|
||||
const MaterialDescriptorSets *mds;
|
||||
|
||||
DescriptorSetType ds_type;
|
||||
DescriptorSetsType ds_type;
|
||||
|
||||
DescriptorSets *descriptor_sets;
|
||||
|
||||
@ -17,11 +17,11 @@ private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
||||
MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetType &type,DescriptorSets *);
|
||||
MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetsType &type,DescriptorSets *);
|
||||
|
||||
public:
|
||||
|
||||
const DescriptorSetType GetType (){return ds_type;}
|
||||
const DescriptorSetsType GetType (){return ds_type;}
|
||||
DescriptorSets * GetDescriptorSet (){return descriptor_sets;}
|
||||
const VkDescriptorSet GetVkDescriptorSet ()const{return descriptor_sets->GetDescriptorSet();}
|
||||
|
||||
@ -30,7 +30,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
#define MP_TYPE_IS(name) const bool is##name()const{return ds_type==DescriptorSetType::name;}
|
||||
#define MP_TYPE_IS(name) const bool is##name()const{return ds_type==DescriptorSetsType::name;}
|
||||
MP_TYPE_IS(Material)
|
||||
// MP_TYPE_IS(Texture)
|
||||
MP_TYPE_IS(Value)
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
|
||||
const uint32_t GetBufferHash ()const{return buffer_hash;}
|
||||
|
||||
MaterialParameters *GetMP (const DescriptorSetType &type){return mat_inst->GetMP(type);}
|
||||
MaterialParameters *GetMP (const DescriptorSetsType &type){return mat_inst->GetMP(type);}
|
||||
};//class RenderableInstance
|
||||
|
||||
RenderableInstance *CreateRenderableInstance(Renderable *,MaterialInstance *,Pipeline *);
|
||||
|
@ -37,12 +37,12 @@ int Comparator<RenderNodePointer>::compare(const RenderNodePointer &obj_one,cons
|
||||
|
||||
//比较材质实例
|
||||
{
|
||||
for(int i =(int)hgl::graph::DescriptorSetType::BEGIN_RANGE;
|
||||
i<=(int)hgl::graph::DescriptorSetType::END_RANGE;
|
||||
for(int i =(int)hgl::graph::DescriptorSetsType::BEGIN_RANGE;
|
||||
i<=(int)hgl::graph::DescriptorSetsType::END_RANGE;
|
||||
i++)
|
||||
{
|
||||
off=ri_one->GetMP((hgl::graph::DescriptorSetType)i)
|
||||
-ri_two->GetMP((hgl::graph::DescriptorSetType)i);
|
||||
off=ri_one->GetMP((hgl::graph::DescriptorSetsType)i)
|
||||
-ri_two->GetMP((hgl::graph::DescriptorSetsType)i);
|
||||
|
||||
if(off)
|
||||
return off;
|
||||
@ -151,7 +151,7 @@ namespace hgl
|
||||
//为所有的材质绑定
|
||||
for(Material *mtl:material_sets)
|
||||
{
|
||||
MaterialParameters *mp=mtl->GetMP(DescriptorSetType::Renderable);
|
||||
MaterialParameters *mp=mtl->GetMP(DescriptorSetsType::Renderable);
|
||||
|
||||
if(mp)
|
||||
{
|
||||
@ -218,11 +218,11 @@ namespace hgl
|
||||
uint32_t first_set=0;
|
||||
MaterialParameters *mp;
|
||||
|
||||
for(int i=(int)DescriptorSetType::BEGIN_RANGE;
|
||||
i<(int)DescriptorSetType::Renderable;
|
||||
for(int i=(int)DescriptorSetsType::BEGIN_RANGE;
|
||||
i<(int)DescriptorSetsType::Renderable;
|
||||
i++)
|
||||
{
|
||||
mp=ri->GetMP((DescriptorSetType)i);
|
||||
mp=ri->GetMP((DescriptorSetsType)i);
|
||||
|
||||
if(last_mp[i]!=mp)
|
||||
{
|
||||
@ -242,7 +242,7 @@ namespace hgl
|
||||
}
|
||||
|
||||
{
|
||||
mp=ri->GetMP(DescriptorSetType::Renderable);
|
||||
mp=ri->GetMP(DescriptorSetsType::Renderable);
|
||||
|
||||
if(mp)
|
||||
{
|
||||
|
@ -112,18 +112,18 @@ bool RenderCmdBuffer::BindDescriptorSets(RenderableInstance *ri)
|
||||
uint32_t count=0;
|
||||
|
||||
MaterialParameters *mp;
|
||||
VkDescriptorSet ds[(size_t)DescriptorSetType::RANGE_SIZE];
|
||||
VkDescriptorSet ds[(size_t)DescriptorSetsType::RANGE_SIZE];
|
||||
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
{
|
||||
mp=ri->GetMP((DescriptorSetType)i);
|
||||
mp=ri->GetMP((DescriptorSetsType)i);
|
||||
|
||||
if(mp)
|
||||
{
|
||||
ds[count]=mp->GetVkDescriptorSet();
|
||||
++count;
|
||||
|
||||
if((DescriptorSetType)i==DescriptorSetType::Renderable)
|
||||
if((DescriptorSetsType)i==DescriptorSetsType::Renderable)
|
||||
{
|
||||
dynamic_count=mp->GetCount();
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include"VKPipelineLayoutData.h"
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
DescriptorSets *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetType &type)const
|
||||
DescriptorSets *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetsType &type)const
|
||||
{
|
||||
ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(DescriptorSetType,type);
|
||||
ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(DescriptorSetsType,type);
|
||||
|
||||
const uint32_t binding_count=pld->binding_count[size_t(type)];
|
||||
|
||||
@ -31,10 +31,10 @@ DescriptorSets *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,co
|
||||
return(new DescriptorSets(attr->device,binding_count,pld->pipeline_layout,desc_set));
|
||||
}
|
||||
|
||||
MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetType &desc_set_type)
|
||||
MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetsType &desc_set_type)
|
||||
{
|
||||
if(!mds||!pld)return(nullptr);
|
||||
if(!RangeCheck<DescriptorSetType>(desc_set_type))
|
||||
if(!RangeCheck<DescriptorSetsType>(desc_set_type))
|
||||
return(nullptr);
|
||||
|
||||
DescriptorSets *ds=CreateDescriptorSets(pld,desc_set_type);
|
||||
@ -50,7 +50,7 @@ MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const
|
||||
return(new MaterialParameters(mds,desc_set_type,ds));
|
||||
}
|
||||
|
||||
MaterialParameters *GPUDevice::CreateMP(Material *mtl,const DescriptorSetType &desc_set_type)
|
||||
MaterialParameters *GPUDevice::CreateMP(Material *mtl,const DescriptorSetsType &desc_set_type)
|
||||
{
|
||||
if(!mtl)return(nullptr);
|
||||
|
||||
@ -108,9 +108,9 @@ Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,ShaderModuleMap *
|
||||
|
||||
CreateShaderStageList(data->shader_stage_list,shader_maps);
|
||||
data->pipeline_layout_data=pld;
|
||||
data->mp.m=CreateMP(mds,pld,DescriptorSetType::Material );
|
||||
data->mp.r=CreateMP(mds,pld,DescriptorSetType::Renderable );
|
||||
data->mp.g=CreateMP(mds,pld,DescriptorSetType::Global );
|
||||
data->mp.m=CreateMP(mds,pld,DescriptorSetsType::Material );
|
||||
data->mp.r=CreateMP(mds,pld,DescriptorSetsType::Renderable );
|
||||
data->mp.g=CreateMP(mds,pld,DescriptorSetsType::Global );
|
||||
|
||||
return(new Material(data));
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc
|
||||
if(sd_count<=0)return;
|
||||
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
{
|
||||
sds[i].bindingCount=0;
|
||||
sds[i].pBindings=nullptr;
|
||||
@ -45,10 +45,10 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc
|
||||
}
|
||||
}
|
||||
|
||||
VkDescriptorSetLayoutBinding *sds_ptr[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
VkDescriptorSetLayoutBinding *sds_ptr[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
if(sds[i].bindingCount>0)
|
||||
{
|
||||
sds[i].pBindings=new VkDescriptorSetLayoutBinding[sds[i].bindingCount];
|
||||
@ -93,7 +93,7 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc
|
||||
|
||||
MaterialDescriptorSets::~MaterialDescriptorSets()
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
if(sds[i].bindingCount)
|
||||
delete[] sds[i].pBindings;
|
||||
|
||||
|
@ -8,7 +8,7 @@ MaterialInstance *GPUDevice::CreateMI(Material *mtl)
|
||||
{
|
||||
if(!mtl)return(nullptr);
|
||||
|
||||
MaterialParameters *mp=CreateMP(mtl,DescriptorSetType::Value);
|
||||
MaterialParameters *mp=CreateMP(mtl,DescriptorSetsType::Value);
|
||||
|
||||
return(new MaterialInstance(mtl,mp));
|
||||
}
|
||||
@ -25,12 +25,12 @@ MaterialInstance::~MaterialInstance()
|
||||
SAFE_CLEAR(mp_value);
|
||||
}
|
||||
|
||||
MaterialParameters *MaterialInstance::GetMP(const DescriptorSetType &type)
|
||||
MaterialParameters *MaterialInstance::GetMP(const DescriptorSetsType &type)
|
||||
{
|
||||
//if(type==DescriptorSetType::Texture
|
||||
//if(type==DescriptorSetsType::Texture
|
||||
// return mp_texture;
|
||||
|
||||
if(type==DescriptorSetType::Value)
|
||||
if(type==DescriptorSetsType::Value)
|
||||
return mp_value;
|
||||
|
||||
return material->GetMP(type);
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/VKDescriptorSets.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetType &type,DescriptorSets *ds)
|
||||
MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetsType &type,DescriptorSets *ds)
|
||||
{
|
||||
mds=_mds;
|
||||
ds_type=type;
|
||||
|
@ -8,9 +8,9 @@ PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptor
|
||||
{
|
||||
PipelineLayoutData *pld=hgl_zero_new<PipelineLayoutData>();
|
||||
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
{
|
||||
const DescriptorSetLayoutCreateInfo *dslci=mds->GetBinding((DescriptorSetType)i);
|
||||
const DescriptorSetLayoutCreateInfo *dslci=mds->GetBinding((DescriptorSetsType)i);
|
||||
|
||||
if(!dslci||dslci->bindingCount<=0)
|
||||
continue;
|
||||
@ -64,7 +64,7 @@ PipelineLayoutData::~PipelineLayoutData()
|
||||
{
|
||||
vkDestroyPipelineLayout(device,pipeline_layout,nullptr);
|
||||
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
if(layouts[i])
|
||||
vkDestroyDescriptorSetLayout(device,layouts[i],nullptr);
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ struct PipelineLayoutData
|
||||
{
|
||||
VkDevice device;
|
||||
|
||||
int binding_count[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
VkDescriptorSetLayout layouts[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
int binding_count[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
VkDescriptorSetLayout layouts[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
|
||||
VkDescriptorSetLayout fin_dsl[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
VkDescriptorSetLayout fin_dsl[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
uint32_t fin_dsl_count;
|
||||
|
||||
VkPipelineLayout pipeline_layout;
|
||||
|
@ -47,9 +47,9 @@ void LoadShaderDescriptor(const uint8 *data,ShaderDescriptor *sd_list,const uint
|
||||
sd->stage_flag =*(uint32 *)data;
|
||||
data+=sizeof(uint32);
|
||||
|
||||
sd->set_type=CheckDescriptorSetType(sd->name);
|
||||
sd->set_type=CheckDescriptorSetsType(sd->name);
|
||||
|
||||
if(sd->set_type==DescriptorSetType::Renderable)
|
||||
if(sd->set_type==DescriptorSetsType::Renderable)
|
||||
{
|
||||
if(sd->desc_type==VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER)sd->desc_type=VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;else
|
||||
if(sd->desc_type==VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)sd->desc_type=VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC;
|
||||
|
@ -5,16 +5,16 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
const DescriptorSetType CheckDescriptorSetType(const char *str)
|
||||
const DescriptorSetsType CheckDescriptorSetsType(const char *str)
|
||||
{
|
||||
if(str[1]=='_')
|
||||
{
|
||||
if(str[0]=='m')return DescriptorSetType::Material;
|
||||
if(str[0]=='g')return DescriptorSetType::Global;
|
||||
if(str[0]=='r')return DescriptorSetType::Renderable;
|
||||
if(str[0]=='m')return DescriptorSetsType::Material;
|
||||
if(str[0]=='g')return DescriptorSetsType::Global;
|
||||
if(str[0]=='r')return DescriptorSetsType::Renderable;
|
||||
}
|
||||
|
||||
return DescriptorSetType::Value;
|
||||
return DescriptorSetsType::Value;
|
||||
}
|
||||
|
||||
#define AccessByPointer(data,type) *(type *)data;data+=sizeof(type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user