for(AssignmentInfo *a: kvp.second.assignments)
unused_nodes.erase(a->node);
}
-
- if(!kvp.second.output && !kvp.second.referenced)
- {
- // Don't remove variables from inside interface blocks.
- if(!kvp.second.interface_block)
- unused_nodes.insert(kvp.first);
- }
- else if(kvp.second.interface_block)
- // Interface blocks are kept if even one member is used.
- unused_nodes.erase(kvp.second.interface_block);
+ else if(!kvp.second.referenced)
+ unused_nodes.insert(kvp.first);
}
NodeRemover().apply(s, unused_nodes);
return;
VariableInfo &var_info = variables[&var];
- var_info.interface_block = interface_block;
/* Mark variables as output if they're used by the next stage or the
graphics API. */
- if(interface_block)
- var_info.output = (interface_block->interface=="out" && (interface_block->linked_block || !interface_block->block_name.compare(0, 3, "gl_")));
- else
- var_info.output = (var.interface=="out" && (stage->type==Stage::FRAGMENT || var.linked_declaration || !var.name.compare(0, 3, "gl_")));
+ var_info.output = (var.interface=="out" && (stage->type==Stage::FRAGMENT || var.linked_declaration || !var.name.compare(0, 3, "gl_")));
if(var.init_expression)
{
struct VariableInfo
{
- InterfaceBlock *interface_block = 0;
std::vector<AssignmentInfo *> assignments;
bool initialized = false;
bool output = false;
Stage *stage = 0;
BlockVariableMap variables;
std::list<AssignmentInfo> assignments;
- InterfaceBlock *interface_block = 0;
Assignment *r_assignment = 0;
bool assignment_target = false;
bool r_side_effects = false;