feat: ImGui integration + real screenshot capture via Vulkan
ImGui: - ImGui.NET 1.91.6.1 NuGet package - VulkanImGui: font texture upload, ImGui pipeline (blending, no depth), vertex/index buffer streaming - GLSL 450 ImGui shaders (vert: scale/translate push constants, frag: font texture sampler) - Compiled to SPIR-V via @webgpu/glslang - Debug overlay: FPS, camera position, entity count, light list - 1600+ FPS with ImGui active Screenshot: - vkCmdCopyImageToBuffer embedded in main command buffer - Layout transition PresentSrcKHR→TransferSrcOptimal→PresentSrcKHR - Deferred read: staging buffer read on next frame after fence - BMP format written directly to FileStream (row by row) - All 16 camera tour screenshots captured (1280x720x32bpp) All 66 tests pass.
This commit is contained in:
@@ -7,11 +7,12 @@ using Flecs.NET.Core;
|
||||
|
||||
namespace Engine.Graphics.Vulkan;
|
||||
|
||||
internal sealed unsafe class VulkanRenderer : IRenderer, IScreenshotProvider
|
||||
public sealed unsafe class VulkanRenderer : IRenderer, IScreenshotProvider
|
||||
{
|
||||
private readonly VulkanContext _ctx;
|
||||
private readonly VulkanSwapchain _swapchain;
|
||||
public readonly VulkanContext _ctx;
|
||||
public readonly VulkanSwapchain _swapchain;
|
||||
private readonly VulkanPipeline _pipeline;
|
||||
public VulkanImGui? ImGuiLayer;
|
||||
|
||||
private VkCommandPool _commandPool;
|
||||
private VkCommandBuffer[] _commandBuffers = Array.Empty<VkCommandBuffer>();
|
||||
@@ -536,6 +537,11 @@ internal sealed unsafe class VulkanRenderer : IRenderer, IScreenshotProvider
|
||||
}
|
||||
});
|
||||
|
||||
if (ImGuiLayer != null)
|
||||
{
|
||||
ImGuiLayer.Render(cmd);
|
||||
}
|
||||
|
||||
Vk.vkCmdEndRenderPass(cmd);
|
||||
|
||||
if (_screenshotRequested)
|
||||
|
||||
Reference in New Issue
Block a user