diff --git a/src/vulkan_engine.cpp b/src/vulkan_engine.cpp new file mode 100644 index 0000000..7a02e98 --- /dev/null +++ b/src/vulkan_engine.cpp @@ -0,0 +1,2 @@ +#include "vulkan_engine.hpp" + diff --git a/src/vulkan_engine.hpp b/src/vulkan_engine.hpp new file mode 100644 index 0000000..073aa91 --- /dev/null +++ b/src/vulkan_engine.hpp @@ -0,0 +1,60 @@ +#pragma once + +#include +#include +#include +class VulkanEngine{ + public: + void init(); + void run(); + void cleanup(); + private: + + VkInstance _instance; + VkDebugUtilsMessengerEXT _debug_messenger; + VkPhysicalDevice _chosen_device; + VkDevice _device; + + VkQueue _graphics_queue; + VkQueue _compute_queue; + VkQueue _video_queue; + + uint32_t _graphics_queue_family; + uint32_t _compute_queue_family; + uint32_t _video_queue_family; + + VkCommandPool _graphics_command_pool; + VkCommandPool _compute_command_pool; + VkCommandPool _video_command_pool; + + struct Frame{ + VkCommandBuffer graphics_comm_buf; + VkCommandBuffer compute_comm_buf; + VkCommandBuffer video_comm_buff; + VkSemaphore timeline; + uint64_t timeline_value; + }; + + static constexpr uint32_t FRAME_OVERLAP = uint32_t{3}; + Frame _frames[FRAME_OVERLAP]; + uint64_t _frame_number = uint64_t {0}; + + VkImage _render_image; + VkImageView _render_view; + + VkImage _yuv_image; + VkImageView _yuv_image_view; + + VkVideoSessionKHR _video_session; + VkVideoSessionParametersKHR _video_session_params; + VkVideoEncodeInfoKHR _encode_info; + + VkBuffer _bitstream_buffer; + private: + void init_vulkan(); + void init_device(); + void init_commands(); + void init_images(); + void init_video(); + void init_sync(); +};