public AMDDriverResultsPanel( IDXShaderReflection shader ) { InitializeComponent(); m_DXReflection = shader; btnScrutinize.Enabled = (shader.GetShaderType() == HLSLShaderType.VERTEX || shader.GetShaderType() == HLSLShaderType.PIXEL) ; }
public AMDDriverResultsPanel(IDXShaderReflection shader) { InitializeComponent(); m_DXReflection = shader; btnScrutinize.Enabled = (shader.GetShaderType() == HLSLShaderType.VERTEX || shader.GetShaderType() == HLSLShaderType.PIXEL || shader.GetShaderType() == HLSLShaderType.COMPUTE); }
public AMDDriverResultSet(IDXShaderReflection reflection) { m_Results = new AMDDriverResultsPanel(reflection); m_Analysis.Dock = DockStyle.Fill; m_Analysis.ReadOnly = true; m_Analysis.Multiline = true; m_Analysis.Font = new System.Drawing.Font("Lucida Console", 8); m_Results.AsicChanged += delegate(IAMDShader sh) { m_Analysis.Text = sh.PrintStats(); }; }
public IResultSet Compile(IShader shaderObj, IBackendOptions options) { if ( !(shaderObj is HLSLShader ) ) return null; HLSLShader shaderHLSL = shaderObj as HLSLShader; IHLSLOptions hlslOpts = shaderHLSL.CompileOptions; AMDDriverBackendOptions backendOptions = options as AMDDriverBackendOptions; string shader = shaderObj.Code; if (shaderHLSL.WasCompiledWithErrors) return null; try { // compile here if we must. Recycle existing blob if we can IDXShaderBlob blob = shaderHLSL.CompiledBlob; if ( blob == null ) { if (!shaderHLSL.Compile(m_FXC)) return null; blob = shaderHLSL.CompiledBlob; } IDXShaderReflection reflect = blob.Reflect(); IDXShaderBlob exe = blob.GetExecutableBlob(); if (exe == null) return null; byte[] bytes = exe.ReadBytes(); AMDDriverResultSet rs = new AMDDriverResultSet(reflect ); foreach (IAMDAsic a in m_Driver.Asics) { if (CompileForAsic(backendOptions.Asics, a.Name)) { IAMDShader sh = m_Driver.CompileDXBlob(a, bytes, reflect); rs.Add(sh); } } return rs; } catch( System.Exception ex ) { MessageBox.Show(ex.Message); return null; } }
public AMDDriverResultSet( IDXShaderReflection reflection ) { m_Results = new AMDDriverResultsPanel(reflection); m_Analysis.Dock = DockStyle.Fill; m_Analysis.ReadOnly = true; m_Analysis.Multiline = true; m_Analysis.Font = new System.Drawing.Font("Lucida Console", 8); m_Results.AsicChanged += delegate(IAMDShader sh) { m_Analysis.Text = sh.PrintStats(); }; }
public ScrutinizerForm( IAMDShader sh, IDXShaderReflection reflection) { InitializeComponent(); m_Reflection = reflection; switch( reflection.GetShaderType() ) { case HLSLShaderType.VERTEX: txtACMR.Enabled = true; txtPixels.Enabled = false; break; case HLSLShaderType.PIXEL: txtACMR.Enabled = false; txtPixels.Enabled = true; break; } try { Wrapper w = new Wrapper(); m_Backend = sh.CreateScrutinizer(); txtOccupancy.Text = m_Backend.GetDefaultOccupancy().ToString(); List<IInstruction> Ops = m_Backend.BuildProgram(); m_Ops = Ops; m_Blocks = Algorithms.BuildBasicBlocks(Ops); if (!Algorithms.IsCFGReducible(m_Blocks)) { MessageBox.Show("Non-reducible flow-graph detected. Can't analyze this."); return; } Algorithms.FindDominators(m_Blocks); m_Loops = Algorithms.FindLoops(m_Blocks); Algorithms.ClassifyBranches(m_Ops); Algorithms.AssignLabels(m_Ops); int Y = 0; if( reflection.GetShaderType() == HLSLShaderType.VERTEX ) { m_FetchShader = m_Backend.BuildDXFetchShader(reflection); Label l0 = new Label(); Label l1 = new Label(); l0.AutoSize = true; l1.AutoSize = true; l0.Text = "*** INSTRUCTIONS BELOW ARE AN APPROXIMATION TO THE FETCH SHADER***"; l1.Text = "******************************************************************"; l0.Left = 128; l1.Left = 128; panel1.Controls.Add(l0); Y = l0.Height; foreach( IInstruction op in m_FetchShader ) { InstructionWidget widget = new InstructionWidget(op); AddInstructionToPanel(widget, op); widget.Top = Y; widget.Left = 0; Y += widget.Height; } l1.Top = Y; panel1.Controls.Add(l1); Y += l1.Height; } foreach (BasicBlock b in m_Blocks) { foreach (IInstruction op in b.Instructions) { if( !String.IsNullOrEmpty(op.Label)) { Label l = new Label(); l.Font = new Font("Lucida Console", 8); l.AutoSize = true; l.Text = op.Label; l.Left = 100; l.Top = Y; panel1.Controls.Add(l); Y += l.Height; } InstructionWidget widget = new InstructionWidget(op); AddInstructionToPanel(widget, op); widget.Top = Y; widget.Left = 0; Y += widget.Height; } Y += 15; } cfgWidget1.SetProgram(m_Loops, m_Blocks); MarkExecutedInstructions(); } catch( System.Exception ex ) { MessageBox.Show(ex.Message); } }