add "hasInput(const char *name)" in ShaderDescriptorInfo and ShaderCreateInfoVertex classes.
This commit is contained in:
parent
ba8b44659b
commit
dd6b2f4fb3
@ -19,6 +19,8 @@ namespace hgl
|
||||
int AddInput(const graph::VAT &type,const AnsiString &name,const VkVertexInputRate input_rate=VK_VERTEX_INPUT_RATE_VERTEX,const VertexInputGroup &group=VertexInputGroup::Basic);
|
||||
int AddInput(const AnsiString &type,const AnsiString &name,const VkVertexInputRate input_rate=VK_VERTEX_INPUT_RATE_VERTEX,const VertexInputGroup &group=VertexInputGroup::Basic);
|
||||
|
||||
int hasInput(const char *);
|
||||
|
||||
void AddJoint();
|
||||
void AddAssign();
|
||||
};//class ShaderCreateInfoVertex:public ShaderCreateInfo
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
bool AddInput(ShaderAttribute *);
|
||||
bool AddOutput(ShaderAttribute *);
|
||||
|
||||
bool hasInput(const char *)const; ///<是否有指定输入
|
||||
|
||||
void AddStruct(const AnsiString &);
|
||||
bool AddUBO(DescriptorSetType type,const UBODescriptor *sd);
|
||||
bool AddSampler(DescriptorSetType type,const SamplerDescriptor *sd);
|
||||
|
@ -37,6 +37,11 @@ int ShaderCreateInfoVertex::AddInput(const AnsiString &type,const AnsiString &na
|
||||
return AddInput(vat,name,input_rate,group);
|
||||
}
|
||||
|
||||
int ShaderCreateInfoVertex::hasInput(const char *name)
|
||||
{
|
||||
return sdm->hasInput(name);
|
||||
}
|
||||
|
||||
void ShaderCreateInfoVertex::AddJoint()
|
||||
{
|
||||
AddInput(VAT_UVEC4, VAN::JointID, VK_VERTEX_INPUT_RATE_VERTEX,VertexInputGroup::JointID);
|
||||
|
@ -12,13 +12,13 @@ ShaderDescriptorInfo::ShaderDescriptorInfo(VkShaderStageFlagBits flag_bit)
|
||||
|
||||
namespace
|
||||
{
|
||||
bool Find(ShaderAttributeArray &sad,const ShaderAttribute *ss)
|
||||
bool Find(const ShaderAttributeArray &sad,const char *name)
|
||||
{
|
||||
if(sad.count<=0)
|
||||
return(false);
|
||||
|
||||
for(uint i=0;i<sad.count;i++)
|
||||
if(hgl::strcmp(sad.items[i].name,ss->name)==0)
|
||||
if(hgl::strcmp(sad.items[i].name,name)==0)
|
||||
return(true);
|
||||
|
||||
return(false);
|
||||
@ -29,7 +29,7 @@ bool ShaderDescriptorInfo::AddInput(ShaderAttribute *ss)
|
||||
{
|
||||
if(!ss)return(false);
|
||||
|
||||
if(Find(stage_io.input,ss))return(false);
|
||||
if(Find(stage_io.input,ss->name))return(false);
|
||||
|
||||
ss->location=stage_io.input.count;
|
||||
|
||||
@ -37,11 +37,20 @@ bool ShaderDescriptorInfo::AddInput(ShaderAttribute *ss)
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
bool ShaderDescriptorInfo::hasInput(const char *name)const
|
||||
{
|
||||
if(!name||!*name)return(false);
|
||||
|
||||
return Find(stage_io.input,name);
|
||||
|
||||
}
|
||||
|
||||
bool ShaderDescriptorInfo::AddOutput(ShaderAttribute *ss)
|
||||
{
|
||||
if(!ss)return(false);
|
||||
|
||||
if(Find(stage_io.output,ss))return(false);
|
||||
if(Find(stage_io.output,ss->name))return(false);
|
||||
|
||||
ss->location=stage_io.output.count;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user