+ProgramBuilder::InterfaceFlags ProgramBuilder::ShaderVariable::get_interface_flags(VariableScope scope) const
+{
+ /* Uniforms are available to all stages and are not passed through
+ interfaces */
+ if(variable->scope==UNIFORM)
+ return NO_INTERFACE;
+
+ int flags = NO_INTERFACE;
+
+ for(list<ShaderVariable *>::const_iterator i=referenced_by.begin(); i!=referenced_by.end(); ++i)
+ {
+ /* Variables used in a later scope than they are declared in need to go
+ through the interface */
+ if((*i)->variable->scope>scope && variable->scope<=scope)
+ flags |= OUTPUT;
+ if((*i)->variable->scope>=scope && variable->scope<scope)
+ if(!inlined || variable->scope!=ATTRIBUTE || scope!=VERTEX)
+ flags |= INPUT;
+ }
+
+ // Variables without any references are goals and also outputs.
+ if(referenced_by.empty() && variable->scope==scope)
+ flags |= OUTPUT|GOAL;
+
+ return static_cast<InterfaceFlags>(flags);
+}
+