Pass main function name in MSLConfiguration

This commit is contained in:
Polona Caserman 2017-01-23 12:04:12 +01:00
Родитель 91ccd21fc9
Коммит 945494d211
2 изменённых файлов: 5 добавлений и 10 удалений

Просмотреть файл

@ -54,6 +54,10 @@ string CompilerMSL::compile(MSLConfiguration &msl_cfg, vector<MSLVertexAttr> *p_
// Remember the input parameters
msl_config = msl_cfg;
// Set main function name if it was explicitly set
if (!msl_config.entry_point_name.empty())
set_name(entry_point, msl_config.entry_point_name);
vtx_attrs_by_location.clear();
if (p_vtx_attrs)
for (auto &va : *p_vtx_attrs)
@ -1270,13 +1274,6 @@ string CompilerMSL::clean_func_name(string func_name)
return (iter != func_name_overrides.end()) ? iter->second : func_name;
}
void CompilerMSL::set_entry_point_name(string func_name)
{
if (func_name.find("main") == std::string::npos)
func_name += "_main";
meta.at(entry_point).decoration.alias = 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)
{

Просмотреть файл

@ -29,10 +29,10 @@ namespace spirv_cross
// Options for compiling to Metal Shading Language
struct MSLConfiguration
{
uint32_t vtx_attr_stage_in_binding = 0;
bool flip_vert_y = false;
bool flip_frag_y = false;
bool is_rendering_points = false;
std::string entry_point_name;
};
// Defines MSL characteristics of a vertex attribute at a particular location.
@ -93,8 +93,6 @@ public:
// Compiles the SPIR-V code into Metal Shading Language using default configuration parameters.
std::string compile() override;
void set_entry_point_name(std::string func_name);
protected:
void emit_instruction(const Instruction &instr) override;
void emit_glsl_op(uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args,