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)); } } if (System.IO.File.Exists(opts.RGAPath)) { List <string> rgaAsics = RGABackend.GetAsicList(opts.RGAPath); foreach (string asic in rgaAsics) { int index = lstRGAAsics.Items.Add(asic); lstRGAAsics.SetItemChecked(index, !opts.IsRGAAsicDisabled(asic)); } } }
private void btnCompile_Click(object sender, EventArgs e) { if (m_CompileOptionsPanel == null) { return; } this.UseWaitCursor = true; ClearResults(); IResultSet SelectedResultSet = null; ICompileOptions opts = m_CompileOptionsPanel.ReadOptions(); IShader shader = null; switch (opts.Language) { case Languages.GLSL: shader = new GLSLShader(txtCode.Text, opts as IGLSLOptions); break; case Languages.HLSL: shader = new HLSLShader(txtCode.Text, opts as IHLSLOptions); break; default: throw new System.Exception("Unsupported language"); } foreach (IBackend backend in m_Backends) { if (m_Options.IsBackendDisabled(backend.Name)) { continue; } IBackendOptions options = null; if (backend is AMDDriverBackend) { AMDDriverBackend amdBackend = backend as AMDDriverBackend; List <string> requestedAsics = new List <string>(); foreach (string asic in amdBackend.Asics) { if (!m_Options.IsAMDAsicDisabled(asic)) { requestedAsics.Add(asic); } } AMDDriverBackendOptions backendOptions = new AMDDriverBackendOptions(requestedAsics); options = backendOptions; } else if (backend is CodeXLBackend) { CodeXLBackend codeXLBackend = backend as CodeXLBackend; List <string> requestedAsics = new List <string>(); foreach (string asic in codeXLBackend.Asics) { if (!m_Options.IsCodeXLAsicDisabled(asic)) { requestedAsics.Add(asic); } } CodeXLBackendOptions backendOptions = new CodeXLBackendOptions(requestedAsics); options = backendOptions; } IResultSet r = backend.Compile(shader, options); if (r != null) { if (r.Name.Equals(m_LastBackend)) { SelectedResultSet = r; } cmbBackend.Items.Add(r); } } if (cmbBackend.Items.Count > 0) { if (SelectedResultSet != null) { cmbBackend.SelectedIndex = cmbBackend.Items.IndexOf(SelectedResultSet); } else { cmbBackend.SelectedIndex = 0; } } else { m_LastBackend = ""; } this.UseWaitCursor = false; }