From e6d55c22bee063057c0f7b529baff2936e882f3d Mon Sep 17 00:00:00 2001 From: ladevieq Date: Sun, 7 Mar 2021 20:10:31 +0100 Subject: Make imgui backend more flexible (display demo scene) --- src/vk-api.cpp | 57 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 22 deletions(-) (limited to 'src/vk-api.cpp') diff --git a/src/vk-api.cpp b/src/vk-api.cpp index 0c7d114..117f461 100644 --- a/src/vk-api.cpp +++ b/src/vk-api.cpp @@ -65,14 +65,16 @@ Buffer vkapi::create_buffer(size_t data_size, VkBufferUsageFlags buffer_usage, V VmaAllocationCreateInfo alloc_create_info = {}; alloc_create_info.usage = mem_usage; alloc_create_info.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT; - + VKRESULT(vmaCreateBuffer(context.allocator, &buffer_info, &alloc_create_info, &buffer.handle, &buffer.alloc, &buffer.alloc_info)) + buffer.size = data_size; + return std::move(buffer); } void vkapi::destroy_buffer(Buffer& buffer) { - vmaUnmapMemory(context.allocator, buffer.alloc); + // vmaUnmapMemory(context.allocator, buffer.alloc); vmaDestroyBuffer(context.allocator, buffer.handle, buffer.alloc); } @@ -407,7 +409,7 @@ Pipeline vkapi::create_compute_pipeline(const char* shader_name, std::vector& bindings, VkShaderStageFlagBits shader_stages, VkRenderPass render_pass) { +Pipeline vkapi::create_graphics_pipeline(const char* shader_name, std::vector& bindings, VkShaderStageFlagBits shader_stages, VkRenderPass render_pass, std::vector dynamic_states) { Pipeline pipeline; std::vector stages_create_info = {}; @@ -478,32 +480,36 @@ Pipeline vkapi::create_graphics_pipeline(const char* shader_name, std::vector