diff options
| author | hachem <im@hachem.wtf> | 2026-08-19 20:33:30 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-19 20:33:30 +0200 |
| commit | e3abaaf59777258ba06705135a0cafcb5918ad12 (patch) | |
| tree | 889ab40dfc1967b38bcb5735e018d6b2c41d7390 /src/Platform/Vulkan/VulkanRenderer.h | |
| parent | f455eb427804866a5ce61ea3ea01715cb5ac9116 (diff) | |
[feat]: vulkan is going to be the end of me bro
Diffstat (limited to 'src/Platform/Vulkan/VulkanRenderer.h')
| -rw-r--r-- | src/Platform/Vulkan/VulkanRenderer.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Platform/Vulkan/VulkanRenderer.h b/src/Platform/Vulkan/VulkanRenderer.h new file mode 100644 index 0000000..9b5a23f --- /dev/null +++ b/src/Platform/Vulkan/VulkanRenderer.h @@ -0,0 +1,40 @@ +#pragma once + +#include <glm/glm.hpp> +#include <functional> + +// Live-window Vulkan backend: owns the instance, surface, device, swapchain, +// render pass, framebuffers and per-frame synchronization, and drives the +// acquire -> record -> submit -> present loop. Pure-C++ header (no vulkan.h / +// glfw leak); the GLFW window is passed as an opaque handle. +namespace Donut +{ + // Must be called BEFORE glfwInit() when the Vulkan API is selected: points + // GLFW at the loader the app links against (GLFW's own dlopen fails on + // macOS/Homebrew) and configures the MoltenVK ICD / layer paths. + void VulkanPrepareGLFW(); + + class VulkanRenderer + { + public: + VulkanRenderer(); + ~VulkanRenderer(); + + // glfwWindow must be a GLFW window created with GLFW_NO_API. + bool Init(void* glfwWindow, int width, int height); + void Shutdown(); + + // Creates the ImGui context + Vulkan/GLFW backends. Call after Init(). + bool InitImGui(); + + // Renders + presents one frame: clears to clearColor, then (if InitImGui + // ran) opens an ImGui frame, invokes buildUI to populate it, and draws it. + void DrawFrame(const glm::vec4& clearColor, const std::function<void()>& buildUI = {}); + + void OnResize(int width, int height); + + private: + struct Impl; + Impl* m_Impl = nullptr; + }; +} |
