diff --git a/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs b/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs index 349bc67819..65b5a30ed3 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs @@ -183,9 +183,9 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK //if the shaders arent available, the pipeline isn't either 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); + string errors = $"Vertex Shader:\r\n {vertexShader.Errors} \r\n-------\r\nFragment Shader:\r\n{fragmentShader.Errors}"; if (required) - throw new InvalidOperationException("Couldn't build required GL pipeline:\r\n" + errors); + 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; @@ -246,14 +246,14 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK if (errcode != ErrorCode.NoError) if (required) - throw new InvalidOperationException("Error creating pipeline (error returned from glLinkProgram): " + errcode + "\r\n\r\n" + resultLog); + throw new InvalidOperationException($"Error creating pipeline (error returned from glLinkProgram): {errcode}\r\n\r\n{resultLog}"); else success = false; int linkStatus; GL.GetProgram(pid, GetProgramParameterName.LinkStatus, out linkStatus); if (linkStatus == 0) if (required) - throw new InvalidOperationException("Error creating pipeline (link status false returned from glLinkProgram): " + "\r\n\r\n" + resultLog); + throw new InvalidOperationException($"Error creating pipeline (link status false returned from glLinkProgram): \r\n\r\n{resultLog}"); else success = false; //need to work on validation. apparently there are some weird caveats to glValidate which make it complicated and possibly excuses (barely) the intel drivers' dysfunctional operation @@ -271,11 +271,11 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK //errcode = GL.GetError(); //resultLog = GL.GetProgramInfoLog(pid); //if (errcode != ErrorCode.NoError) - // throw new InvalidOperationException("Error creating pipeline (error returned from glValidateProgram): " + errcode + "\r\n\r\n" + resultLog); + // throw new InvalidOperationException($"Error creating pipeline (error returned from glValidateProgram): {errcode}\r\n\r\n{resultLog}"); //int validateStatus; //GL.GetProgram(pid, GetProgramParameterName.ValidateStatus, out validateStatus); //if (validateStatus == 0) - // throw new InvalidOperationException("Error creating pipeline (validateStatus status false returned from glValidateProgram): " + "\r\n\r\n" + resultLog); + // throw new InvalidOperationException($"Error creating pipeline (validateStatus status false returned from glValidateProgram): \r\n\r\n{resultLog}"); //set the program to active, in case we need to set sampler uniforms on it GL.UseProgram(pid); @@ -724,7 +724,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK errcode = GL.GetError(); if (errcode != ErrorCode.NoError) if (required) - throw new InvalidOperationException("Error compiling shader (from previous operation) " + errcode); + throw new InvalidOperationException($"Error compiling shader (from previous operation) {errcode}"); else success = false; GL.ShaderSource(sid, source); @@ -732,7 +732,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK errcode = GL.GetError(); if (errcode != ErrorCode.NoError) if (required) - throw new InvalidOperationException("Error compiling shader (ShaderSource) " + errcode); + throw new InvalidOperationException($"Error compiling shader (ShaderSource) {errcode}"); else success = false; GL.CompileShader(sid); @@ -742,7 +742,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK if (errcode != ErrorCode.NoError) { - string message = "Error compiling shader (CompileShader) " + errcode + "\r\n\r\n" + resultLog; + string message = $"Error compiling shader (CompileShader) {errcode}\r\n\r\n{resultLog}"; if (required) throw new InvalidOperationException(message); else @@ -757,7 +757,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK if (n == 0) if (required) - throw new InvalidOperationException("Error compiling shader (CompileShader )" + "\r\n\r\n" + resultLog); + throw new InvalidOperationException($"Error compiling shader (CompileShader )\r\n\r\n{resultLog}"); else success = false; return success; diff --git a/Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs b/Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs index e437875303..b8d48b4981 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs @@ -210,7 +210,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX } catch (Exception ex) { - throw new InvalidOperationException("Error compiling shader: " + errors, ex); + throw new InvalidOperationException($"Error compiling shader: {errors}", ex); } sw.ps = new PixelShader(dev, bytecode); @@ -266,7 +266,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX } catch (Exception ex) { - throw new InvalidOperationException("Error compiling shader: " + errors, ex); + throw new InvalidOperationException($"Error compiling shader: {errors}", ex); } sw.vs = new VertexShader(dev, bytecode); @@ -381,9 +381,9 @@ 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); + string errors = $"Vertex Shader:\r\n {vertexShader.Errors} \r\n-------\r\nFragment Shader:\r\n{fragmentShader.Errors}"; if (required) - throw new InvalidOperationException("Couldn't build required GL pipeline:\r\n" + errors); + 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; @@ -466,11 +466,11 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX var handle = tuple.Item2; var descr = ct.GetConstantDescription(handle); - //Console.WriteLine("D3D UNIFORM: " + descr.Name); + //Console.WriteLine($"D3D UNIFORM: {descr.Name}"); if (descr.StructMembers != 0) { - string newprefix = prefix + descr.Name + "."; + string newprefix = $"{prefix}{descr.Name}."; for (int j = 0; j < descr.StructMembers; j++) { var subhandle = ct.GetConstant(handle, j); @@ -490,7 +490,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX { string key = name.TrimStart('$'); if (descr.Rows != 1) - key = key + "[0]"; + key += "[0]"; if (fs.MapCodeToNative != null && ct == fsct) if (fs.MapCodeToNative.ContainsKey(key)) name = fs.MapCodeToNative[key]; if (vs.MapCodeToNative != null && ct == vsct) if (vs.MapCodeToNative.ContainsKey(key)) name = vs.MapCodeToNative[key]; } diff --git a/Bizware/BizHawk.Bizware.BizwareGL/CGC.cs b/Bizware/BizHawk.Bizware.BizwareGL/CGC.cs index 572ed175f8..3b0f0de6df 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/CGC.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/CGC.cs @@ -21,7 +21,7 @@ namespace BizHawk.Bizware.BizwareGL private static string[] Escape(IEnumerable args) { - return args.Select(s => s.Contains(" ") ? string.Format("\"{0}\"", s) : s).ToArray(); + return args.Select(s => s.Contains(" ") ? $"\"{s}\"" : s).ToArray(); } public class Results @@ -105,7 +105,7 @@ namespace BizHawk.Bizware.BizwareGL if (hlslHacks) { - ret.Code = rxHlslSamplerCrashWorkaround.Replace(ret.Code, m => string.Format("({0}uniform sampler2D{1})", m.Groups[1].Value, m.Groups[3].Value)); + ret.Code = rxHlslSamplerCrashWorkaround.Replace(ret.Code, m => $"({m.Groups[1].Value}uniform sampler2D{m.Groups[3].Value})"); } //make variable name map diff --git a/Bizware/BizHawk.Bizware.BizwareGL/RenderTarget.cs b/Bizware/BizHawk.Bizware.BizwareGL/RenderTarget.cs index a71460c7ff..7eb44d6f5e 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/RenderTarget.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/RenderTarget.cs @@ -15,7 +15,7 @@ namespace BizHawk.Bizware.BizwareGL public override string ToString() { - return string.Format("GL RT: {0}x{1}", Texture2d.Width, Texture2d.Height); + return $"GL RT: {Texture2d.Width}x{Texture2d.Height}"; } public object Opaque { get; private set; } diff --git a/Bizware/BizHawk.Bizware.BizwareGL/RetroShader.cs b/Bizware/BizHawk.Bizware.BizwareGL/RetroShader.cs index d221d9f8d8..4b0c14564e 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/RetroShader.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/RetroShader.cs @@ -26,8 +26,8 @@ namespace BizHawk.Bizware.BizwareGL VertexLayout.Close(); string defines = "#define TEXCOORD TEXCOORD0\r\n"; //maybe not safe.. - string vsSource = "#define VERTEX\r\n" + defines + source; - string psSource = "#define FRAGMENT\r\n" + defines + source; + string vsSource = $"#define VERTEX\r\n{defines}{source}"; + string psSource = $"#define FRAGMENT\r\n{defines}{source}"; var vs = owner.CreateVertexShader(true, vsSource, "main_vertex", debug); var ps = owner.CreateFragmentShader(true, psSource, "main_fragment", debug); Pipeline = Owner.CreatePipeline(VertexLayout, vs, ps, debug, "retro"); diff --git a/Bizware/BizHawk.Bizware.BizwareGL/Texture2d.cs b/Bizware/BizHawk.Bizware.BizwareGL/Texture2d.cs index bb91f8b845..2f385ab56f 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/Texture2d.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/Texture2d.cs @@ -37,7 +37,7 @@ namespace BizHawk.Bizware.BizwareGL public override string ToString() { - return string.Format("GL Tex: {0}x{1}", Width, Height); + return $"GL Tex: {Width}x{Height}"; } public void LoadFrom(BitmapBuffer buffer)