From 577236113e8fefe9c15c98120ae1ddc2fafac8ee Mon Sep 17 00:00:00 2001 From: Terria-K Date: Sat, 12 Oct 2024 23:28:07 +0800 Subject: [PATCH] Fixed ImGui Index offset --- Riateu/Core/ImGui/ImGuiRenderer.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Riateu/Core/ImGui/ImGuiRenderer.cs b/Riateu/Core/ImGui/ImGuiRenderer.cs index a22cef6..27cb3ce 100644 --- a/Riateu/Core/ImGui/ImGuiRenderer.cs +++ b/Riateu/Core/ImGui/ImGuiRenderer.cs @@ -266,7 +266,8 @@ private void RenderCommandLists(CommandBuffer buffer, RenderPass renderPass, ImD renderPass.BindVertexBuffer(imGuiVertexBuffer); renderPass.BindIndexBuffer(imGuiIndexBuffer, IndexElementSize.SixteenBit); - uint vertexOffset = 0; + int vertexOffset = 0; + uint indexOffset = 0; for (int n = 0; n < drawDataPtr.CmdListsCount; n += 1) { @@ -296,13 +297,14 @@ private void RenderCommandLists(CommandBuffer buffer, RenderPass renderPass, ImD renderPass.DrawIndexedPrimitives( drawCmd.ElemCount, 1, - 0u, - (int)vertexOffset, + indexOffset, + vertexOffset, 0u ); + indexOffset += (uint)drawCmd.ElemCount; } - vertexOffset += (uint)cmdList.VtxBuffer.Size; + vertexOffset += cmdList.VtxBuffer.Size; } }