diff --git a/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.Designer.cs b/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.Designer.cs index a19ef88888..ef2d4b1260 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.Designer.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.Designer.cs @@ -28,111 +28,112 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.btnOK = new System.Windows.Forms.Button(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.txtException = new System.Windows.Forms.TextBox(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.btnCopy = new System.Windows.Forms.Button(); - this.lblDone = new ExceptionBox.MyLabel(); - this.timer1 = new System.Windows.Forms.Timer(this.components); - this.tableLayoutPanel1.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // btnOK - // - this.btnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnOK.Location = new System.Drawing.Point(625, 304); - this.btnOK.Name = "btnOK"; - this.btnOK.Size = new System.Drawing.Size(75, 23); - this.btnOK.TabIndex = 0; - this.btnOK.Text = "OK"; - this.btnOK.UseVisualStyleBackColor = true; - this.btnOK.Click += new System.EventHandler(this.btnOK_Click); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.Controls.Add(this.btnOK, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.txtException, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(703, 330); - this.tableLayoutPanel1.TabIndex = 1; - // - // txtException - // - this.tableLayoutPanel1.SetColumnSpan(this.txtException, 2); - this.txtException.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtException.Location = new System.Drawing.Point(3, 3); - this.txtException.Multiline = true; - this.txtException.Name = "txtException"; - this.txtException.ReadOnly = true; - this.txtException.Size = new System.Drawing.Size(697, 295); - this.txtException.TabIndex = 1; - // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.AutoSize = true; - this.flowLayoutPanel1.Controls.Add(this.btnCopy); - this.flowLayoutPanel1.Controls.Add(this.lblDone); - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 301); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(87, 29); - this.flowLayoutPanel1.TabIndex = 2; - // - // btnCopy - // - this.btnCopy.Location = new System.Drawing.Point(3, 3); - this.btnCopy.Name = "btnCopy"; - this.btnCopy.Size = new System.Drawing.Size(75, 23); - this.btnCopy.TabIndex = 3; - this.btnCopy.Text = "Copy"; - this.btnCopy.UseVisualStyleBackColor = true; - this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click); - // - // lblDone - // - this.lblDone.AutoSize = true; - this.lblDone.Location = new System.Drawing.Point(84, 10); - this.lblDone.Margin = new System.Windows.Forms.Padding(3, 10, 3, 0); - this.lblDone.Name = "lblDone"; - this.lblDone.Size = new System.Drawing.Size(0, 13); - this.lblDone.TabIndex = 4; - // - // timer1 - // - this.timer1.Enabled = true; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); - // - // ExceptionBox - // - this.AcceptButton = this.btnOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnOK; - this.ClientSize = new System.Drawing.Size(703, 330); - this.Controls.Add(this.tableLayoutPanel1); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ExceptionBox"; - this.Text = "Exception"; - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - + this.components = new System.ComponentModel.Container(); + this.btnOK = new System.Windows.Forms.Button(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.txtException = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnCopy = new System.Windows.Forms.Button(); + this.lblDone = new BizHawk.Client.EmuHawk.ExceptionBox.MyLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // btnOK + // + this.btnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnOK.Location = new System.Drawing.Point(625, 304); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 0; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.btnOK, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.txtException, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(703, 330); + this.tableLayoutPanel1.TabIndex = 1; + // + // txtException + // + this.tableLayoutPanel1.SetColumnSpan(this.txtException, 2); + this.txtException.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtException.Location = new System.Drawing.Point(3, 3); + this.txtException.Multiline = true; + this.txtException.Name = "txtException"; + this.txtException.ReadOnly = true; + this.txtException.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtException.Size = new System.Drawing.Size(697, 295); + this.txtException.TabIndex = 1; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.Controls.Add(this.btnCopy); + this.flowLayoutPanel1.Controls.Add(this.lblDone); + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 301); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(87, 29); + this.flowLayoutPanel1.TabIndex = 2; + // + // btnCopy + // + this.btnCopy.Location = new System.Drawing.Point(3, 3); + this.btnCopy.Name = "btnCopy"; + this.btnCopy.Size = new System.Drawing.Size(75, 23); + this.btnCopy.TabIndex = 3; + this.btnCopy.Text = "Copy"; + this.btnCopy.UseVisualStyleBackColor = true; + this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click); + // + // lblDone + // + this.lblDone.AutoSize = true; + this.lblDone.Location = new System.Drawing.Point(84, 10); + this.lblDone.Margin = new System.Windows.Forms.Padding(3, 10, 3, 0); + this.lblDone.Name = "lblDone"; + this.lblDone.Size = new System.Drawing.Size(0, 13); + this.lblDone.TabIndex = 4; + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // ExceptionBox + // + this.AcceptButton = this.btnOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnOK; + this.ClientSize = new System.Drawing.Size(703, 330); + this.Controls.Add(this.tableLayoutPanel1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ExceptionBox"; + this.Text = "Exception"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + } #endregion diff --git a/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.cs b/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.cs index d7653991be..70bb677e5f 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.cs @@ -16,6 +16,13 @@ namespace BizHawk.Client.EmuHawk InitializeComponent(); txtException.Text = ex.ToString(); timer1.Start(); + } + + public ExceptionBox(string str) + { + InitializeComponent(); + txtException.Text = str; + timer1.Start(); } private void btnCopy_Click(object sender, EventArgs e) diff --git a/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.resx b/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.resx index 1f666f268b..aac33d5a29 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.resx +++ b/BizHawk.Client.EmuHawk/CustomControls/ExceptionBox.resx @@ -1,123 +1,123 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Retro.cs b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Retro.cs index 84d64a7ec5..56d5b87ab7 100644 --- a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Retro.cs +++ b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Retro.cs @@ -47,6 +47,7 @@ namespace BizHawk.Client.EmuHawk.Filters Passes = preset.Passes.ToArray(); bool ok = true; + Errors = ""; //load up the shaders Shaders = new RetroShader[preset.Passes.Count]; @@ -66,10 +67,11 @@ namespace BizHawk.Client.EmuHawk.Filters var shader = new RetroShader(Owner, content, debug); Shaders[i] = shader; - if (!shader.Pipeline.Available) - ok = false; if (!shader.Available) + { + Errors += string.Format("===================\r\nPass {0}:\r\n{1}",i,shader.Errors); ok = false; + } } Available = ok; @@ -84,6 +86,7 @@ namespace BizHawk.Client.EmuHawk.Filters /// Whether this shader chain is available (it wont be available if some resources failed to load or compile) /// public bool Available { get; private set; } + public string Errors { get; private set; } public readonly IGL Owner; public readonly RetroShaderPreset Preset; diff --git a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs index 322d1ecee9..b217fcbe27 100644 --- a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs +++ b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs @@ -210,15 +210,17 @@ namespace BizHawk.Client.EmuHawk.config //try compiling it bool ok = false; + string errors = ""; try { var filter = new BizHawk.Client.EmuHawk.Filters.RetroShaderChain(GlobalWin.GL, cgp, Path.GetDirectoryName(choice)); ok = filter.Available; + errors = filter.Errors; } catch {} if (!ok) { - MessageBox.Show("Selected filter could not be compiled."); + new ExceptionBox(errors).ShowDialog(); return; } } diff --git a/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs b/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs index ab84e962b1..dc15f2b654 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs @@ -182,7 +182,12 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK //if the shaders arent available, the pipeline isn't either if (!vertexShader.Available || !fragmentShader.Available) { - return new Pipeline(this, null, false, null, null, null); + string errors = string.Format("Vertex Shader:\r\n {0} \r\n-------\r\nFragment Shader:\r\n{1}", vertexShader.Errors, fragmentShader.Errors); + if (required) + throw new InvalidOperationException("Couldn't build required GL pipeline:\r\n" + errors); + var pipeline = new Pipeline(this, null, false, null, null, null); + pipeline.Errors = errors; + return pipeline; } bool success = true; diff --git a/Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs b/Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs index 58a70b07db..d1820cd181 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs @@ -209,11 +209,13 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX return s; } - catch + catch (Exception ex) { if (required) throw; - else return new Shader(this, null, false); + var s = new Shader(this, null, false); + s.Errors = ex.ToString(); + return s; } } @@ -247,6 +249,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX string profile = "vs_1_1"; if (cg) profile = "vs_3_0"; //todo - smarter logic somehow + bytecode = d3d9.ShaderBytecode.Compile(source, null, null, entry, profile, ShaderFlags.EnableBackwardsCompatibility, out errors); } catch (Exception ex) @@ -261,11 +264,13 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX sw.IGLShader = s; return s; } - catch + catch(Exception ex) { if (required) throw; - else return new Shader(this, null, false); + var s = new Shader(this, null, false); + s.Errors = ex.ToString(); + return s; } } @@ -362,9 +367,12 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX { if (!vertexShader.Available || !fragmentShader.Available) { + string errors = string.Format("Vertex Shader:\r\n {0} \r\n-------\r\nFragment Shader:\r\n{1}", vertexShader.Errors, fragmentShader.Errors); if (required) - throw new InvalidOperationException("Couldn't build required GL pipeline"); - else return new Pipeline(this, null, false, null, null,null); + throw new InvalidOperationException("Couldn't build required GL pipeline:\r\n" + errors); + var pipeline = new Pipeline(this, null, false, null, null, null); + pipeline.Errors = errors; + return pipeline; } VertexElement[] ves = new VertexElement[vertexLayout.Items.Count]; diff --git a/Bizware/BizHawk.Bizware.BizwareGL/Pipeline.cs b/Bizware/BizHawk.Bizware.BizwareGL/Pipeline.cs index af26834732..e27fc66a4c 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/Pipeline.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/Pipeline.cs @@ -87,6 +87,7 @@ namespace BizHawk.Bizware.BizwareGL public object Opaque { get; private set; } public VertexLayout VertexLayout { get; private set; } public bool Available { get; private set; } + public string Errors { get; set; } public void Dispose() { diff --git a/Bizware/BizHawk.Bizware.BizwareGL/RetroShader.cs b/Bizware/BizHawk.Bizware.BizwareGL/RetroShader.cs index 497d995a72..d6707a1d5e 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/RetroShader.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/RetroShader.cs @@ -62,6 +62,7 @@ namespace BizHawk.Bizware.BizwareGL } public bool Available { get; private set; } + public string Errors { get { return Pipeline.Errors; } } PipelineUniform sampler0; diff --git a/Bizware/BizHawk.Bizware.BizwareGL/Shader.cs b/Bizware/BizHawk.Bizware.BizwareGL/Shader.cs index eca5c40e89..7f8c275b74 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/Shader.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/Shader.cs @@ -15,11 +15,13 @@ namespace BizHawk.Bizware.BizwareGL Owner = owner; Opaque = opaque; Available = available; + Errors = ""; } public IGL Owner { get; private set; } public object Opaque { get; private set; } public bool Available { get; private set; } + public string Errors { get; set; } int RefCount;