use type instead of set in ShaderDescriptorSet. example "texture rect" can run OK.
This commit is contained in:
parent
2b70ee07c8
commit
713e76215c
@ -56,7 +56,7 @@ class GPUSemaphore;
|
||||
|
||||
enum class DescriptorSetType
|
||||
{
|
||||
//设计使其对应shader中的sets
|
||||
//设计使其对应shader中的set
|
||||
|
||||
Global=0, ///<全局参数(如太阳光等)
|
||||
Material, ///<材质中永远不变的参数
|
||||
@ -67,6 +67,8 @@ enum class DescriptorSetType
|
||||
ENUM_CLASS_RANGE(Global,Renderable)
|
||||
};//
|
||||
|
||||
const DescriptorSetType CheckDescriptorSetType(const char *str);
|
||||
|
||||
class DescriptorSetLayoutCreater;
|
||||
class DescriptorSets;
|
||||
|
||||
|
@ -21,7 +21,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
const DescriptorSetType GetType (){return ds_type;}
|
||||
const DescriptorSetType GetType (){return ds_type;}
|
||||
DescriptorSets * GetDescriptorSet (){return descriptor_sets;}
|
||||
const VkDescriptorSet GetVkDescriptorSet ()const{return descriptor_sets->GetDescriptorSet();}
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/type/List.h>
|
||||
#include<hgl/type/StringList.h>
|
||||
#include<hgl/graph/VKFormat.h>
|
||||
#include<hgl/graph/VKStruct.h>
|
||||
#include<hgl/graph/VK.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
@ -26,6 +25,7 @@ using ShaderStageList =ObjectList<ShaderStage>;
|
||||
struct ShaderDescriptor
|
||||
{
|
||||
char name[128];
|
||||
DescriptorSetType type;
|
||||
uint32_t set;
|
||||
uint32_t binding;
|
||||
};
|
||||
|
@ -34,9 +34,9 @@ void DescriptorSetLayoutCreater::Bind(const ShaderDescriptorList *sd_list,VkDesc
|
||||
|
||||
for(const ShaderDescriptor &sd:*sd_list)
|
||||
{
|
||||
all_set.Add(sd.set);
|
||||
all_set.Add(sd.type);
|
||||
|
||||
++binding_count[sd.set];
|
||||
++binding_count[(size_t)sd.type];
|
||||
}
|
||||
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
@ -54,16 +54,16 @@ void DescriptorSetLayoutCreater::Bind(const ShaderDescriptorList *sd_list,VkDesc
|
||||
|
||||
if(!all_binding.IsMember(sd.binding))
|
||||
{
|
||||
p[sd.set]->binding = sd.binding;
|
||||
p[sd.set]->descriptorType = desc_type;
|
||||
p[sd.set]->descriptorCount = 1;
|
||||
p[sd.set]->stageFlags = stageFlags;
|
||||
p[sd.set]->pImmutableSamplers = nullptr;
|
||||
p[(size_t)sd.type]->binding = sd.binding;
|
||||
p[(size_t)sd.type]->descriptorType = desc_type;
|
||||
p[(size_t)sd.type]->descriptorCount = 1;
|
||||
p[(size_t)sd.type]->stageFlags = stageFlags;
|
||||
p[(size_t)sd.type]->pImmutableSamplers = nullptr;
|
||||
|
||||
all_binding.Add(sd.binding);
|
||||
|
||||
++p[sd.set];
|
||||
++fin_count[sd.set];
|
||||
++p[(size_t)sd.type];
|
||||
++fin_count[(size_t)sd.type];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ class DescriptorSetLayoutCreater
|
||||
VkDevice device;
|
||||
VkDescriptorPool pool;
|
||||
|
||||
Sets<uint32_t> all_set;
|
||||
Sets<DescriptorSetType> all_set;
|
||||
Sets<uint32_t> all_binding;
|
||||
|
||||
struct ShaderDescriptorSet
|
||||
|
@ -5,6 +5,18 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
const DescriptorSetType CheckDescriptorSetType(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;
|
||||
}
|
||||
|
||||
return DescriptorSetType::Value;
|
||||
}
|
||||
|
||||
#define AccessByPointer(data,type) *(type *)data;data+=sizeof(type);
|
||||
|
||||
namespace
|
||||
@ -81,6 +93,8 @@ VK_NAMESPACE_BEGIN
|
||||
memcpy(sd->name,(char *)data,str_len);
|
||||
sd->name[str_len]=0;
|
||||
data+=str_len;
|
||||
|
||||
sd->type=CheckDescriptorSetType(sd->name);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user