better error handling in shader compiling. kind of sloppy, but gets the job done. entire system could use a little rethinking, if i ever revisit filters

This commit is contained in:
zeromus 2016-02-03 02:28:03 -06:00
parent 0b1f01cf2f
commit e0d74c7718
10 changed files with 267 additions and 237 deletions

View File

@ -28,111 +28,112 @@
/// </summary>
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

View File

@ -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)

View File

@ -1,123 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -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)
/// </summary>
public bool Available { get; private set; }
public string Errors { get; private set; }
public readonly IGL Owner;
public readonly RetroShaderPreset Preset;

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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];

View File

@ -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()
{

View File

@ -62,6 +62,7 @@ namespace BizHawk.Bizware.BizwareGL
}
public bool Available { get; private set; }
public string Errors { get { return Pipeline.Errors; } }
PipelineUniform sampler0;

View File

@ -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;