VertexShaderModule删除GetLocation函数,GetBinding函数改名为GetStageInputBinding并增加注释以避免误会
This commit is contained in:
parent
33420244fa
commit
08bc2ab6df
@ -12,7 +12,7 @@ constexpr uint32_t SCREEN_HEIGHT=128;
|
|||||||
|
|
||||||
struct WorldConfig
|
struct WorldConfig
|
||||||
{
|
{
|
||||||
Matrix4f mvp;
|
Matrix4f mvp;
|
||||||
}world;
|
}world;
|
||||||
|
|
||||||
constexpr uint32_t VERTEX_COUNT=4;
|
constexpr uint32_t VERTEX_COUNT=4;
|
||||||
|
@ -9,8 +9,8 @@ using namespace hgl::graph;
|
|||||||
|
|
||||||
//void SaveToTOML(const OSString &filename,const VkGraphicsPipelineCreateInfo *info);
|
//void SaveToTOML(const OSString &filename,const VkGraphicsPipelineCreateInfo *info);
|
||||||
|
|
||||||
constexpr uint32_t SCREEN_WIDTH=1280;
|
constexpr uint32_t SCREEN_WIDTH=128;
|
||||||
constexpr uint32_t SCREEN_HEIGHT=720;
|
constexpr uint32_t SCREEN_HEIGHT=128;
|
||||||
|
|
||||||
struct WorldConfig
|
struct WorldConfig
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,8 @@ public:
|
|||||||
~Material();
|
~Material();
|
||||||
|
|
||||||
const int GetUBOBinding(const UTF8String &)const;
|
const int GetUBOBinding(const UTF8String &)const;
|
||||||
const int GetVBOBinding(const UTF8String &)const;
|
// const int GetSSBOBinding(const UTF8String &)const;
|
||||||
|
// const int GetINBOBinding(const UTF8String &)const;
|
||||||
|
|
||||||
const uint32_t GetStageCount ()const{return shader_stage_list->GetCount();}
|
const uint32_t GetStageCount ()const{return shader_stage_list->GetCount();}
|
||||||
const VkPipelineShaderStageCreateInfo * GetStages ()const{return shader_stage_list->GetData();}
|
const VkPipelineShaderStageCreateInfo * GetStages ()const{return shader_stage_list->GetData();}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#ifndef HGL_GRAPH_VULKAN_SHADER_MODULE_INCLUDE
|
#ifndef HGL_GRAPH_VULKAN_SHADER_MODULE_INCLUDE
|
||||||
#define HGL_GRAPH_VULKAN_SHADER_MODULE_INCLUDE
|
#define HGL_GRAPH_VULKAN_SHADER_MODULE_INCLUDE
|
||||||
|
|
||||||
#include"VK.h"
|
#include"VK.h"
|
||||||
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
|
||||||
using ShaderBindingList=List<uint32_t>; ///<shader绑定点列表
|
using ShaderBindingList=List<uint32_t>; ///<shader绑定点列表
|
||||||
|
|
||||||
class ShaderParse;
|
class ShaderParse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shader模块<br>
|
* Shader模块<br>
|
||||||
* 该模块提供的是原始的shader数据和信息,不可被修改,只能通过ShaderModuleManage创建和删除
|
* 该模块提供的是原始的shader数据和信息,不可被修改,只能通过ShaderModuleManage创建和删除
|
||||||
*/
|
*/
|
||||||
class ShaderModule
|
class ShaderModule
|
||||||
{
|
{
|
||||||
@ -57,14 +57,14 @@ public:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ShaderBindingList & GetUBOBindingList()const{return ubo_list;} ///<取得UBO绑定点列表
|
const ShaderBindingList & GetUBOBindingList()const{return ubo_list;} ///<取得UBO绑定点列表
|
||||||
};//class ShaderModule
|
};//class ShaderModule
|
||||||
|
|
||||||
class VertexAttributeBinding;
|
class VertexAttributeBinding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 顶点Shader模块<br>
|
* 顶点Shader模块<br>
|
||||||
* 由于顶点shader在最前方执行,所以它比其它shader多了VertexInput的数据
|
* 由于顶点shader在最前方执行,所以它比其它shader多了VertexInput的数据
|
||||||
*/
|
*/
|
||||||
class VertexShaderModule:public ShaderModule
|
class VertexShaderModule:public ShaderModule
|
||||||
{
|
{
|
||||||
@ -83,8 +83,10 @@ public:
|
|||||||
VertexShaderModule(VkDevice dev,int id,VkPipelineShaderStageCreateInfo *pssci,const ShaderParse *parse);
|
VertexShaderModule(VkDevice dev,int id,VkPipelineShaderStageCreateInfo *pssci,const ShaderParse *parse);
|
||||||
virtual ~VertexShaderModule();
|
virtual ~VertexShaderModule();
|
||||||
|
|
||||||
const int GetLocation (const UTF8String &)const;
|
/**
|
||||||
const int GetBinding (const UTF8String &)const;
|
* 获取输入流绑定点,需要注意的时,这里获取的binding并非是shader中的binding/location,而是绑定顺序的序列号。对应vkCmdBindVertexBuffer的缓冲区序列号
|
||||||
|
*/
|
||||||
|
const int GetStageInputBinding(const UTF8String &)const;
|
||||||
|
|
||||||
const uint32_t GetAttrCount()const{return attr_count;}
|
const uint32_t GetAttrCount()const{return attr_count;}
|
||||||
|
|
||||||
|
@ -29,17 +29,17 @@ public:
|
|||||||
|
|
||||||
~VertexAttributeBinding();
|
~VertexAttributeBinding();
|
||||||
|
|
||||||
const uint GetBinding(const UTF8String &name); ///<取得一个变量的绑定点
|
const uint GetStageInputBinding(const UTF8String &name); ///<取得一个变量的绑定点
|
||||||
|
|
||||||
bool SetInstance(const uint binding,bool instance);
|
bool SetInstance(const uint binding,bool instance);
|
||||||
bool SetStride (const uint binding,const uint32_t & stride);
|
bool SetStride (const uint binding,const uint32_t & stride);
|
||||||
bool SetFormat (const uint binding,const VkFormat & format);
|
bool SetFormat (const uint binding,const VkFormat & format);
|
||||||
bool SetOffset (const uint binding,const uint32_t offset);
|
bool SetOffset (const uint binding,const uint32_t offset);
|
||||||
|
|
||||||
bool SetInstance(const UTF8String &name,bool instance){return SetInstance(GetBinding(name),instance);}
|
bool SetInstance(const UTF8String &name,bool instance){return SetInstance(GetStageInputBinding(name),instance);}
|
||||||
bool SetStride (const UTF8String &name,const uint32_t &stride ){return SetStride (GetBinding(name),stride);}
|
bool SetStride (const UTF8String &name,const uint32_t &stride ){return SetStride (GetStageInputBinding(name),stride);}
|
||||||
bool SetFormat (const UTF8String &name,const VkFormat &format ){return SetFormat (GetBinding(name),format);}
|
bool SetFormat (const UTF8String &name,const VkFormat &format ){return SetFormat (GetStageInputBinding(name),format);}
|
||||||
bool SetOffset (const UTF8String &name,const uint32_t offset ){return SetOffset (GetBinding(name),offset);}
|
bool SetOffset (const UTF8String &name,const uint32_t offset ){return SetOffset (GetStageInputBinding(name),offset);}
|
||||||
|
|
||||||
void Write(VkPipelineVertexInputStateCreateInfo &vis)const;
|
void Write(VkPipelineVertexInputStateCreateInfo &vis)const;
|
||||||
};//class VertexAttributeBinding
|
};//class VertexAttributeBinding
|
||||||
|
@ -98,12 +98,13 @@ const int Material::GetUBOBinding(const UTF8String &name)const
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int Material::GetVBOBinding(const UTF8String &name)const
|
//const int Material::GetSSBOBinding(const UTF8String &name)const
|
||||||
{
|
//{
|
||||||
if(!vertex_sm)return(-1);
|
//}
|
||||||
|
//
|
||||||
return vertex_sm->GetBinding(name);
|
//const int Material::GetINBOBinding(const UTF8String &name)const
|
||||||
}
|
//{
|
||||||
|
//}
|
||||||
|
|
||||||
const VkPipelineLayout Material::GetPipelineLayout()const
|
const VkPipelineLayout Material::GetPipelineLayout()const
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,6 @@ bool Renderable::Set(const int binding,VertexBuffer *vbo,VkDeviceSize offset)
|
|||||||
|
|
||||||
bool Renderable::Set(const UTF8String &name,VertexBuffer *vbo,VkDeviceSize offset)
|
bool Renderable::Set(const UTF8String &name,VertexBuffer *vbo,VkDeviceSize offset)
|
||||||
{
|
{
|
||||||
return Set(vertex_sm->GetBinding(name),vbo,offset);
|
return Set(vertex_sm->GetStageInputBinding(name),vbo,offset);
|
||||||
}
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -84,19 +84,7 @@ VertexShaderModule::~VertexShaderModule()
|
|||||||
SAFE_CLEAR_ARRAY(attribute_list);
|
SAFE_CLEAR_ARRAY(attribute_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int VertexShaderModule::GetLocation(const UTF8String &name)const
|
const int VertexShaderModule::GetStageInputBinding(const UTF8String &name)const
|
||||||
{
|
|
||||||
if(name.IsEmpty())return -1;
|
|
||||||
|
|
||||||
VkVertexInputAttributeDescription *attr;
|
|
||||||
|
|
||||||
if(!stage_input_locations.Get(name,attr))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return attr->location;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int VertexShaderModule::GetBinding(const UTF8String &name)const
|
|
||||||
{
|
{
|
||||||
if(name.IsEmpty())return -1;
|
if(name.IsEmpty())return -1;
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ VertexAttributeBinding::~VertexAttributeBinding()
|
|||||||
vsm->Release(this);
|
vsm->Release(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint VertexAttributeBinding::GetBinding(const UTF8String &name)
|
const uint VertexAttributeBinding::GetStageInputBinding(const UTF8String &name)
|
||||||
{
|
{
|
||||||
return vsm->GetBinding(name);
|
return vsm->GetStageInputBinding(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VertexAttributeBinding::SetInstance(const uint index,bool instance)
|
bool VertexAttributeBinding::SetInstance(const uint index,bool instance)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user