diff --git a/src/Graphics/GraphicsDevice.cs b/src/Graphics/GraphicsDevice.cs index 86eb6c5..4287b6d 100644 --- a/src/Graphics/GraphicsDevice.cs +++ b/src/Graphics/GraphicsDevice.cs @@ -15,6 +15,7 @@ namespace MoonWorks.Graphics { public IntPtr Handle { get; } public Backend Backend { get; } + public bool DebugMode { get; } private uint windowFlags; public SDL2.SDL.SDL_WindowFlags WindowFlags => (SDL2.SDL.SDL_WindowFlags) windowFlags; @@ -61,6 +62,7 @@ namespace MoonWorks.Graphics Conversions.BoolToByte(debugMode) ); + DebugMode = debugMode; // TODO: check for CreateDevice fail // Check for replacement stock shaders diff --git a/src/Graphics/Resources/GpuBuffer.cs b/src/Graphics/Resources/GpuBuffer.cs index ad87e58..7a673cf 100644 --- a/src/Graphics/Resources/GpuBuffer.cs +++ b/src/Graphics/Resources/GpuBuffer.cs @@ -23,11 +23,15 @@ namespace MoonWorks.Graphics set { - Refresh.Refresh_SetGpuBufferName( - Device.Handle, - Handle, - value - ); + if (Device.DebugMode) + { + Refresh.Refresh_SetGpuBufferName( + Device.Handle, + Handle, + value + ); + } + name = value; } } diff --git a/src/Graphics/Resources/Texture.cs b/src/Graphics/Resources/Texture.cs index 9a26c39..7648808 100644 --- a/src/Graphics/Resources/Texture.cs +++ b/src/Graphics/Resources/Texture.cs @@ -27,11 +27,15 @@ namespace MoonWorks.Graphics set { - Refresh.Refresh_SetTextureName( - Device.Handle, - Handle, - value - ); + if (Device.DebugMode) + { + Refresh.Refresh_SetTextureName( + Device.Handle, + Handle, + value + ); + } + name = value; } }