ogl display method: dont crash when disposing if user's system can't compile shaders. also print some diagnostics for cgc failures to console

This commit is contained in:
zeromus 2017-07-20 17:18:08 -05:00
parent 7880cbabb3
commit fd63acd644
1 changed files with 10 additions and 1 deletions

View File

@ -346,6 +346,11 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
public void FreePipeline(Pipeline pipeline)
{
var pw = pipeline.Opaque as PipelineWrapper;
//unavailable pipelines will have no opaque
if (pw == null)
return;
GL.DeleteProgram(pw.pid);
pw.FragmentShader.Release();
@ -686,9 +691,13 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
{
var cgc = new CGC();
var results = cgc.Run(source, entry, type == ShaderType.FragmentShader ? "glslf" : "glslv", false);
if (!results.Succeeded)
{
Console.WriteLine("CGC failed");
Console.WriteLine(results.Errors);
return new Shader(this, null, false);
}
source = results.Code;
sw.MapCodeToNative = results.MapCodeToNative;