ULRE/inc/hgl/graph/vulkan/VKMaterial.h

65 lines
2.1 KiB
C
Raw Normal View History

2019-04-25 10:09:56 +08:00
#ifndef HGL_GRAPH_VULKAN_MATERIAL_INCLUDE
#define HGL_GRAPH_VULKAN_MATERIAL_INCLUDE
#include"VK.h"
#include<hgl/type/Map.h>
#include<hgl/type/BaseString.h>
2019-04-25 10:09:56 +08:00
VK_NAMESPACE_BEGIN
2019-04-27 01:36:58 +08:00
class Device;
class ShaderModule;
class VertexShaderModule;
2019-04-25 10:09:56 +08:00
class DescriptorSetLayoutCreater;
2019-04-27 02:07:06 +08:00
class DescriptorSetLayout;
class VertexAttributeBinding;
class VertexBuffer;
class Renderable;
class PipelineLayout;
using ShaderModuleMap=hgl::Map<VkShaderStageFlagBits,const ShaderModule *>;
2019-04-25 10:09:56 +08:00
/**
* <br>
* shaderDescriptorSetLayoutCreater
*/
class Material
{
VkDevice device;
ShaderModuleMap *shader_maps;
VertexShaderModule *vertex_sm;
List<VkPipelineShaderStageCreateInfo> *shader_stage_list;
2019-04-27 02:07:06 +08:00
DescriptorSetLayoutCreater *dsl_creater;
DescriptorSetLayout *desc_set_layout;
VkPipelineLayout pipeline_layout;
VertexAttributeBinding *vab;
2019-04-25 10:09:56 +08:00
public:
Material(Device *dev,ShaderModuleMap *smm,VertexShaderModule *vsm,List<VkPipelineShaderStageCreateInfo> *,DescriptorSetLayoutCreater *dslc,DescriptorSetLayout *dsl,VkPipelineLayout pl,VertexAttributeBinding *v);
2019-04-25 10:09:56 +08:00
~Material();
const int GetUBOBinding(const UTF8String &)const;
const int GetVBOBinding(const UTF8String &)const;
const VkPipelineLayout GetPipelineLayout ()const{return pipeline_layout;}
const uint32_t GetStageCount ()const{return shader_stage_list->GetCount();}
const VkPipelineShaderStageCreateInfo * GetStages ()const{return shader_stage_list->GetData();}
const uint32_t GetDescriptorSetCount ()const;
const VkDescriptorSet * GetDescriptorSets ()const;
bool UpdateUBO(const uint32_t binding,const VkDescriptorBufferInfo *buf_info);
bool UpdateUBO(const UTF8String &name,const VkDescriptorBufferInfo *buf_info)
{
if(name.IsEmpty()||!buf_info)
return(false);
return UpdateUBO(GetUBOBinding(name),buf_info);
}
void Write(VkPipelineVertexInputStateCreateInfo &vis)const;
Renderable *CreateRenderable();
};//class Material
2019-04-25 10:09:56 +08:00
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_MATERIAL_INCLUDE