aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/utils.hpp1
-rw-r--r--include/vk-api.hpp20
-rw-r--r--include/vk-renderer.hpp2
3 files changed, 16 insertions, 7 deletions
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<uint8_t> get_shader_code(const char* path);
+std::vector<uint8_t> 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 <vector>
#include <optional>
+#include <string>
#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<VkShaderModule> shader_modules;
+ VkDescriptorSetLayout descriptor_set_layout;
+ VkPipelineLayout layout;
+ VkPipeline handle;
};
struct Image {
@@ -69,8 +70,9 @@ class vkapi {
void destroy_command_buffers(std::vector<VkCommandBuffer> &command_buffers);
- ComputePipeline create_compute_pipeline(const char* shader_path, std::vector<VkDescriptorSetLayoutBinding> bindings);
- void destroy_compute_pipeline(ComputePipeline &pipeline);
+ Pipeline create_compute_pipeline(std::string& shader_name, std::vector<VkDescriptorSetLayoutBinding> bindings);
+ Pipeline create_graphics_pipeline(std::string& shader_name, VkShaderStageFlagBits shader_stages, std::vector<VkDescriptorSetLayoutBinding> bindings);
+ void destroy_pipeline(Pipeline &pipeline);
std::vector<VkDescriptorSet> 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();