public OptionsScreen( Options opts, List<IBackend> backends ) { InitializeComponent(); m_InitialOpts = opts; PopulateGUIFromOptions(opts); foreach (IBackend b in backends) lstBackends.Items.Add(b.Name); for (int i = 0; i < lstBackends.Items.Count; i++) lstBackends.SetItemChecked(i, !opts.IsBackendDisabled(backends[i].Name)); }
public MainForm( Options options, IWrapper wrapper ) { InitializeComponent(); m_Options = options; cmbBackend.DisplayMember = "Name"; cmbLanguage.DisplayMember = "Name"; List<ILanguage> languages = new List<ILanguage>(); languages.Add(new HLSLLanguage()); languages.Add(new GLSLLanguage()); m_Languages = languages; foreach (ILanguage l in m_Languages) cmbLanguage.Items.Add(l); cmbLanguage.SelectedIndex = 0; m_Wrapper = wrapper; CreateBackends(options); txtCode.AllowDrop = true; txtCode.DragEnter += delegate( object sender, DragEventArgs args ) { if (args.Data.GetDataPresent(DataFormats.FileDrop)) args.Effect = DragDropEffects.Move; else args.Effect = DragDropEffects.None; }; txtCode.DragDrop += delegate(object sender, DragEventArgs args) { if (args.Data.GetDataPresent(DataFormats.FileDrop)) { string[] paths = args.Data.GetData(DataFormats.FileDrop) as string[]; OpenFile(paths[0]); } }; }
public OptionsScreen( Options opts, List<IBackend> backends ) { InitializeComponent(); m_InitialOpts = opts; PopulateGUIFromOptions(opts); foreach (IBackend backend in backends) { int index = lstBackends.Items.Add(backend.Name); lstBackends.SetItemChecked(index,!opts.IsBackendDisabled(backend.Name)); } // #mivance refactor IBackend amdBackend = backends.Find(backend => backend.Name == "AMDDXX"); if (amdBackend is AMDDriverBackend) { AMDDriverBackend driver = amdBackend as AMDDriverBackend; foreach (string asic in driver.Asics) { int index = lstAMDAsics.Items.Add(asic); lstAMDAsics.SetItemChecked(index, !opts.IsAMDAsicDisabled(asic)); } } IBackend codeXLBackend = backends.Find(backend => backend.Name == "CodeXL"); if (codeXLBackend is CodeXLBackend) { CodeXLBackend driver = codeXLBackend as CodeXLBackend; foreach (string asic in driver.Asics) { int index = lstCodeXLAsics.Items.Add(asic); lstCodeXLAsics.SetItemChecked(index, !opts.IsCodeXLAsicDisabled(asic)); } } }
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { OptionsScreen opts = new OptionsScreen( m_Options, m_Backends ); if (opts.ShowDialog() != DialogResult.Cancel) { m_Options = opts.SelectedOptions; ClearResults(); CreateBackends(m_Options); } }
private void CreateBackends( Options opts ) { List<IBackend> backends = new List<IBackend>(); try { ID3DCompiler fxc = m_Wrapper.CreateD3DCompiler(opts.D3DCompilerPath); backends.Add(new D3DCompilerBackend(fxc)); try { IAMDDriver driver = m_Wrapper.CreateAMDDriver( opts.DXXDriverPath ); backends.Add( new AMDDriverBackend( driver, fxc )); } catch( System.Exception ex ) { MessageBox.Show( ex.Message ); } } catch( System.Exception ex ) { MessageBox.Show(ex.Message); } backends.Add(new CodeXLBackend(opts.CodeXLPath, opts.D3DCompilerPath, opts.TempPath)); backends.Add(new GLSlangBackend(m_Wrapper)); backends.Add(new GLSLOptimizerBackend(m_Wrapper)); backends.Add(new PowerVRBackend(opts.PowerVRCompilerPath, opts.TempPath)); backends.Add(new MaliSCBackend(opts.MaliSCRoot, opts.TempPath)); m_Backends = backends; }
public static Options Get() { string OptionsFile = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Pyramid\\options" ); Options defaults = GetDefaults(); if (!System.IO.File.Exists(OptionsFile)) return defaults; Options opts = new Options(); try { string[] lines = File.ReadAllLines(OptionsFile); Dictionary<string,string> map = new Dictionary<string,string>(); foreach( string s in lines ) { string[] keyval = s.Split('='); string key = keyval[0]; string value = keyval[1]; map.Add(key, value); } string d3dCompiler; if (!map.TryGetValue("D3DCompiler", out d3dCompiler)) d3dCompiler = defaults.D3DCompilerPath; string codeXL; if (!map.TryGetValue("CodeXL", out codeXL)) codeXL = defaults.CodeXLPath; string temp; if (!map.TryGetValue("temp", out temp)) temp = defaults.TempPath; string pvr; if (!map.TryGetValue("PowerVR", out pvr)) pvr = defaults.PowerVRCompilerPath; string dxx; if (!map.TryGetValue("DXX", out dxx)) dxx = defaults.DXXDriverPath; string mali; if (!map.TryGetValue("Mali", out mali)) mali = defaults.MaliSCRoot; string disabledBackends; if( map.TryGetValue("DisabledBackends", out disabledBackends)) opts.m_DisabledBackends.AddRange(disabledBackends.Split(',')); string disabledAMDAsics; if (map.TryGetValue("DisabledAMDAsics", out disabledAMDAsics)) opts.m_DisabledAMDAsics.AddRange(disabledAMDAsics.Split(',')); string disabledCodeXLAsics; if (map.TryGetValue("DisabledCodeXLAsics", out disabledCodeXLAsics)) opts.m_DisabledCodeXLAsics.AddRange(disabledCodeXLAsics.Split(',')); opts.D3DCompilerPath = d3dCompiler; opts.CodeXLPath = codeXL; opts.TempPath = temp; opts.PowerVRCompilerPath = pvr; opts.DXXDriverPath = dxx; opts.MaliSCRoot = mali; return opts; } catch (Exception e) { // not found MessageBox.Show(e.Message, "uh-oh, couldn't read options file", MessageBoxButtons.OK, MessageBoxIcon.Error); return GetDefaults(); } }
public static Options GetDefaults() { Options opts = new Options(); opts.D3DCompilerPath = "d3dcompiler_47.dll"; opts.CodeXLPath = "CodeXLAnalyzer.exe"; opts.PowerVRCompilerPath = "PowerVR"; opts.DXXDriverPath = "atidxx32.dll"; opts.MaliSCRoot = "MaliSC"; opts.TempPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Pyramid" ); return opts; }
private void PopulateGUIFromOptions(Options opts) { txtD3DCompiler.Text = opts.D3DCompilerPath; txtCodeXL.Text = opts.CodeXLPath; txtTemp.Text = opts.TempPath; txtPowerVR.Text = opts.PowerVRCompilerPath; txtDXX.Text = opts.DXXDriverPath; txtMali.Text = opts.MaliSCRoot; }
private void OptionsScreen_FormClosing(object sender, FormClosingEventArgs e) { if (this.DialogResult == DialogResult.Cancel) { SelectedOptions = m_InitialOpts; } else { SelectedOptions = new Options(); SelectedOptions.CodeXLPath = txtCodeXL.Text; SelectedOptions.D3DCompilerPath = txtD3DCompiler.Text; SelectedOptions.TempPath = txtTemp.Text; SelectedOptions.PowerVRCompilerPath = txtPowerVR.Text; SelectedOptions.DXXDriverPath = txtDXX.Text; SelectedOptions.MaliSCRoot = txtMali.Text ; for (int i = 0; i < lstBackends.Items.Count; i++) if (!lstBackends.GetItemChecked(i)) SelectedOptions.DisableBackend(lstBackends.Items[i].ToString()); } }
private void OptionsScreen_FormClosing(object sender, FormClosingEventArgs e) { if (this.DialogResult == DialogResult.Cancel) { SelectedOptions = m_InitialOpts; } else { SelectedOptions = new Options(); SelectedOptions.CodeXLPath = txtCodeXL.Text; SelectedOptions.D3DCompilerPath = txtD3DCompiler.Text; SelectedOptions.TempPath = txtTemp.Text; SelectedOptions.PowerVRCompilerPath = txtPowerVR.Text; SelectedOptions.DXXDriverPath = txtDXX.Text; SelectedOptions.MaliSCRoot = txtMali.Text ; for (int backendIndex = 0; backendIndex < lstBackends.Items.Count; backendIndex++) { if (!lstBackends.GetItemChecked(backendIndex)) SelectedOptions.DisableBackend(lstBackends.Items[backendIndex].ToString()); } for (int amdAsicIndex = 0; amdAsicIndex < lstAMDAsics.Items.Count; amdAsicIndex++) { if (!lstAMDAsics.GetItemChecked(amdAsicIndex)) { SelectedOptions.DisableAMDAsic(lstAMDAsics.Items[amdAsicIndex].ToString()); } } for (int codeXLAsicIndex = 0; codeXLAsicIndex < lstCodeXLAsics.Items.Count; codeXLAsicIndex++) { if (!lstCodeXLAsics.GetItemChecked(codeXLAsicIndex)) { SelectedOptions.DisableCodeXLAsic(lstCodeXLAsics.Items[codeXLAsicIndex].ToString()); } } } }