VulkanEngine 0.1
Graphics engine using Vulkan
Loading...
Searching...
No Matches
Buffer.h
1// Copyright (c) 2024 Michael Carlie. All Rights Reserved.
2//
3// This software is released under the MIT License.
4// https://opensource.org/licenses/MIT
5
6#ifndef INCLUDE_VULKANENGINE_BUFFER_H_
7#define INCLUDE_VULKANENGINE_BUFFER_H_
8
9#include <VulkanEngine/StagedBufferDestination.h>
10
11#ifdef __clang__
12#pragma clang diagnostic push
13#pragma clang diagnostic ignored "-Wnullability-completeness"
14#endif
15#include <vk_mem_alloc.h>
16#ifdef __clang__
17#pragma clang diagnostic pop
18#endif
19
20#include <vulkan/vulkan.hpp>
21
22namespace VulkanEngine {
23
26 public:
33 Buffer(size_t _data_size, vk::BufferUsageFlags usage_flags,
34 vk::MemoryPropertyFlags memory_property_flags,
35 VmaMemoryUsage vma_memory_usage);
36
38 ~Buffer();
39
41 const vk::Buffer getVkBuffer() const;
42
46 virtual void insertTransferCommand(const vk::CommandBuffer& command_buffer,
47 const vk::Buffer& source_buffer);
48
52 virtual size_t getStagingBufferSize() const;
53
54 private:
59 void createBuffer(vk::BufferUsageFlags usage_flags,
60 vk::MemoryPropertyFlags memory_property_flags,
61 VmaMemoryUsage vma_memory_usage);
62
64 vk::Buffer vk_buffer;
65
66 protected:
68 size_t data_size;
69};
70
71} // namespace VulkanEngine
72
73#endif // INCLUDE_VULKANENGINE_BUFFER_H_
Class which represents a single buffer using vk::Buffer.
Definition: Buffer.h:25
size_t data_size
The size of the data.
Definition: Buffer.h:68
virtual size_t getStagingBufferSize() const
Definition: Buffer.cpp:79
virtual void insertTransferCommand(const vk::CommandBuffer &command_buffer, const vk::Buffer &source_buffer)
Definition: Buffer.cpp:71
const vk::Buffer getVkBuffer() const
Definition: Buffer.cpp:37
~Buffer()
Destructor.
Definition: Buffer.cpp:32
Definition: StagedBufferDestination.h:19
TODO development of this class is in progress.
Definition: Attribute.h:13