Exemplo n.º 1
0
void FunctionManager::destroy_functions_in_set(FunctionSet &function_set)
{
    // We iterate over the set like this because destroy_function() will erase
    // the function from function_set, thereby invalidating any iterator we are
    // holding on to.
    while (!function_set.empty())
    {
        destroy_function(*function_set.begin());
    }
}
Exemplo n.º 2
0
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";
	}
}
Exemplo n.º 3
0
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";
	}
}