static void EmitCalledFunctions (std::stringstream& shader, const FunctionSet& functions) { if (functions.empty()) return; for (FunctionSet::const_reverse_iterator fit = functions.rbegin(); fit != functions.rend(); fit++) // emit backwards, will put least used ones in front { shader << (*fit)->getPrototype() << ";\n"; } for (FunctionSet::const_reverse_iterator fit = functions.rbegin(); fit != functions.rend(); fit++) // emit backwards, will put least used ones in front { shader << (*fit)->getPrototype() << " {\n"; shader << (*fit)->getLocalDecls(1) << "\n"; shader << (*fit)->getCode() << "\n"; //has embedded } shader << "\n"; } }
static void EmitCalledFunctions (std::stringstream& shader, const FunctionSet& functions) { if (functions.empty()) return; // Functions must be emitted in reverse order as they are sorted topologically in top to bottom. for (FunctionSet::const_reverse_iterator fit = functions.rbegin(); fit != functions.rend(); fit++) { shader << "\n"; OutputLineDirective(shader, (*fit)->getLine()); shader << (*fit)->getPrototype() << " {\n"; shader << (*fit)->getCode() << "\n"; //has embedded } shader << "\n"; } }