renamed to DescriptorSetType instead of DescriptorSetsType
This commit is contained in:
@@ -112,18 +112,18 @@ bool RenderCmdBuffer::BindDescriptorSets(Renderable *ri)
|
||||
uint32_t count=0;
|
||||
|
||||
MaterialParameters *mp;
|
||||
VkDescriptorSet ds[(size_t)DescriptorSetsType::RANGE_SIZE];
|
||||
VkDescriptorSet ds[(size_t)DescriptorSetType::RANGE_SIZE];
|
||||
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
{
|
||||
mp=ri->GetMP((DescriptorSetsType)i);
|
||||
mp=ri->GetMP((DescriptorSetType)i);
|
||||
|
||||
if(mp)
|
||||
{
|
||||
ds[count]=mp->GetVkDescriptorSet();
|
||||
++count;
|
||||
|
||||
if((DescriptorSetsType)i==DescriptorSetsType::PerObject)
|
||||
if((DescriptorSetType)i==DescriptorSetType::PerObject)
|
||||
{
|
||||
dynamic_count=mp->GetCount();
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include"VKPipelineLayoutData.h"
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
DescriptorSet *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetsType &type)const
|
||||
DescriptorSet *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetType &type)const
|
||||
{
|
||||
RANGE_CHECK_RETURN_NULLPTR(type);
|
||||
|
||||
@@ -31,10 +31,10 @@ DescriptorSet *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,con
|
||||
return(new DescriptorSet(attr->device,binding_count,pld->pipeline_layout,desc_set));
|
||||
}
|
||||
|
||||
MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetsType &desc_set_type)
|
||||
MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetType &desc_set_type)
|
||||
{
|
||||
if(!mds||!pld)return(nullptr);
|
||||
if(!RangeCheck<DescriptorSetsType>(desc_set_type))
|
||||
if(!RangeCheck<DescriptorSetType>(desc_set_type))
|
||||
return(nullptr);
|
||||
|
||||
DescriptorSet *ds=CreateDescriptorSets(pld,desc_set_type);
|
||||
@@ -44,13 +44,13 @@ MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const
|
||||
#ifdef _DEBUG
|
||||
const UTF8String addr_string=HexToString<char,uint64_t>((uint64_t)(ds->GetDescriptorSet()));
|
||||
|
||||
LOG_INFO(U8_TEXT("Create [DescriptSets:")+addr_string+("] OK! Material Name: \"")+mds->GetMaterialName()+U8_TEXT("\" Type: ")+GetDescriptorSetsTypeName(desc_set_type));
|
||||
LOG_INFO(U8_TEXT("Create [DescriptSets:")+addr_string+("] OK! Material Name: \"")+mds->GetMaterialName()+U8_TEXT("\" Type: ")+GetDescriptorSetTypeName(desc_set_type));
|
||||
#endif//_DEBUG
|
||||
|
||||
return(new MaterialParameters(mds,desc_set_type,ds));
|
||||
}
|
||||
|
||||
MaterialParameters *GPUDevice::CreateMP(Material *mtl,const DescriptorSetsType &desc_set_type)
|
||||
MaterialParameters *GPUDevice::CreateMP(Material *mtl,const DescriptorSetType &desc_set_type)
|
||||
{
|
||||
if(!mtl)return(nullptr);
|
||||
|
||||
@@ -111,10 +111,10 @@ Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,ShaderModuleMap *
|
||||
|
||||
if(mds)
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,dst)
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,dst)
|
||||
{
|
||||
if(mds->hasSet((DescriptorSetsType)dst))
|
||||
data->mp_array[dst]=CreateMP(mds,pld,(DescriptorSetsType)dst);
|
||||
if(mds->hasSet((DescriptorSetType)dst))
|
||||
data->mp_array[dst]=CreateMP(mds,pld,(DescriptorSetType)dst);
|
||||
else
|
||||
data->mp_array[dst]=nullptr;
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
MaterialData::~MaterialData()
|
||||
{
|
||||
for(int i=0;i<int(DescriptorSetsType::RANGE_SIZE);i++)
|
||||
for(int i=0;i<int(DescriptorSetType::RANGE_SIZE);i++)
|
||||
if(mp_array[i])
|
||||
delete mp_array[i];
|
||||
|
||||
@@ -24,7 +24,7 @@ const VkPipelineLayout Material::GetPipelineLayout()const
|
||||
return data->pipeline_layout_data->pipeline_layout;
|
||||
}
|
||||
|
||||
const bool Material::hasSet(const DescriptorSetsType &dst)const
|
||||
const bool Material::hasSet(const DescriptorSetType &dst)const
|
||||
{
|
||||
return data->mds->hasSet(dst);
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc
|
||||
if(sd_count<=0)return;
|
||||
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
{
|
||||
dsl_ci[i].bindingCount=0;
|
||||
dsl_ci[i].pBindings=nullptr;
|
||||
@@ -47,10 +47,10 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc
|
||||
}
|
||||
}
|
||||
|
||||
VkDescriptorSetLayoutBinding *sds_ptr[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
VkDescriptorSetLayoutBinding *sds_ptr[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
if(dsl_ci[i].bindingCount>0)
|
||||
{
|
||||
dsl_ci[i].pBindings=new VkDescriptorSetLayoutBinding[dsl_ci[i].bindingCount];
|
||||
@@ -95,7 +95,7 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc
|
||||
|
||||
MaterialDescriptorSets::~MaterialDescriptorSets()
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
if(dsl_ci[i].bindingCount)
|
||||
delete[] dsl_ci[i].pBindings;
|
||||
|
||||
|
@@ -23,10 +23,10 @@ MaterialInstance::MaterialInstance(Material *mtl,VIL *v)
|
||||
|
||||
vil=v;
|
||||
|
||||
mp_per_mi=mtl->GetMP(DescriptorSetsType::PerMaterial);
|
||||
mp_per_mi=mtl->GetMP(DescriptorSetType::PerMaterial);
|
||||
}
|
||||
|
||||
bool MaterialInstance::BindUBO(const DescriptorSetsType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic)
|
||||
bool MaterialInstance::BindUBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic)
|
||||
{
|
||||
MaterialParameters *mp=GetMP(type);
|
||||
|
||||
@@ -39,7 +39,7 @@ bool MaterialInstance::BindUBO(const DescriptorSetsType &type,const AnsiString &
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool MaterialInstance::BindSSBO(const DescriptorSetsType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic)
|
||||
bool MaterialInstance::BindSSBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic)
|
||||
{
|
||||
MaterialParameters *mp=GetMP(type);
|
||||
|
||||
@@ -52,7 +52,7 @@ bool MaterialInstance::BindSSBO(const DescriptorSetsType &type,const AnsiString
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool MaterialInstance::BindSampler(const DescriptorSetsType &type,const AnsiString &name,Texture *tex,Sampler *sampler)
|
||||
bool MaterialInstance::BindSampler(const DescriptorSetType &type,const AnsiString &name,Texture *tex,Sampler *sampler)
|
||||
{
|
||||
MaterialParameters *mp=GetMP(type);
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/VKDescriptorSet.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetsType &type,DescriptorSet *ds)
|
||||
MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetType &type,DescriptorSet *ds)
|
||||
{
|
||||
mds=_mds;
|
||||
ds_type=type;
|
||||
|
@@ -10,9 +10,9 @@ PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptor
|
||||
|
||||
if(mds)
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
{
|
||||
const DescriptorSetLayoutCreateInfo *dslci=mds->GetDSLCI((DescriptorSetsType)i);
|
||||
const DescriptorSetLayoutCreateInfo *dslci=mds->GetDSLCI((DescriptorSetType)i);
|
||||
|
||||
if(!dslci||dslci->bindingCount<=0)
|
||||
continue;
|
||||
@@ -71,7 +71,7 @@ PipelineLayoutData::~PipelineLayoutData()
|
||||
{
|
||||
vkDestroyPipelineLayout(device,pipeline_layout,nullptr);
|
||||
|
||||
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
if(layouts[i])
|
||||
vkDestroyDescriptorSetLayout(device,layouts[i],nullptr);
|
||||
}
|
||||
|
@@ -9,10 +9,10 @@ struct PipelineLayoutData
|
||||
{
|
||||
VkDevice device;
|
||||
|
||||
int binding_count[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
VkDescriptorSetLayout layouts[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
int binding_count[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
VkDescriptorSetLayout layouts[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
|
||||
VkDescriptorSetLayout fin_dsl[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
VkDescriptorSetLayout fin_dsl[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
uint32_t fin_dsl_count;
|
||||
|
||||
VkPipelineLayout pipeline_layout;
|
||||
|
@@ -56,14 +56,14 @@ void LoadShaderDescriptor(const uint8 *data,ShaderDescriptor *sd_list,const uint
|
||||
}
|
||||
|
||||
if(ver==3)
|
||||
sd->set_type =(DescriptorSetsType)*data++;
|
||||
sd->set_type =(DescriptorSetType)*data++;
|
||||
else
|
||||
if(ver==2) //以下是旧的,未来不用了,现仅保证能运行
|
||||
{
|
||||
if(sd->name[0]=='g')sd->set_type=DescriptorSetsType::Global;else
|
||||
if(sd->name[0]=='m')sd->set_type=DescriptorSetsType::PerMaterial;else
|
||||
if(sd->name[0]=='r')sd->set_type=DescriptorSetsType::PerObject;else
|
||||
sd->set_type=DescriptorSetsType::PerFrame;
|
||||
if(sd->name[0]=='g')sd->set_type=DescriptorSetType::Global;else
|
||||
if(sd->name[0]=='m')sd->set_type=DescriptorSetType::PerMaterial;else
|
||||
if(sd->name[0]=='r')sd->set_type=DescriptorSetType::PerObject;else
|
||||
sd->set_type=DescriptorSetType::PerFrame;
|
||||
}
|
||||
|
||||
sd->set =*data++;
|
||||
@@ -71,7 +71,7 @@ void LoadShaderDescriptor(const uint8 *data,ShaderDescriptor *sd_list,const uint
|
||||
sd->stage_flag =*(uint32 *)data;
|
||||
data+=sizeof(uint32);
|
||||
|
||||
if(sd->set_type==DescriptorSetsType::PerObject)
|
||||
if(sd->set_type==DescriptorSetType::PerObject)
|
||||
{
|
||||
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;
|
||||
|
Reference in New Issue
Block a user