From d96a32a89fe5ef048a0f47dfdd8f88f735ced1e9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 28 Dec 2015 10:57:43 +0000 Subject: [PATCH] Move WriteGraphicsLog to OpenGL. --- OpenRA.Platforms.Default/ErrorHandler.cs | 26 ++----------------- OpenRA.Platforms.Default/FrameBuffer.cs | 2 +- OpenRA.Platforms.Default/OpenGL.cs | 22 ++++++++++++++++ .../Sdl2GraphicsDevice.cs | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/OpenRA.Platforms.Default/ErrorHandler.cs b/OpenRA.Platforms.Default/ErrorHandler.cs index 18f11ee57f..10b0e5e764 100644 --- a/OpenRA.Platforms.Default/ErrorHandler.cs +++ b/OpenRA.Platforms.Default/ErrorHandler.cs @@ -31,7 +31,7 @@ namespace OpenRA.Platforms.Default Console.WriteLine("Detected OpenGL version: {0}.{1}".F(major, minor)); if (major < 2) { - WriteGraphicsLog("OpenRA requires OpenGL version 2.0 or greater and detected {0}.{1}".F(major, minor)); + OpenGL.WriteGraphicsLog("OpenRA requires OpenGL version 2.0 or greater and detected {0}.{1}".F(major, minor)); throw new InvalidProgramException("OpenGL Version Error: See graphics.log for details."); } } @@ -42,31 +42,9 @@ namespace OpenRA.Platforms.Default if (n != OpenGL.GL_NO_ERROR) { var error = "GL Error: {0}\n{1}".F(n, new StackTrace()); - WriteGraphicsLog(error); + OpenGL.WriteGraphicsLog(error); throw new InvalidOperationException("OpenGL Error: See graphics.log for details."); } } - - public static void WriteGraphicsLog(string message) - { - Log.Write("graphics", message); - Log.Write("graphics", ""); - Log.Write("graphics", "OpenGL Information:"); - var vendor = OpenGL.glGetString(OpenGL.GL_VENDOR); - Log.Write("graphics", "Vendor: {0}", vendor); - if (vendor.Contains("Microsoft")) - { - var msg = ""; - msg += "Note: The default driver provided by Microsoft does not include full OpenGL support.\n"; - msg += "Please install the latest drivers from your graphics card manufacturer's website.\n"; - Log.Write("graphics", msg); - } - - Log.Write("graphics", "Renderer: {0}", OpenGL.glGetString(OpenGL.GL_RENDERER)); - Log.Write("graphics", "GL Version: {0}", OpenGL.glGetString(OpenGL.GL_VERSION)); - Log.Write("graphics", "Shader Version: {0}", OpenGL.glGetString(OpenGL.GL_SHADING_LANGUAGE_VERSION)); - Log.Write("graphics", "Available extensions:"); - Log.Write("graphics", OpenGL.glGetString(OpenGL.GL_EXTENSIONS)); - } } } \ No newline at end of file diff --git a/OpenRA.Platforms.Default/FrameBuffer.cs b/OpenRA.Platforms.Default/FrameBuffer.cs index 274dfd327a..7abdc417a6 100644 --- a/OpenRA.Platforms.Default/FrameBuffer.cs +++ b/OpenRA.Platforms.Default/FrameBuffer.cs @@ -57,7 +57,7 @@ namespace OpenRA.Platforms.Default if (status != OpenGL.FRAMEBUFFER_COMPLETE_EXT) { var error = "Error creating framebuffer: {0}\n{1}".F(status, new StackTrace()); - ErrorHandler.WriteGraphicsLog(error); + OpenGL.WriteGraphicsLog(error); throw new InvalidOperationException("OpenGL Error: See graphics.log for details."); } diff --git a/OpenRA.Platforms.Default/OpenGL.cs b/OpenRA.Platforms.Default/OpenGL.cs index 604f763e24..43edffbc7e 100644 --- a/OpenRA.Platforms.Default/OpenGL.cs +++ b/OpenRA.Platforms.Default/OpenGL.cs @@ -409,5 +409,27 @@ namespace OpenRA.Platforms.Default { return (T)(object)Marshal.GetDelegateForFunctionPointer(SDL.SDL_GL_GetProcAddress(name), typeof(T)); } + + public static void WriteGraphicsLog(string message) + { + Log.Write("graphics", message); + Log.Write("graphics", ""); + Log.Write("graphics", "OpenGL Information:"); + var vendor = OpenGL.glGetString(OpenGL.GL_VENDOR); + Log.Write("graphics", "Vendor: {0}", vendor); + if (vendor.Contains("Microsoft")) + { + var msg = ""; + msg += "Note: The default driver provided by Microsoft does not include full OpenGL support.\n"; + msg += "Please install the latest drivers from your graphics card manufacturer's website.\n"; + Log.Write("graphics", msg); + } + + Log.Write("graphics", "Renderer: {0}", OpenGL.glGetString(OpenGL.GL_RENDERER)); + Log.Write("graphics", "GL Version: {0}", OpenGL.glGetString(OpenGL.GL_VERSION)); + Log.Write("graphics", "Shader Version: {0}", OpenGL.glGetString(OpenGL.GL_SHADING_LANGUAGE_VERSION)); + Log.Write("graphics", "Available extensions:"); + Log.Write("graphics", OpenGL.glGetString(OpenGL.GL_EXTENSIONS)); + } } } diff --git a/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs b/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs index 1c6acb1ccc..0577a6587d 100644 --- a/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs +++ b/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs @@ -82,7 +82,7 @@ namespace OpenRA.Platforms.Default if (SDL.SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object") == SDL.SDL_bool.SDL_FALSE) { - ErrorHandler.WriteGraphicsLog("OpenRA requires the OpenGL extension GL_EXT_framebuffer_object.\n" + OpenGL.WriteGraphicsLog("OpenRA requires the OpenGL extension GL_EXT_framebuffer_object.\n" + "Please try updating your GPU driver to the latest version provided by the manufacturer."); throw new InvalidProgramException("Missing OpenGL extension GL_EXT_framebuffer_object. See graphics.log for details."); }