optimized codes of ShaderCreateInfo::ProcDefine
This commit is contained in:
parent
d17932c7a4
commit
ab6a8435a1
@ -183,7 +183,7 @@ public: //draw
|
||||
void DrawIndexed (const uint32_t index_count ) {vkCmdDrawIndexed(cmd_buf,index_count,1,0,0,0);}
|
||||
void Draw (const uint32_t vertex_count,const uint32_t instance_count) {vkCmdDraw(cmd_buf,vertex_count,instance_count,0,0);}
|
||||
void DrawIndexed (const uint32_t index_count ,const uint32_t instance_count) {vkCmdDrawIndexed(cmd_buf,index_count,instance_count,0,0,0);}
|
||||
|
||||
|
||||
template<typename ...ARGS> void Draw (ARGS...args) {vkCmdDraw(cmd_buf,args...);}
|
||||
template<typename ...ARGS> void DrawIndexed (ARGS...args) {vkCmdDrawIndexed(cmd_buf,args...);}
|
||||
|
||||
|
@ -67,9 +67,5 @@ public:
|
||||
bool AddSubpassInput(const AnsiString name,uint8_t index);
|
||||
|
||||
void SetPushConstant(const AnsiString name,uint8_t offset,uint8_t size);
|
||||
|
||||
#ifdef _DEBUG
|
||||
void DebugOutput(int);
|
||||
#endif//_DEBUG
|
||||
};//class ShaderDescriptorInfo
|
||||
}}//namespace hgl::graph
|
||||
|
@ -281,11 +281,11 @@ add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER}
|
||||
${TILE_SOURCE}
|
||||
${SG_VAD_SOURCE}
|
||||
|
||||
${FONT_MANAGE_SOURCE}
|
||||
${FONT_SOURCE}
|
||||
${FONT_SOURCE_OS}
|
||||
${TILE_FONT_SOURCE}
|
||||
${FONT_LAYOUT_SOURCE}
|
||||
${TEXT_RENDERABLE_SOURCE}
|
||||
# ${FONT_MANAGE_SOURCE}
|
||||
# ${FONT_SOURCE}
|
||||
# ${FONT_SOURCE_OS}
|
||||
# ${TILE_FONT_SOURCE}
|
||||
# ${FONT_LAYOUT_SOURCE}
|
||||
# ${TEXT_RENDERABLE_SOURCE}
|
||||
|
||||
${VULKAN_RENDER_SOURCE})
|
||||
|
@ -56,6 +56,7 @@ bool ShaderCreateInfo::ProcDefine()
|
||||
const uint32_t total_length=GLSL_DEFINE_FRONT_LENGTH+define_macro_max_length+define_value_max_length+3;
|
||||
|
||||
char *tmp=new char[total_length];
|
||||
char *p;
|
||||
|
||||
memcpy(tmp,GLSL_DEFINE_FRONT,GLSL_DEFINE_FRONT_LENGTH);
|
||||
|
||||
@ -65,6 +66,7 @@ bool ShaderCreateInfo::ProcDefine()
|
||||
AnsiString m;
|
||||
AnsiString v;
|
||||
|
||||
|
||||
for(uint i=0;i<count;i++)
|
||||
{
|
||||
m=define_macro_list.GetString(i);
|
||||
@ -73,15 +75,21 @@ bool ShaderCreateInfo::ProcDefine()
|
||||
macro_length=m.Length();
|
||||
value_length=v.Length();
|
||||
|
||||
memcpy(tmp+GLSL_DEFINE_FRONT_LENGTH,m.c_str(),macro_length);
|
||||
p=tmp+GLSL_DEFINE_FRONT_LENGTH;
|
||||
|
||||
tmp[GLSL_DEFINE_FRONT_LENGTH+macro_length]=' ';
|
||||
memcpy(p,m.c_str(),macro_length);
|
||||
|
||||
memcpy(tmp+GLSL_DEFINE_FRONT_LENGTH+macro_length+1,v.c_str(),value_length);
|
||||
p+=macro_length;
|
||||
|
||||
tmp[GLSL_DEFINE_FRONT_LENGTH+macro_length+1+value_length]='\n';
|
||||
*p=' ';
|
||||
++p;
|
||||
|
||||
final_shader.Strcat(tmp,GLSL_DEFINE_FRONT_LENGTH+macro_length+value_length+2);
|
||||
memcpy(p,v.c_str(),value_length);
|
||||
|
||||
p+=value_length;
|
||||
*p='\n';
|
||||
|
||||
final_shader.Strcat(tmp,p-tmp+1);
|
||||
}
|
||||
|
||||
delete[] tmp;
|
||||
@ -403,7 +411,7 @@ bool ShaderCreateInfo::CompileToSPV()
|
||||
|
||||
if(!spv_data)
|
||||
return(false);
|
||||
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user