aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2020-12-29 20:18:12 +0100
committerladevieq <ladevie.quentin@gmail.com>2020-12-29 20:18:12 +0100
commitcad3b1393b0422a335fff7777e431a0a3f06456d (patch)
treec02a89ff80a3130723419bd78b7fae62cbb797f4 /include
parente22af9e7d0633c8237ed802404c6ccab472eb458 (diff)
vulkan instance, device, etc creation refactor
Diffstat (limited to 'include')
-rw-r--r--include/rt.hpp2
-rw-r--r--include/vk-renderer.hpp75
2 files changed, 76 insertions, 1 deletions
diff --git a/include/rt.hpp b/include/rt.hpp
index d368ba5..570fc42 100644
--- a/include/rt.hpp
+++ b/include/rt.hpp
@@ -35,6 +35,6 @@ inline double clamp(double x, double min, double max) {
#include "lambertian.hpp"
#include "metal.hpp"
#include "dielectric.hpp"
-#include "utils.hpp"
+#include "hittable_list.hpp"
#endif // !__RT_HPP_
diff --git a/include/vk-renderer.hpp b/include/vk-renderer.hpp
new file mode 100644
index 0000000..c54009f
--- /dev/null
+++ b/include/vk-renderer.hpp
@@ -0,0 +1,75 @@
+#ifndef __VK_RENDERER_HPP_
+#define __VK_RENDERER_HPP_
+
+#include "vulkan-loader.hpp"
+#include "thirdparty/vk_mem_alloc.h"
+
+#include "vec3.hpp"
+
+struct input_data {
+ color sky_color;
+ color ground_color;
+
+ float viewport_width;
+ float viewport_height;
+ float pad1;
+ float pad2;
+};
+struct path_tracer_data {
+ struct input_data inputs;
+ color output_image[1920 * 1080];
+};
+
+class vkrenderer {
+ public:
+ vkrenderer();
+
+ void compute(const input_data& inputs, size_t width, size_t height);
+
+ const color* const output_image();
+
+ private:
+ void create_instance();
+
+ void create_debugger();
+
+ void create_device();
+
+ void create_pipeline();
+
+ void create_memory_allocator();
+
+ void create_command_buffer();
+
+ void create_descriptor_set();
+
+ void select_physical_device();
+
+ void select_compute_queue();
+
+ void fill_descriptor_set(const input_data& data);
+
+ uint32_t compute_queue_index;
+
+ VkInstance instance;
+ VkPhysicalDevice physical_device;
+ VkDevice device;
+ VkQueue compute_queue;
+
+ VmaAllocator allocator;
+ VkBuffer compute_shader_buffer;
+
+ VkCommandPool command_pool;
+ VkCommandBuffer command_buffer;
+
+ VkDescriptorPool descriptor_pool;
+ VkDescriptorSet compute_shader_input_set;
+
+ VkDescriptorSetLayout compute_shader_input_layout;
+ VkPipelineLayout compute_pipeline_layout;
+ VkPipeline compute_pipeline;
+
+ struct path_tracer_data* mapped_data;
+};
+
+#endif // !__VK_RENDERER_HPP_