diff --git a/src/MoonWorksDearImGuiScaffoldGame.cs b/src/MoonWorksDearImGuiScaffoldGame.cs index 41a7fac..0aa748f 100644 --- a/src/MoonWorksDearImGuiScaffoldGame.cs +++ b/src/MoonWorksDearImGuiScaffoldGame.cs @@ -23,6 +23,7 @@ class MoonWorksDearImGuiScaffoldGame : Game private GpuBuffer ImGuiIndexBuffer = null; private TextureStorage TextureStorage; + private Texture FontTexture; private ResourceUploader ResourceUploader; @@ -152,13 +153,12 @@ class MoonWorksDearImGuiScaffoldGame : Game var io = ImGui.GetIO(); var drawDataPtr = ImGui.GetDrawData(); - UpdateImGuiBuffers(drawDataPtr); - var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); var swapchainTexture = commandBuffer.AcquireSwapchainTexture(MainWindow); if (swapchainTexture != null) { + UpdateImGuiBuffers(drawDataPtr); RenderCommandLists(commandBuffer, swapchainTexture, drawDataPtr, io); } @@ -302,7 +302,7 @@ class MoonWorksDearImGuiScaffoldGame : Game out int bytesPerPixel ); - var fontTexture = resourceUploader.CreateTexture2D( + FontTexture = resourceUploader.CreateTexture2D( new Span((void*) pixelData, width * height * bytesPerPixel), (uint) width, (uint) height @@ -311,9 +311,9 @@ class MoonWorksDearImGuiScaffoldGame : Game resourceUploader.Upload(); resourceUploader.Dispose(); - io.Fonts.SetTexID(fontTexture.Handle); + io.Fonts.SetTexID(FontTexture.Handle); io.Fonts.ClearTexData(); - TextureStorage.Add(fontTexture); + TextureStorage.Add(FontTexture); } } diff --git a/src/Program.cs b/src/Program.cs index 3e3ab76..b3d0a18 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -32,7 +32,7 @@ class Program MoonWorksDearImGuiScaffoldGame game = new MoonWorksDearImGuiScaffoldGame( windowCreateInfo, frameLimiterSettings, - [Backend.Vulkan, Backend.D3D11], + [Backend.D3D11, Backend.Vulkan], debugMode );