This commit is contained in:
2023-02-14 17:59:29 +08:00

View File

@@ -251,6 +251,17 @@ extern "C"
return VertexAttribBaseType::MAX; return VertexAttribBaseType::MAX;
} }
char *new_strcpy(const char *src)
{
int len=1+strlen(src);
char *str=new char[len];
memcpy(str,src,len);
return str;
}
struct ShaderStage struct ShaderStage
{ {
@@ -288,8 +299,7 @@ extern "C"
{ {
uint8_t input_attachment_index; uint8_t input_attachment_index;
}; };
}; };
}; };
struct ShaderResourceData struct ShaderResourceData
@@ -315,13 +325,7 @@ extern "C"
void Init() void Init()
{ {
memset(&input,0,sizeof(ShaderStageData)); memset(this,0,sizeof(SPVData));
memset(&output,0,sizeof(ShaderStageData));
memset(&resource,0,sizeof(resource));
memset(&push_constant,0,sizeof(ShaderResourceData));
memset(&subpass_input,0,sizeof(ShaderResourceData));
} }
void Clear() void Clear()
@@ -340,22 +344,18 @@ extern "C"
SPVData(const char *l,const char *dl) SPVData(const char *l,const char *dl)
{ {
Init();
result=false; result=false;
log=new char[strlen(l)+1]; log=new_strcpy(l);
strcpy(log,l); debug_log=new_strcpy(dl);
debug_log=new char[strlen(dl)+1];
strcpy(debug_log,dl);
spv_data=nullptr; spv_data=nullptr;
Init();
} }
SPVData(const char* log) : SPVData(log, log) SPVData(const char* log) : SPVData(log, log)
{ {
} }
SPVData(const std::vector<uint32_t> &spirv) SPVData(const std::vector<uint32_t> &spirv)