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
+8 -11
View File
@@ -1,21 +1,12 @@
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]
Name = "GlitchyEngine"
ProcessorMacros = ["GE_ERROR_SHADER_MATRIX_MISMATCH", "GE_ERROR_SHADER_VAR_TYPE_MISMATCH"]
[Configs.Debug.Win32]
PreprocessorMacros = ["DEBUG", "GE_WINDOWS"]
[Configs.Debug.Win64]
PreprocessorMacros = ["DEBUG", "GE_WINDOWS", "GE_D3D11"]
[Configs.Release.Win32]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
[Configs.Release.Win64]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
PreprocessorMacros = ["DEBUG", "GE_GRAPHICS_DX11", "GE_PROFILE"]
[Configs.Paranoid.Win32]
PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
@@ -23,6 +14,12 @@ PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
[Configs.Paranoid.Win64]
PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
[Configs.Release.Win32]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
[Configs.Release.Win64]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
[Configs.Test.Win32]
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 disableSingleFrame = false;
#else
@@ -99,7 +99,7 @@ namespace GlitchyEngine
Input.NewFrame();
#if APP_SINGLESTEP
#if GE_APP_SINGLESTEP
allowFrame = disableSingleFrame || Input.IsKeyPressing(Key.F10);
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;
#if GE_D3D11
#if GE_GRAPHICS_DX11
using GlitchyEngine.Platform.DX11;
using internal GlitchyEngine.Platform.DX11;
@@ -44,12 +44,12 @@ namespace GlitchyEngine.ImGui
style.Colors[(int)ImGui.Col.WindowBg].w = 1.0f;
}
#if GE_WINDOWS
#if BF_PLATFORM_WINDOWS
// Todo: temporary, needs to be platform independent
ImGuiImplWin32.Init((void*)(uint)(Windows.HWnd)(int)Application.Get().Window.NativeWindow);
#endif
#if GE_D3D11
#if GE_GRAPHICS_DX11
ImGuiImplDX11.Init(NativeDevice, NativeContext);
#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.D3D11;
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 System.Collections;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
// Disable warning when taking pointer of in-Parameter
#pragma warning disable 4204
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using DirectX.D3D11;
using DirectX.Common;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System.Diagnostics;
using System;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
namespace GlitchyEngine.Renderer
{
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using DirectX.Common;
using DirectX.D3D11Shader;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using DirectX.D3D11;
using internal GlitchyEngine.Renderer;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System;
using DirectX;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System;
using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System;
using System.Diagnostics;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System;
using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using DirectX.D3D11;
using GlitchyEngine.Platform.DX11;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using DirectX.Common;
using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using GlitchyEngine.Math;
using GlitchyEngine.Platform.DX11;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using DirectX.Common;
using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System;
using GlitchyEngine.Renderer;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using DirectX.D3D11;
using DirectX.DXGI.DXGI1_2;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System;
using DirectX.D3D11;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System;
using System.Diagnostics;
@@ -1,4 +1,4 @@
#if GE_D3D11
#if GE_GRAPHICS_DX11
using System;
using GlitchyEngine.Renderer;
@@ -1,3 +1,5 @@
#if BF_PLATFORM_WINDOWS
using System;
using GlitchyEngine.Events;
using DirectX.Windows.VirtualKeyCodes;
@@ -7,8 +9,6 @@ using static System.Windows;
namespace GlitchyEngine
{
#if GE_WINDOWS
/// Windows (WinApi) specific implementation of the Input-class
extension Input
{
@@ -192,5 +192,6 @@ namespace GlitchyEngine
CurrentState.CursorPositionDifference = CurrentState.CursorPosition - LastState.CursorPosition;
}
}
#endif
}
#endif
@@ -1,4 +1,5 @@
#if GE_WINDOWS
#if BF_PLATFORM_WINDOWS
using System;
using DirectX.Common;
using DirectX.Windows;
@@ -539,4 +540,5 @@ namespace GlitchyEngine
}
}
}
#endif
+7 -5
View File
@@ -49,16 +49,16 @@ namespace GlitchyEngine.Renderer
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}\"");
#elif GE_WARN_SHADER_MATRIX_MISMATCH
#elif GE_SHADER_MATRIX_MISMATCH_IS_WARNING
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}\"");
#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}\"");
#elif GE_WARN_SHADER_VAR_TYPE_MISMATCH
#elif GE_SHADER_VAR_TYPE_MISMATCH_IS_WARNING
if (type != _type)
Log.EngineLogger.Warning($"The types do not match: Expected \"{_type}\" but Received \"{type}\" instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\"");
#endif
@@ -187,7 +187,9 @@ namespace GlitchyEngine.Renderer
*/
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)
{
Log.EngineLogger.Warning($"Setting data for unused Variable \"{_name}\" of constant buffer \"{_constantBuffer.Name}\".");