Improved Define names

This commit is contained in:
Simon Lübeß
2021-10-30 14:17:17 +02:00
parent 2bc87b437a
commit 419509ab7f
30 changed files with 122 additions and 51 deletions
+5 -5
View File
@@ -53,7 +53,7 @@ namespace GlitchLog
//Debug.Assert(Debug.IsDebuggerPresent, "The DebugLogger requires a debugger to be present."); //Debug.Assert(Debug.IsDebuggerPresent, "The DebugLogger requires a debugger to be present.");
} }
#if GL_NOLOG || GL_NOTRACE #if GL_NOLOG || GL_LOG_NOTRACE
[SkipCall] [SkipCall]
#endif #endif
[Inline] [Inline]
@@ -62,7 +62,7 @@ namespace GlitchLog
InternalLog(.Trace, format, params args); InternalLog(.Trace, format, params args);
} }
#if GL_NOLOG || GL_NOINFO #if GL_NOLOG || GL_LOG_NOINFO
[SkipCall] [SkipCall]
#endif #endif
[Inline] [Inline]
@@ -71,7 +71,7 @@ namespace GlitchLog
InternalLog(.Info, format, params args); InternalLog(.Info, format, params args);
} }
#if GL_NOLOG || GL_NOWARNING #if GL_NOLOG || GL_LOG_NOWARNING
[SkipCall] [SkipCall]
#endif #endif
[Inline] [Inline]
@@ -80,7 +80,7 @@ namespace GlitchLog
InternalLog(.Warning, format, params args); InternalLog(.Warning, format, params args);
} }
#if GL_NOLOG || GL_NOERROR #if GL_NOLOG || GL_LOG_NOERROR
[SkipCall] [SkipCall]
#endif #endif
[Inline] [Inline]
@@ -89,7 +89,7 @@ namespace GlitchLog
InternalLog(.Error, format, params args); InternalLog(.Error, format, params args);
} }
#if GL_NOLOG || GL_NOCRITICAL #if GL_NOLOG || GL_LOG_NOCRITICAL
[SkipCall] [SkipCall]
#endif #endif
[Inline] [Inline]
+8 -11
View File
@@ -1,21 +1,12 @@
FileVersion = 1 FileVersion = 1
Dependencies = {GlitchLog = "*", corlib = "*", DirectX = "*", DirectXTK = "*", FreeType = "*", cgltf-beef = "*", msdfgen-beef = "*", ImGui = "*", ImGuiImplDX11 = "*", ImGuiImplWin32 = "*", ImGuizmo = "*"} Dependencies = {GlitchLog = "*", corlib = "*", DirectX = "*", DirectXTK = "*", FreeType = "*", cgltf-beef = "*", msdfgen-beef = "*", ImGui = "*", ImGuiImplDX11 = "*", ImGuiImplWin32 = "*", ImGuizmo = "*", Beefy2D = "*"}
[Project] [Project]
Name = "GlitchyEngine" Name = "GlitchyEngine"
ProcessorMacros = ["GE_ERROR_SHADER_MATRIX_MISMATCH", "GE_ERROR_SHADER_VAR_TYPE_MISMATCH"] ProcessorMacros = ["GE_ERROR_SHADER_MATRIX_MISMATCH", "GE_ERROR_SHADER_VAR_TYPE_MISMATCH"]
[Configs.Debug.Win32]
PreprocessorMacros = ["DEBUG", "GE_WINDOWS"]
[Configs.Debug.Win64] [Configs.Debug.Win64]
PreprocessorMacros = ["DEBUG", "GE_WINDOWS", "GE_D3D11"] PreprocessorMacros = ["DEBUG", "GE_GRAPHICS_DX11", "GE_PROFILE"]
[Configs.Release.Win32]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
[Configs.Release.Win64]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
[Configs.Paranoid.Win32] [Configs.Paranoid.Win32]
PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"] PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
@@ -23,6 +14,12 @@ PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
[Configs.Paranoid.Win64] [Configs.Paranoid.Win64]
PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"] PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
[Configs.Release.Win32]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
[Configs.Release.Win64]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
[Configs.Test.Win32] [Configs.Test.Win32]
PreprocessorMacros = ["TEST", "GE_WINDOWS"] PreprocessorMacros = ["TEST", "GE_WINDOWS"]
+2 -2
View File
@@ -81,7 +81,7 @@ namespace GlitchyEngine
} }
} }
#if APP_SINGLESTEP #if GE_APP_SINGLESTEP
bool allowFrame = false; bool allowFrame = false;
bool disableSingleFrame = false; bool disableSingleFrame = false;
#else #else
@@ -99,7 +99,7 @@ namespace GlitchyEngine
Input.NewFrame(); Input.NewFrame();
#if APP_SINGLESTEP #if GE_APP_SINGLESTEP
allowFrame = disableSingleFrame || Input.IsKeyPressing(Key.F10); allowFrame = disableSingleFrame || Input.IsKeyPressing(Key.F10);
if(Input.IsKeyPressing(Key.F11)) if(Input.IsKeyPressing(Key.F11))
+61
View File
@@ -0,0 +1,61 @@
using System;
using Beefy.utils;
namespace GlitchyEngine.Debug
{
public static class Profiler
{
#if !GE_PROFILE
[SkipCall]
#endif
public static void BeginProfiling(StringView serverName = "127.0.0.1", StringView sessionName = "GlitchyEngine")
{
BeefPerf.Init(serverName, sessionName);
}
#if !GE_PROFILE
[SkipCall]
#endif
public static void EndProfiling()
{
BeefPerf.Shutdown();
}
#if !GE_PROFILE
[SkipCall]
#endif
public static mixin ProfileFunction()
{
scope:mixin PerformanceTimer()
}
#if !GE_PROFILE
[SkipCall]
#endif
public static mixin ProfileScope(char8* scopeName)
{
scope:mixin PerformanceTimer(scopeName)
}
}
class PerformanceTimer
{
[Inline]
public this(char8* name = Compiler.CallerMemberName)
{
#if GE_PROFILE
[Inline]
BeefPerf.Enter(name);
#endif
}
[Inline]
public ~this()
{
#if GE_PROFILE
[Inline]
BeefPerf.Leave();
#endif
}
}
}
+3 -3
View File
@@ -5,7 +5,7 @@ using ImGuizmo;
using internal ImGui; using internal ImGui;
#if GE_D3D11 #if GE_GRAPHICS_DX11
using GlitchyEngine.Platform.DX11; using GlitchyEngine.Platform.DX11;
using internal GlitchyEngine.Platform.DX11; using internal GlitchyEngine.Platform.DX11;
@@ -44,12 +44,12 @@ namespace GlitchyEngine.ImGui
style.Colors[(int)ImGui.Col.WindowBg].w = 1.0f; style.Colors[(int)ImGui.Col.WindowBg].w = 1.0f;
} }
#if GE_WINDOWS #if BF_PLATFORM_WINDOWS
// Todo: temporary, needs to be platform independent // Todo: temporary, needs to be platform independent
ImGuiImplWin32.Init((void*)(uint)(Windows.HWnd)(int)Application.Get().Window.NativeWindow); ImGuiImplWin32.Init((void*)(uint)(Windows.HWnd)(int)Application.Get().Window.NativeWindow);
#endif #endif
#if GE_D3D11 #if GE_GRAPHICS_DX11
ImGuiImplDX11.Init(NativeDevice, NativeContext); ImGuiImplDX11.Init(NativeDevice, NativeContext);
#endif #endif
} }
@@ -1,3 +1,9 @@
#if GE_GRAPHICS_DX11
#if !BF_PLATFORM_WINDOWS
#error DirectX 11 (GE_GRAPHICS_DX11) can on be used on Windows.
#endif
using DirectX.Common; using DirectX.Common;
using DirectX.D3D11; using DirectX.D3D11;
using DirectX.D3D11.SDKLayers; using DirectX.D3D11.SDKLayers;
@@ -64,3 +70,5 @@ namespace GlitchyEngine.Platform.DX11
} }
} }
} }
#endif
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using GlitchyEngine.Renderer; using GlitchyEngine.Renderer;
using System.Collections; using System.Collections;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
// Disable warning when taking pointer of in-Parameter // Disable warning when taking pointer of in-Parameter
#pragma warning disable 4204 #pragma warning disable 4204
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using DirectX.D3D11; using DirectX.D3D11;
using DirectX.Common; using DirectX.Common;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System.Diagnostics; using System.Diagnostics;
using System; using System;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using DirectX.D3D11; using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
namespace GlitchyEngine.Renderer namespace GlitchyEngine.Renderer
{ {
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using DirectX.Common; using DirectX.Common;
using DirectX.D3D11Shader; using DirectX.D3D11Shader;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using DirectX.D3D11; using DirectX.D3D11;
using internal GlitchyEngine.Renderer; using internal GlitchyEngine.Renderer;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System; using System;
using DirectX; using DirectX;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System; using System;
using DirectX.D3D11; using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System; using System;
using DirectX.D3D11; using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using DirectX.D3D11; using DirectX.D3D11;
using GlitchyEngine.Platform.DX11; using GlitchyEngine.Platform.DX11;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using DirectX.Common; using DirectX.Common;
using DirectX.D3D11; using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using GlitchyEngine.Math; using GlitchyEngine.Math;
using GlitchyEngine.Platform.DX11; using GlitchyEngine.Platform.DX11;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using DirectX.Common; using DirectX.Common;
using DirectX.D3D11; using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System; using System;
using GlitchyEngine.Renderer; using GlitchyEngine.Renderer;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using DirectX.D3D11; using DirectX.D3D11;
using DirectX.DXGI.DXGI1_2; using DirectX.DXGI.DXGI1_2;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System; using System;
using DirectX.D3D11; using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@@ -1,4 +1,4 @@
#if GE_D3D11 #if GE_GRAPHICS_DX11
using System; using System;
using GlitchyEngine.Renderer; using GlitchyEngine.Renderer;
@@ -1,3 +1,5 @@
#if BF_PLATFORM_WINDOWS
using System; using System;
using GlitchyEngine.Events; using GlitchyEngine.Events;
using DirectX.Windows.VirtualKeyCodes; using DirectX.Windows.VirtualKeyCodes;
@@ -7,8 +9,6 @@ using static System.Windows;
namespace GlitchyEngine namespace GlitchyEngine
{ {
#if GE_WINDOWS
/// Windows (WinApi) specific implementation of the Input-class /// Windows (WinApi) specific implementation of the Input-class
extension Input extension Input
{ {
@@ -192,5 +192,6 @@ namespace GlitchyEngine
CurrentState.CursorPositionDifference = CurrentState.CursorPosition - LastState.CursorPosition; CurrentState.CursorPositionDifference = CurrentState.CursorPosition - LastState.CursorPosition;
} }
} }
#endif
} }
#endif
@@ -1,4 +1,5 @@
#if GE_WINDOWS #if BF_PLATFORM_WINDOWS
using System; using System;
using DirectX.Common; using DirectX.Common;
using DirectX.Windows; using DirectX.Windows;
@@ -539,4 +540,5 @@ namespace GlitchyEngine
} }
} }
} }
#endif #endif
+7 -5
View File
@@ -49,16 +49,16 @@ namespace GlitchyEngine.Renderer
public void EnsureTypeMatch(int rows, int cols, ShaderVariableType type) public void EnsureTypeMatch(int rows, int cols, ShaderVariableType type)
{ {
#if GE_ERROR_SHADER_MATRIX_MISMATCH #if GE_SHADER_MATRIX_MISMATCH_IS_ERROR
Log.EngineLogger.Assert(rows == _rows || cols == _columns, scope $"The matrix-dimensions do not match: Expected {_rows} rows and {_rows} columns but Received {rows} rows and {cols} columns instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\""); Log.EngineLogger.Assert(rows == _rows || cols == _columns, scope $"The matrix-dimensions do not match: Expected {_rows} rows and {_rows} columns but Received {rows} rows and {cols} columns instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\"");
#elif GE_WARN_SHADER_MATRIX_MISMATCH #elif GE_SHADER_MATRIX_MISMATCH_IS_WARNING
if (rows != _rows || cols != _columns) if (rows != _rows || cols != _columns)
Log.EngineLogger.Warning($"The matrix-dimensions do not match: Expected {_rows} rows and {_rows} columns but Received {rows} rows and {cols} columns instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\""); Log.EngineLogger.Warning($"The matrix-dimensions do not match: Expected {_rows} rows and {_rows} columns but Received {rows} rows and {cols} columns instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\"");
#endif #endif
#if GE_ERROR_SHADER_VAR_TYPE_MISMATCH #if GE_SHADER_VAR_TYPE_MISMATCH_IS_ERROR
Log.EngineLogger.Assert(type == _type, scope $"The types do not match: Expected \"{_type}\" but Received \"{type}\" instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\""); Log.EngineLogger.Assert(type == _type, scope $"The types do not match: Expected \"{_type}\" but Received \"{type}\" instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\"");
#elif GE_WARN_SHADER_VAR_TYPE_MISMATCH #elif GE_SHADER_VAR_TYPE_MISMATCH_IS_WARNING
if (type != _type) if (type != _type)
Log.EngineLogger.Warning($"The types do not match: Expected \"{_type}\" but Received \"{type}\" instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\""); Log.EngineLogger.Warning($"The types do not match: Expected \"{_type}\" but Received \"{type}\" instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\"");
#endif #endif
@@ -187,7 +187,9 @@ namespace GlitchyEngine.Renderer
*/ */
internal void SetRawData(void* rawData) internal void SetRawData(void* rawData)
{ {
#if DEBUG && !GE_IGNORE_UNUSED_VARIABLE #if GE_SHADER_UNUSED_VARIABLE_IS_ERROR
Log.EngineLogger.Assert(_isUsed, scope $"Setting data for unused Variable \"{_name}\" of constant buffer \"{_constantBuffer.Name}\".");
#elif GE_SHADER_UNUSED_VARIABLE_IS_WARNING
if(!_isUsed) if(!_isUsed)
{ {
Log.EngineLogger.Warning($"Setting data for unused Variable \"{_name}\" of constant buffer \"{_constantBuffer.Name}\"."); Log.EngineLogger.Warning($"Setting data for unused Variable \"{_name}\" of constant buffer \"{_constantBuffer.Name}\".");