ULRE/example/Vulkan/VKVertexAttributeBinding.h

48 lines
1.6 KiB
C
Raw Normal View History

2019-04-26 23:46:03 +08:00
#ifndef HGL_GRAPH_VULKAN_VERTEX_ATTRIBUTE_BINDING_INCLUDE
2019-04-26 22:39:27 +08:00
#define HGL_GRAPH_VULKAN_VERTEX_ATTRIBUTE_BINDING_INCLUDE
#include"VK.h"
#include<hgl/type/BaseString.h>
VK_NAMESPACE_BEGIN
class VertexBuffer;
class IndexBuffer;
class Shader;
/**
2019-04-26 23:46:03 +08:00
* <br>
* MaterialInstance,(instance)
2019-04-26 22:39:27 +08:00
*/
class VertexAttributeBinding
{
Shader *shader;
uint32_t attr_count;
2019-04-26 22:39:27 +08:00
VkVertexInputBindingDescription *binding_list;
VkVertexInputAttributeDescription *attribute_list;
2019-04-26 22:39:27 +08:00
private:
friend class Shader;
VertexAttributeBinding(Shader *);
public:
~VertexAttributeBinding();
const uint GetIndex(const UTF8String &name);
2019-04-26 22:39:27 +08:00
bool SetInstance(const uint index,bool instance);
bool SetStride (const uint index,const uint32_t & stride);
bool SetFormat (const uint index,const VkFormat & format);
bool SetOffset (const uint index,const uint32_t offset);
bool SetInstance(const UTF8String &name,bool instance){return SetInstance(GetIndex(name),instance);}
bool SetStride (const UTF8String &name,const uint32_t &stride ){return SetStride (GetIndex(name),stride);}
bool SetFormat (const UTF8String &name,const VkFormat &format ){return SetFormat (GetIndex(name),format);}
bool SetOffset (const UTF8String &name,const uint32_t offset ){return SetOffset (GetIndex(name),offset);}
2019-04-27 00:48:49 +08:00
2019-04-26 22:39:27 +08:00
void Write(VkPipelineVertexInputStateCreateInfo &vis)const;
};//class VertexAttributeBinding
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIBUTE_BINDING_INCLUDE