aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2021-01-27 22:28:53 +0100
committerladevieq <ladevie.quentin@gmail.com>2021-01-27 22:28:53 +0100
commite4180902265c36744a770e932bb0a3f204d58b28 (patch)
treef695fba6fc88277bf999c5dcdf47b3a79e13bbf4 /include
parent1314f696a7861f3b1509c7f5c27d6b06bc22d5f1 (diff)
Convert buffer creation function to an api one
Diffstat (limited to 'include')
-rw-r--r--include/vk-api.hpp25
-rw-r--r--include/vk-renderer.hpp9
2 files changed, 28 insertions, 6 deletions
diff --git a/include/vk-api.hpp b/include/vk-api.hpp
new file mode 100644
index 0000000..690b91f
--- /dev/null
+++ b/include/vk-api.hpp
@@ -0,0 +1,25 @@
+#ifndef __VK_API_HPP_
+#define __VK_API_HPP_
+
+#include "vk-context.hpp"
+
+struct Buffer {
+ VmaAllocation alloc;
+ VkBuffer vkbuffer;
+ void* mapped_ptr;
+};
+
+class vkapi {
+ public:
+ vkapi() = default;
+
+ Buffer create_buffer(size_t data_size, VkBufferUsageFlags buffer_usage, VmaMemoryUsage mem_usage);
+ void destroy_buffer(Buffer& buffer);
+
+ // private:
+
+ vkcontext context;
+
+};
+
+#endif // !__VK_API_HPP_
diff --git a/include/vk-renderer.hpp b/include/vk-renderer.hpp
index c13f029..7a2a118 100644
--- a/include/vk-renderer.hpp
+++ b/include/vk-renderer.hpp
@@ -3,7 +3,7 @@
#include <vector>
-#include "vk-context.hpp"
+#include "vk-api.hpp"
#include "vulkan-loader.hpp"
class input_data;
@@ -36,8 +36,6 @@ class vkrenderer {
void create_semaphores();
- void create_input_buffer(const input_data& inputs);
-
void destroy_surface();
void destroy_swapchain();
@@ -62,12 +60,11 @@ class vkrenderer {
void handle_swapchain_result(VkResult function_result);
- vkcontext context;
+ vkapi api;
uint64_t frame_index = 0;
- VmaAllocation allocation;
- VkBuffer compute_shader_buffer;
+ Buffer compute_shader_buffer;
VkCommandPool command_pool;
std::vector<VkCommandBuffer> command_buffers;