public ControlFlowViewerViewModel(IExtendedShell extendedShell)
		{
			_graph = new CfgGraph();

			extendedShell.ActiveDocumentChanged += (sender, e) =>
			{
				Graph.RemoveVertexIf(x => true);
				Graph.Clear();

				var rewrittenInstructions = ExplicitBranchingRewriter.Rewrite(e.Editor.BytecodeContainer.Shader.InstructionTokens);
				var cfg = ControlFlowGraph.FromInstructions(rewrittenInstructions);

				var basicBlockLookup = cfg.BasicBlocks.ToDictionary(x => x, x => new BasicBlockViewModel(x));

				Graph.AddVertexRange(basicBlockLookup.Values);

				foreach (var basicBlock in cfg.BasicBlocks)
				{
					foreach (var successor in basicBlock.Successors)
						Graph.AddEdge(new CfgEdge(basicBlockLookup[basicBlock], basicBlockLookup[successor]));
					if (basicBlock.ImmediatePostDominator != null)
						Graph.AddEdge(new CfgEdge(basicBlockLookup[basicBlock],
							basicBlockLookup[basicBlock.ImmediatePostDominator])
						{
							IsImmediatePostDominatorEdge = true
						});
				}

				NotifyOfPropertyChange(() => LayoutAlgorithmType);
			};
		}
        public ControlFlowViewerViewModel(IExtendedShell extendedShell)
        {
            _graph = new CfgGraph();

            extendedShell.ActiveDocumentChanged += (sender, e) =>
            {
                Graph.RemoveVertexIf(x => true);
                Graph.Clear();

                var rewrittenInstructions = ExplicitBranchingRewriter.Rewrite(e.Editor.BytecodeContainer.Shader.InstructionTokens);
                var cfg = ControlFlowGraph.FromInstructions(rewrittenInstructions);

                var basicBlockLookup = cfg.BasicBlocks.ToDictionary(x => x, x => new BasicBlockViewModel(x));

                Graph.AddVertexRange(basicBlockLookup.Values);

                foreach (var basicBlock in cfg.BasicBlocks)
                {
                    foreach (var successor in basicBlock.Successors)
                    {
                        Graph.AddEdge(new CfgEdge(basicBlockLookup[basicBlock], basicBlockLookup[successor]));
                    }
                    if (basicBlock.ImmediatePostDominator != null)
                    {
                        Graph.AddEdge(new CfgEdge(basicBlockLookup[basicBlock],
                                                  basicBlockLookup[basicBlock.ImmediatePostDominator])
                        {
                            IsImmediatePostDominatorEdge = true
                        });
                    }
                }

                NotifyOfPropertyChange(() => LayoutAlgorithmType);
            };
        }
		public EditorViewModel(IPropertyGrid propertyGrid, IExtendedShell extendedShell)
		{
			_extendedShell = extendedShell;
			_propertyGrid = propertyGrid;
		}
Exemple #4
0
 public EditorProvider(IPropertyGrid propertyGrid, IExtendedShell extendedShell)
 {
     _propertyGrid  = propertyGrid;
     _extendedShell = extendedShell;
 }
 public EditorViewModel(IPropertyGrid propertyGrid, IExtendedShell extendedShell)
 {
     _extendedShell = extendedShell;
     _propertyGrid  = propertyGrid;
 }
		public EditorProvider(IPropertyGrid propertyGrid, IExtendedShell extendedShell)
		{
			_propertyGrid = propertyGrid;
			_extendedShell = extendedShell;
		}