VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
vulkanVertexBuffer.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Vulkan vertex buffer — VMA-backed VkBuffer.
5//
6#pragma once
7
8#ifdef VISUTWIN_HAS_VULKAN
9
10#include <vulkan/vulkan.h>
11#include <vk_mem_alloc.h>
12
14
15namespace visutwin::canvas
16{
17 class VulkanVertexBuffer : public VertexBuffer
18 {
19 public:
20 VulkanVertexBuffer(GraphicsDevice* device, const std::shared_ptr<VertexFormat>& format,
21 int numVertices, const VertexBufferOptions& options = VertexBufferOptions{});
22 ~VulkanVertexBuffer() override;
23
24 void unlock() override;
25 void* nativeBuffer() const override { return reinterpret_cast<void*>(_buffer); }
26
27 [[nodiscard]] VkBuffer buffer() const { return _buffer; }
28
29 private:
30 VkBuffer _buffer = VK_NULL_HANDLE;
31 VmaAllocation _allocation = VK_NULL_HANDLE;
32 VmaAllocator _allocator = VK_NULL_HANDLE;
33 };
34}
35
36#endif // VISUTWIN_HAS_VULKAN