| 197 | } |
| 198 | } |
| 199 | List<String> ShaderIR::GetComponentDependencyOrder() |
| 200 | { |
| 201 | List<String> result, workList; |
| 202 | HashSet<String> set; |
| 203 | for (auto & comp : DefinitionsByComponent) |
| 204 | { |
| 205 | bool emptyDependency = true; |
| 206 | for (auto & def : comp.Value) |
| 207 | if (def.Value->Dependency.Count()) |
| 208 | { |
| 209 | emptyDependency = false; |
| 210 | break; |
| 211 | } |
| 212 | if (emptyDependency) |
| 213 | { |
| 214 | workList.Add(comp.Key); |
| 215 | } |
| 216 | } |
| 217 | for (int i = 0; i < workList.Count(); i++) |
| 218 | { |
| 219 | auto comp = workList[i]; |
| 220 | if (!set.Contains(comp)) |
| 221 | { |
| 222 | bool insertable = true; |
| 223 | for (auto & def : DefinitionsByComponent[comp]()) |
| 224 | { |
| 225 | for (auto & dep : def.Value->Dependency) |
| 226 | if (!set.Contains(dep->UniqueName)) |
| 227 | { |
| 228 | insertable = false; |
| 229 | goto breakLoc; |
| 230 | } |
| 231 | } |
| 232 | breakLoc:; |
| 233 | if (insertable) |
| 234 | { |
| 235 | if (set.Add(comp)) |
| 236 | { |
| 237 | result.Add(comp); |
| 238 | for (auto & def : DefinitionsByComponent[comp]()) |
| 239 | for (auto & user : def.Value->Users) |
| 240 | workList.Add(user->UniqueName); |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | return result; |
| 246 | } |
| 247 | EnumerableHashSet<ComponentDefinitionIR*>& ComponentDefinitionIR::GetComponentFunctionDependencyClosure() |
| 248 | { |
| 249 | if (dependencyClosure.Count() || Dependency.Count() == 0) |
no test coverage detected