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;
|
2019-04-28 16:06:53 +08:00
|
|
|
|
class VertexShaderModule;
|
2019-04-26 22:39:27 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-04-26 23:46:03 +08:00
|
|
|
|
* 顶点输入状态实例<br>
|
|
|
|
|
* 本对象用于传递给MaterialInstance,用于已经确定好顶点格式的情况下,依然可修改部分设定(如instance)。
|
2019-04-26 22:39:27 +08:00
|
|
|
|
*/
|
|
|
|
|
class VertexAttributeBinding
|
|
|
|
|
{
|
2019-04-28 16:06:53 +08:00
|
|
|
|
VertexShaderModule *vsm;
|
2019-04-27 01:09:27 +08:00
|
|
|
|
uint32_t attr_count;
|
2019-04-26 22:39:27 +08:00
|
|
|
|
VkVertexInputBindingDescription *binding_list;
|
2019-04-27 01:09:27 +08:00
|
|
|
|
VkVertexInputAttributeDescription *attribute_list;
|
2019-04-26 22:39:27 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
2019-04-28 16:06:53 +08:00
|
|
|
|
friend class VertexShaderModule;
|
2019-04-26 22:39:27 +08:00
|
|
|
|
|
2019-04-28 16:06:53 +08:00
|
|
|
|
VertexAttributeBinding(VertexShaderModule *);
|
2019-04-26 22:39:27 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
~VertexAttributeBinding();
|
|
|
|
|
|
2019-04-28 16:06:53 +08:00
|
|
|
|
const uint GetBinding(const UTF8String &name); ///<取得一个变量的绑定点
|
2019-04-26 22:39:27 +08:00
|
|
|
|
|
2019-04-28 16:06:53 +08:00
|
|
|
|
bool SetInstance(const uint binding,bool instance);
|
|
|
|
|
bool SetStride (const uint binding,const uint32_t & stride);
|
|
|
|
|
bool SetFormat (const uint binding,const VkFormat & format);
|
|
|
|
|
bool SetOffset (const uint binding,const uint32_t offset);
|
2019-04-27 01:09:27 +08:00
|
|
|
|
|
2019-04-28 16:06:53 +08:00
|
|
|
|
bool SetInstance(const UTF8String &name,bool instance){return SetInstance(GetBinding(name),instance);}
|
|
|
|
|
bool SetStride (const UTF8String &name,const uint32_t &stride ){return SetStride (GetBinding(name),stride);}
|
|
|
|
|
bool SetFormat (const UTF8String &name,const VkFormat &format ){return SetFormat (GetBinding(name),format);}
|
|
|
|
|
bool SetOffset (const UTF8String &name,const uint32_t offset ){return SetOffset (GetBinding(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
|