diff --git a/src/OpenTK/Graphics/ES20/Helper.cs b/src/OpenTK/Graphics/ES20/Helper.cs index 21aefd7a..c71c438d 100644 --- a/src/OpenTK/Graphics/ES20/Helper.cs +++ b/src/OpenTK/Graphics/ES20/Helper.cs @@ -175,10 +175,10 @@ namespace OpenTK.Graphics.ES20 { int length; GetProgram(program, GetProgramParameterName.ActiveAttributeMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length * 2); + string str; - GetActiveAttrib(program, index, sb.Capacity, out length, out size, out type, sb); - return sb.ToString(); + GetActiveAttrib(program, index, length == 0 ? 1 : length * 2, out length, out size, out type, out str); + return str; } public static string GetActiveUniform(int program, int uniformIndex, out int size, out ActiveUniformType type) @@ -186,9 +186,9 @@ namespace OpenTK.Graphics.ES20 int length; GetProgram(program, GetProgramParameterName.ActiveUniformMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length); - GetActiveUniform(program, uniformIndex, sb.Capacity, out length, out size, out type, sb); - return sb.ToString(); + string str; + GetActiveUniform(program, uniformIndex, length == 0 ? 1 : length, out length, out size, out type, out str); + return str; } public static void ShaderSource(Int32 shader, System.String @string) @@ -218,9 +218,7 @@ namespace OpenTK.Graphics.ES20 info = String.Empty; return; } - StringBuilder sb = new StringBuilder(length * 2); - GL.GetShaderInfoLog((UInt32)shader, sb.Capacity, &length, sb); - info = sb.ToString(); + GL.GetShaderInfoLog((UInt32)shader, length * 2, &length, out info); } } @@ -241,9 +239,7 @@ namespace OpenTK.Graphics.ES20 info = String.Empty; return; } - StringBuilder sb = new StringBuilder(length * 2); - GL.GetProgramInfoLog((UInt32)program, sb.Capacity, &length, sb); - info = sb.ToString(); + GL.GetProgramInfoLog((UInt32)program, length * 2, &length, out info); } } diff --git a/src/OpenTK/Graphics/ES30/Helper.cs b/src/OpenTK/Graphics/ES30/Helper.cs index a5f98010..514bdc8e 100644 --- a/src/OpenTK/Graphics/ES30/Helper.cs +++ b/src/OpenTK/Graphics/ES30/Helper.cs @@ -175,10 +175,10 @@ namespace OpenTK.Graphics.ES30 { int length; GetProgram(program, ES30.GetProgramParameterName.ActiveAttributeMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length * 2); + string str; - GetActiveAttrib(program, index, sb.Capacity, out length, out size, out type, sb); - return sb.ToString(); + GetActiveAttrib(program, index, length == 0 ? 1 : length * 2, out length, out size, out type, out str); + return str; } public static string GetActiveUniform(int program, int uniformIndex, out int size, out ActiveUniformType type) @@ -186,9 +186,9 @@ namespace OpenTK.Graphics.ES30 int length; GetProgram(program, ES30.GetProgramParameterName.ActiveUniformMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length); - GetActiveUniform(program, uniformIndex, sb.Capacity, out length, out size, out type, sb); - return sb.ToString(); + string str; + GetActiveUniform(program, uniformIndex, length == 0 ? 1 : length, out length, out size, out type, out str); + return str; } public static void ShaderSource(Int32 shader, System.String @string) @@ -218,9 +218,7 @@ namespace OpenTK.Graphics.ES30 info = String.Empty; return; } - StringBuilder sb = new StringBuilder(length * 2); - GL.GetShaderInfoLog((UInt32)shader, sb.Capacity, &length, sb); - info = sb.ToString(); + GL.GetShaderInfoLog((UInt32)shader, length * 2, &length, out info); } } @@ -241,9 +239,7 @@ namespace OpenTK.Graphics.ES30 info = String.Empty; return; } - StringBuilder sb = new StringBuilder(length * 2); - GL.GetProgramInfoLog((UInt32)program, sb.Capacity, &length, sb); - info = sb.ToString(); + GL.GetProgramInfoLog((UInt32)program, length * 2, &length, out info); } } diff --git a/src/OpenTK/Graphics/OpenGL/GLHelper.cs b/src/OpenTK/Graphics/OpenGL/GLHelper.cs index 18cd4ba6..7d9f283a 100644 --- a/src/OpenTK/Graphics/OpenGL/GLHelper.cs +++ b/src/OpenTK/Graphics/OpenGL/GLHelper.cs @@ -1889,10 +1889,10 @@ namespace OpenTK.Graphics.OpenGL { int length; GetProgram(program, OpenTK.Graphics.OpenGL.GetProgramParameterName.ActiveAttributeMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length * 2); + string str; - GetActiveAttrib(program, index, sb.Capacity, out length, out size, out type, sb); - return sb.ToString(); + GetActiveAttrib(program, index, length == 0 ? 1 : length * 2, out length, out size, out type, out str); + return str; } /// @@ -1919,9 +1919,9 @@ namespace OpenTK.Graphics.OpenGL int length; GetProgram(program, OpenTK.Graphics.OpenGL.GetProgramParameterName.ActiveUniformMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length); - GetActiveUniform(program, uniformIndex, sb.Capacity, out length, out size, out type, sb); - return sb.ToString(); + string str; + GetActiveUniform(program, uniformIndex, length == 0 ? 1 : length, out length, out size, out type, out str); + return str; } /// @@ -1941,10 +1941,10 @@ namespace OpenTK.Graphics.OpenGL { int length; GetProgram(program, OpenTK.Graphics.OpenGL.GetProgramParameterName.ActiveUniformMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length * 2); + string str; - GetActiveUniformName(program, uniformIndex, sb.Capacity, out length, sb); - return sb.ToString(); + GetActiveUniformName(program, uniformIndex, length == 0 ? 1 : length * 2, out length, out str); + return str; } /// @@ -1964,10 +1964,10 @@ namespace OpenTK.Graphics.OpenGL { int length; GetProgram(program, OpenTK.Graphics.OpenGL.GetProgramParameterName.ActiveUniformBlockMaxNameLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length * 2); + string str; - GetActiveUniformBlockName(program, uniformIndex, sb.Capacity, out length, sb); - return sb.ToString(); + GetActiveUniformBlockName(program, uniformIndex, length == 0 ? 1 : length * 2, out length, out str); + return str; } /// @@ -2027,9 +2027,7 @@ namespace OpenTK.Graphics.OpenGL info = String.Empty; return; } - StringBuilder sb = new StringBuilder(length * 2); - GL.GetShaderInfoLog((UInt32)shader, sb.Capacity, &length, sb); - info = sb.ToString(); + GL.GetShaderInfoLog((UInt32)shader, length * 2, &length, out info); } } @@ -2070,9 +2068,7 @@ namespace OpenTK.Graphics.OpenGL info = String.Empty; return; } - StringBuilder sb = new StringBuilder(length * 2); - GL.GetProgramInfoLog((UInt32)program, sb.Capacity, &length, sb); - info = sb.ToString(); + GL.GetProgramInfoLog((UInt32)program, length * 2, &length, out info); } } diff --git a/src/OpenTK/Graphics/OpenGL4/Helper.cs b/src/OpenTK/Graphics/OpenGL4/Helper.cs index 87a50d62..4cc6d600 100644 --- a/src/OpenTK/Graphics/OpenGL4/Helper.cs +++ b/src/OpenTK/Graphics/OpenGL4/Helper.cs @@ -246,10 +246,10 @@ namespace OpenTK.Graphics.OpenGL4 { int length; GetProgram(program, OpenGL4.GetProgramParameterName.ActiveAttributeMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length * 2); + string str; - GetActiveAttrib(program, index, sb.Capacity, out length, out size, out type, sb); - return sb.ToString(); + GetActiveAttrib(program, index, length == 0 ? 1 : length * 2, out length, out size, out type, out str); + return str; } public static string GetActiveUniform(int program, int uniformIndex, out int size, out ActiveUniformType type) @@ -257,9 +257,9 @@ namespace OpenTK.Graphics.OpenGL4 int length; GetProgram(program, OpenGL4.GetProgramParameterName.ActiveUniformMaxLength, out length); - StringBuilder sb = new StringBuilder(length == 0 ? 1 : length); - GetActiveUniform(program, uniformIndex, sb.Capacity, out length, out size, out type, sb); - return sb.ToString(); + string str; + GetActiveUniform(program, uniformIndex, length == 0 ? 1 : length, out length, out size, out type, out str); + return str; } public static void ShaderSource(Int32 shader, System.String @string) @@ -289,9 +289,7 @@ namespace OpenTK.Graphics.OpenGL4 info = String.Empty; return; } - StringBuilder sb = new StringBuilder(length * 2); - GL.GetShaderInfoLog((UInt32)shader, sb.Capacity, &length, sb); - info = sb.ToString(); + GL.GetShaderInfoLog((UInt32)shader, length * 2, &length, out info); } } @@ -312,9 +310,7 @@ namespace OpenTK.Graphics.OpenGL4 info = String.Empty; return; } - StringBuilder sb = new StringBuilder(length * 2); - GL.GetProgramInfoLog((UInt32)program, sb.Capacity, &length, sb); - info = sb.ToString(); + GL.GetProgramInfoLog((UInt32)program, length * 2, &length, out info); } }