mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-09 22:00:05 +00:00
Set function name
This commit is contained in:
parent
989563ad3f
commit
5de757621c
@ -1385,10 +1385,14 @@ string CompilerMSL::func_type_decl(SPIRType &type)
|
||||
// Ensures the function name is not "main", which is illegal in MSL
|
||||
string CompilerMSL::clean_func_name(string func_name)
|
||||
{
|
||||
static std::string _clean_msl_main_func_name = "mmain";
|
||||
if (_clean_msl_main_func_name.empty()) _clean_msl_main_func_name = "mmain";
|
||||
return (func_name == "main") ? _clean_msl_main_func_name : func_name;
|
||||
}
|
||||
|
||||
void CompilerMSL::set_func_name(std::string func_name) {
|
||||
_clean_msl_main_func_name = func_name;
|
||||
}
|
||||
|
||||
// Returns a string containing a comma-delimited list of args for the entry point function
|
||||
string CompilerMSL::entry_point_args(bool append_comma)
|
||||
{
|
||||
|
@ -94,6 +94,8 @@ public:
|
||||
|
||||
// Compiles the SPIR-V code into Metal Shading Language using default configuration parameters.
|
||||
std::string compile() override;
|
||||
|
||||
void set_func_name(std::string func_name);
|
||||
|
||||
protected:
|
||||
void emit_instruction(const Instruction &instr) override;
|
||||
@ -129,6 +131,7 @@ protected:
|
||||
void emit_function_declarations();
|
||||
|
||||
std::string func_type_decl(SPIRType &type);
|
||||
std::string _clean_msl_main_func_name;
|
||||
std::string clean_func_name(std::string func_name);
|
||||
std::string entry_point_args(bool append_comma);
|
||||
std::string get_entry_point_name();
|
||||
|
Loading…
Reference in New Issue
Block a user