redefined VAB = VertexAttributeBinding

This commit is contained in:
hyzboy 2021-11-29 17:04:55 +08:00
parent af72c68ebe
commit 7d05d67cd2
8 changed files with 19 additions and 15 deletions

View File

@ -114,7 +114,9 @@ class MaterialInstance;
struct PipelineData; struct PipelineData;
enum class InlinePipeline; enum class InlinePipeline;
class Pipeline; class Pipeline;
class VertexAttributeBinding; class VertexAttributeBinding;
using VAB=VertexAttributeBinding;
class Renderable; class Renderable;
class RenderableInstance; class RenderableInstance;

View File

@ -15,7 +15,7 @@ struct MaterialData
MaterialDescriptorSets *mds; MaterialDescriptorSets *mds;
VertexShaderModule *vertex_sm; VertexShaderModule *vertex_sm;
VertexAttributeBinding *vbo; VertexAttributeBinding *vab;
List<VkPipelineShaderStageCreateInfo> shader_stage_list; List<VkPipelineShaderStageCreateInfo> shader_stage_list;
@ -63,7 +63,7 @@ public:
const VkPipelineLayout GetPipelineLayout ()const; const VkPipelineLayout GetPipelineLayout ()const;
const PipelineLayoutData * GetPipelineLayoutData ()const{return data->pipeline_layout_data;} const PipelineLayoutData * GetPipelineLayoutData ()const{return data->pipeline_layout_data;}
const VertexAttributeBinding * GetVBO ()const{return data->vbo;} const VertexAttributeBinding * GetVAB ()const{return data->vab;}
public: public:

View File

@ -86,8 +86,8 @@ public:
public: public:
VertexAttributeBinding * CreateVertexAttributeBinding(); VAB * CreateVAB();
bool Release(VertexAttributeBinding *); bool Release(VAB *);
const uint32_t GetInstanceCount()const{return vab_sets.GetCount();} const uint32_t GetInstanceCount()const{return vab_sets.GetCount();}
};//class VertexShaderModule:public ShaderModule };//class VertexShaderModule:public ShaderModule
VK_NAMESPACE_END VK_NAMESPACE_END

View File

@ -33,5 +33,7 @@ public:
const VkVertexInputBindingDescription * GetVertexBindingList ()const{return binding_list;} const VkVertexInputBindingDescription * GetVertexBindingList ()const{return binding_list;}
const VkVertexInputAttributeDescription * GetVertexAttributeList ()const{return attribute_list;} const VkVertexInputAttributeDescription * GetVertexAttributeList ()const{return attribute_list;}
};//class VertexAttributeBinding };//class VertexAttributeBinding
using VAB=VertexAttributeBinding;
VK_NAMESPACE_END VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIBUTE_BINDING_INCLUDE #endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIBUTE_BINDING_INCLUDE

View File

@ -104,7 +104,7 @@ Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,ShaderModuleMap *
data->shader_maps =shader_maps; data->shader_maps =shader_maps;
data->mds =mds; data->mds =mds;
data->vertex_sm =(VertexShaderModule *)vsm; data->vertex_sm =(VertexShaderModule *)vsm;
data->vbo =data->vertex_sm->CreateVertexAttributeBinding(); data->vab =data->vertex_sm->CreateVAB();
CreateShaderStageList(data->shader_stage_list,shader_maps); CreateShaderStageList(data->shader_stage_list,shader_maps);

View File

@ -9,10 +9,10 @@ MaterialData::~MaterialData()
SAFE_CLEAR(mp.r); SAFE_CLEAR(mp.r);
SAFE_CLEAR(mp.g); SAFE_CLEAR(mp.g);
if(vbo) if(vab)
{ {
vertex_sm->Release(vbo); vertex_sm->Release(vab);
delete vbo; delete vab;
} }
delete shader_maps; delete shader_maps;

View File

@ -27,13 +27,13 @@ Pipeline *RenderPass::CreatePipeline(const Material *material,PipelineData *data
{ {
VkPipeline graphicsPipeline; VkPipeline graphicsPipeline;
const VertexAttributeBinding *vbo=material->GetVBO(); const VAB *vab=material->GetVAB();
data->InitVertexInputState( material->GetStageCount(), data->InitVertexInputState( material->GetStageCount(),
material->GetStages(), material->GetStages(),
vbo->GetVertexAttrCount(), vab->GetVertexAttrCount(),
vbo->GetVertexBindingList(), vab->GetVertexBindingList(),
vbo->GetVertexAttributeList()); vab->GetVertexAttributeList());
data->SetColorAttachments(color_formats.GetCount()); data->SetColorAttachments(color_formats.GetCount());

View File

@ -88,16 +88,16 @@ VertexShaderModule::~VertexShaderModule()
SAFE_CLEAR_ARRAY(attribute_list); SAFE_CLEAR_ARRAY(attribute_list);
} }
VertexAttributeBinding *VertexShaderModule::CreateVertexAttributeBinding() VAB *VertexShaderModule::CreateVAB()
{ {
VertexAttributeBinding *vab=new VertexAttributeBinding(attr_count,binding_list,attribute_list); VAB *vab=new VAB(attr_count,binding_list,attribute_list);
vab_sets.Add(vab); vab_sets.Add(vab);
return(vab); return(vab);
} }
bool VertexShaderModule::Release(VertexAttributeBinding *vab) bool VertexShaderModule::Release(VAB *vab)
{ {
return vab_sets.Delete(vab); return vab_sets.Delete(vab);
} }