From fd63acd644ec279d3f3b51473ad5e76570f67d25 Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 20 Jul 2017 17:18:08 -0500 Subject: [PATCH] ogl display method: dont crash when disposing if user's system can't compile shaders. also print some diagnostics for cgc failures to console --- Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs b/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs index 7bf1154656..0dd236b7b7 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs @@ -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;