From 7de1a371e887865512312dc5937c6a3c6bf1299d Mon Sep 17 00:00:00 2001 From: ladevieq Date: Tue, 16 Feb 2021 22:26:33 +0100 Subject: Attempt using imgui --- include/utils.hpp | 1 + include/vk-api.hpp | 20 +++++++++++++------- include/vk-renderer.hpp | 2 ++ 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/utils.hpp b/include/utils.hpp index 85b50cf..3821d20 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -32,6 +32,7 @@ struct input_data { }; std::vector get_shader_code(const char* path); +std::vector get_shader_code(std::string& path); struct input_data create_inputs(uint32_t width, uint32_t height, uint32_t samples_per_pixel); diff --git a/include/vk-api.hpp b/include/vk-api.hpp index ed8ff65..6534e3f 100644 --- a/include/vk-api.hpp +++ b/include/vk-api.hpp @@ -3,6 +3,7 @@ #include #include +#include #include "vk-context.hpp" @@ -12,11 +13,11 @@ struct Buffer { void* mapped_ptr; }; -struct ComputePipeline { - VkShaderModule shader_module; - VkDescriptorSetLayout descriptor_set_layout; - VkPipelineLayout layout; - VkPipeline handle; +struct Pipeline { + std::vector shader_modules; + VkDescriptorSetLayout descriptor_set_layout; + VkPipelineLayout layout; + VkPipeline handle; }; struct Image { @@ -69,8 +70,9 @@ class vkapi { void destroy_command_buffers(std::vector &command_buffers); - ComputePipeline create_compute_pipeline(const char* shader_path, std::vector bindings); - void destroy_compute_pipeline(ComputePipeline &pipeline); + Pipeline create_compute_pipeline(std::string& shader_name, std::vector bindings); + Pipeline create_graphics_pipeline(std::string& shader_name, VkShaderStageFlagBits shader_stages, std::vector bindings); + void destroy_pipeline(Pipeline &pipeline); std::vector create_descriptor_sets(VkDescriptorSetLayout descriptor_sets_layout, size_t descriptor_sets_count); @@ -105,6 +107,10 @@ class vkapi { vkcontext context; + private: + + std::string shader_stage_extension(VkShaderStageFlags shader_stage); + VkCommandPool command_pool; VkDescriptorPool descriptor_pool; diff --git a/include/vk-renderer.hpp b/include/vk-renderer.hpp index c8c330a..629f96a 100644 --- a/include/vk-renderer.hpp +++ b/include/vk-renderer.hpp @@ -15,6 +15,8 @@ class vkrenderer { ~vkrenderer(); + void ui(); + void compute(uint32_t width, uint32_t height, bool clear); void recreate_swapchain(); -- cgit v1.3