Release build fixes + ImGui build flag

Fonts still not working
This commit is contained in:
Simon Lübeß
2022-02-18 16:03:24 +01:00
parent fae2bdf084
commit 0db85de067
6 changed files with 48 additions and 21 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
[Configs.Release.Win64]
PreprocessorMacros = ["RELEASE", "GE_PROFILE"]
PreprocessorMacros = ["IMGUI", "RELEASE", "GE_PROFILE"]
[Configs.Test.Win32]
PreprocessorMacros = ["TEST", "GE_WINDOWS"]
@@ -24,4 +24,4 @@ PreprocessorMacros = ["TEST", "GE_WINDOWS"]
PreprocessorMacros = ["TEST", "GE_WINDOWS"]
[Configs.Debug.Win64]
PreprocessorMacros = ["DEBUG", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES"]
PreprocessorMacros = ["DEBUG", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES", "IMGUI"]
+20 -6
View File
@@ -10,18 +10,20 @@ namespace GlitchyEngine
{
static Application s_Instance = null;
private Window _window ~ delete _;
private RendererAPI _rendererApi ~ delete _;
private EffectLibrary _effectLibrary ~ delete _;
private Window _window;
private RendererAPI _rendererApi;
private EffectLibrary _effectLibrary;
private bool _running = true;
private bool _isMinimized = false;
private LayerStack _layerStack = new LayerStack();
private LayerStack _layerStack;
#if IMGUI
private ImGuiLayer _imGuiLayer;
#endif
private GameTime _gameTime = new GameTime(true);
private GameTime _gameTime;
public bool IsRunning => _running;
public Window Window => _window;
@@ -40,6 +42,9 @@ namespace GlitchyEngine
Log.EngineLogger.Assert(s_Instance == null, "Tried to create a second application.");
s_Instance = this;
_layerStack = new LayerStack();
_gameTime = new GameTime(true);
_window = new Window(.Default);
_window.EventCallback = new => OnEvent;
@@ -54,18 +59,25 @@ namespace GlitchyEngine
Renderer.Init(_window.Context, _effectLibrary);
#if IMGUI
_imGuiLayer = new ImGuiLayer();
PushOverlay(_imGuiLayer);
#endif
}
public ~this()
{
Profiler.ProfileFunction!();
delete _layerStack;
SamplerStateManager.Uninit();
Renderer.Deinit();
delete _effectLibrary;
delete _rendererApi;
delete _window;
delete _gameTime;
delete _layerStack;
}
public void OnEvent(Event e)
@@ -131,7 +143,9 @@ namespace GlitchyEngine
if(allowFrame)
{
#if IMGUI
_imGuiLayer.ImGuiRender();
#endif
_window.Context.SwapChain.Present();
}
+4 -1
View File
@@ -194,7 +194,7 @@ namespace GlitchyEngine.ImGui
//var v = DirectX.ImmediateContext;
//v.OutputMerger.SetRenderTargets(1, &DirectX.BackBufferTarget, null);
Application.Get().Window.Context.SetRenderTarget(null);
ImGuiImplDX11.NewFrame();
ImGuiImplWin32.NewFrame();
ImGui.NewFrame();
@@ -229,7 +229,10 @@ namespace GlitchyEngine.ImGui
io.DisplaySize = .(window.Width, window.Height);
ImGui.Render();
#if GE_GRAPHICS_DX11
ImGuiImplDX11.RenderDrawData(ImGui.GetDrawData());
#endif
ImGui.CleanupFrame();
@@ -17,7 +17,9 @@ namespace GlitchyEngine.Platform.DX11
protected internal static ID3D11Device* NativeDevice;
protected internal static ID3D11DeviceContext* NativeContext;
#if DEBUG
protected internal static ID3D11Debug* DebugDevice;
#endif
internal static void Dx11Init()
{
@@ -28,9 +30,9 @@ namespace GlitchyEngine.Platform.DX11
Log.EngineLogger.Trace("Creating D3D11 Device and Context...");
DeviceCreationFlags deviceFlags = .None;
#if DEBUG
#if DEBUG
deviceFlags |= .Debug;
#endif
#endif
FeatureLevel[] levels = scope .(.Level_11_0);
@@ -44,7 +46,7 @@ namespace GlitchyEngine.Platform.DX11
Log.EngineLogger.Assert(deviceResult.Succeeded, scope $"Failed to create D3D11 Device. Message({(int32)deviceResult}): {deviceResult}");
#if DEBUG
#if DEBUG
{
Debug.Profiler.ProfileScope!("Query for ID3D11Debug");
if(NativeDevice.QueryInterface<ID3D11Debug>(out DebugDevice).Succeeded)
@@ -59,7 +61,7 @@ namespace GlitchyEngine.Platform.DX11
}
}
}
#endif
#endif
Log.EngineLogger.Trace($"D3D11 Device and Context created (Feature level: {deviceLevel})");
}
@@ -68,7 +70,9 @@ namespace GlitchyEngine.Platform.DX11
// We created a second GraphicsContext (for some reason?) just increment references.
NativeDevice.AddRef();
NativeContext.AddRef();
#if DEBUG
DebugDevice.AddRef();
#endif
}
}
@@ -78,8 +82,10 @@ namespace GlitchyEngine.Platform.DX11
NativeDevice.Release();
NativeContext.Release();
#if DEBUG
DebugDevice.ReportLiveDeviceObjects(.Detail);
DebugDevice.Release();
#endif
}
}
}
+1
View File
@@ -42,6 +42,7 @@ namespace GlitchyEngine
Log.EngineLogger.Info("Application uninitialized.");
}
Debug.Profiler.EndProfiling();
return 0;