testing d3d11

This commit is contained in:
cosmonaut 2024-03-08 12:06:56 -08:00
parent b34d1444e7
commit de2e6dd3b8
2 changed files with 6 additions and 6 deletions

View File

@ -23,6 +23,7 @@ class MoonWorksDearImGuiScaffoldGame : Game
private GpuBuffer ImGuiIndexBuffer = null; private GpuBuffer ImGuiIndexBuffer = null;
private TextureStorage TextureStorage; private TextureStorage TextureStorage;
private Texture FontTexture;
private ResourceUploader ResourceUploader; private ResourceUploader ResourceUploader;
@ -152,13 +153,12 @@ class MoonWorksDearImGuiScaffoldGame : Game
var io = ImGui.GetIO(); var io = ImGui.GetIO();
var drawDataPtr = ImGui.GetDrawData(); var drawDataPtr = ImGui.GetDrawData();
UpdateImGuiBuffers(drawDataPtr);
var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); var commandBuffer = GraphicsDevice.AcquireCommandBuffer();
var swapchainTexture = commandBuffer.AcquireSwapchainTexture(MainWindow); var swapchainTexture = commandBuffer.AcquireSwapchainTexture(MainWindow);
if (swapchainTexture != null) if (swapchainTexture != null)
{ {
UpdateImGuiBuffers(drawDataPtr);
RenderCommandLists(commandBuffer, swapchainTexture, drawDataPtr, io); RenderCommandLists(commandBuffer, swapchainTexture, drawDataPtr, io);
} }
@ -302,7 +302,7 @@ class MoonWorksDearImGuiScaffoldGame : Game
out int bytesPerPixel out int bytesPerPixel
); );
var fontTexture = resourceUploader.CreateTexture2D( FontTexture = resourceUploader.CreateTexture2D(
new Span<byte>((void*) pixelData, width * height * bytesPerPixel), new Span<byte>((void*) pixelData, width * height * bytesPerPixel),
(uint) width, (uint) width,
(uint) height (uint) height
@ -311,9 +311,9 @@ class MoonWorksDearImGuiScaffoldGame : Game
resourceUploader.Upload(); resourceUploader.Upload();
resourceUploader.Dispose(); resourceUploader.Dispose();
io.Fonts.SetTexID(fontTexture.Handle); io.Fonts.SetTexID(FontTexture.Handle);
io.Fonts.ClearTexData(); io.Fonts.ClearTexData();
TextureStorage.Add(fontTexture); TextureStorage.Add(FontTexture);
} }
} }

View File

@ -32,7 +32,7 @@ class Program
MoonWorksDearImGuiScaffoldGame game = new MoonWorksDearImGuiScaffoldGame( MoonWorksDearImGuiScaffoldGame game = new MoonWorksDearImGuiScaffoldGame(
windowCreateInfo, windowCreateInfo,
frameLimiterSettings, frameLimiterSettings,
[Backend.Vulkan, Backend.D3D11], [Backend.D3D11, Backend.Vulkan],
debugMode debugMode
); );