diff --git a/src/display/app.rs b/src/display/app.rs index 8eb5023..c233f83 100644 --- a/src/display/app.rs +++ b/src/display/app.rs @@ -1,5 +1,5 @@ use crate::display::window::Window; -use crate::vulkan::VkRenderContext; +use crate::renderer::vulkan::VkRenderContext; use winit::application::ApplicationHandler; use winit::event::WindowEvent; use winit::event_loop::ActiveEventLoop; diff --git a/src/main.rs b/src/main.rs index 007aef4..f75f835 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use winit::event_loop::{ControlFlow, EventLoop}; mod display; -mod vulkan; +mod renderer; fn main() { env_logger::init(); diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs new file mode 100644 index 0000000..8c19109 --- /dev/null +++ b/src/renderer/mod.rs @@ -0,0 +1 @@ +pub mod vulkan; \ No newline at end of file diff --git a/src/renderer/vulkan/mod.rs b/src/renderer/vulkan/mod.rs new file mode 100644 index 0000000..a8ceee9 --- /dev/null +++ b/src/renderer/vulkan/mod.rs @@ -0,0 +1,41 @@ +mod vk_render_context; +pub use vk_render_context::VkRenderContext; + +mod vk_instance; +pub use vk_instance::VkInstance; + +mod vk_surface; +pub use vk_surface::{SwapchainSupportDetails, VkSurface}; + +mod vk_physical_device; +pub use vk_physical_device::VkPhysicalDevice; + +mod vk_device; +pub use vk_device::VkDevice; + +mod vk_swapchain; +pub use vk_swapchain::VkSwapchain; + +mod vk_shader_module; +pub use vk_shader_module::VkShaderModule; + +mod vk_graphics_pipeline; +pub use vk_graphics_pipeline::VkGraphicsPipeline; + +mod vk_render_pass; +pub use vk_render_pass::VkRenderPass; + +mod vk_semaphore; +pub use vk_semaphore::VkSemaphore; + +mod vk_command_pool; +pub use vk_command_pool::VkCommandPool; + +mod vk_framebuffer; +pub use vk_framebuffer::VkFramebuffer; + +mod vk_fence; +pub use vk_fence::VkFence; + +mod utils; +mod vertex; diff --git a/src/vulkan/utils/layers.rs b/src/renderer/vulkan/utils/layers.rs similarity index 100% rename from src/vulkan/utils/layers.rs rename to src/renderer/vulkan/utils/layers.rs diff --git a/src/vulkan/utils/mod.rs b/src/renderer/vulkan/utils/mod.rs similarity index 100% rename from src/vulkan/utils/mod.rs rename to src/renderer/vulkan/utils/mod.rs diff --git a/src/vulkan/vertex.rs b/src/renderer/vulkan/vertex.rs similarity index 100% rename from src/vulkan/vertex.rs rename to src/renderer/vulkan/vertex.rs diff --git a/src/vulkan/vk_command_pool.rs b/src/renderer/vulkan/vk_command_pool.rs similarity index 97% rename from src/vulkan/vk_command_pool.rs rename to src/renderer/vulkan/vk_command_pool.rs index e0a662a..b48b635 100644 --- a/src/vulkan/vk_command_pool.rs +++ b/src/renderer/vulkan/vk_command_pool.rs @@ -1,4 +1,4 @@ -use crate::vulkan::VkDevice; +use super::VkDevice; use ash::prelude::VkResult; use ash::vk; use std::sync::Arc; diff --git a/src/vulkan/vk_device.rs b/src/renderer/vulkan/vk_device.rs similarity index 98% rename from src/vulkan/vk_device.rs rename to src/renderer/vulkan/vk_device.rs index fd79033..ffcabcf 100644 --- a/src/vulkan/vk_device.rs +++ b/src/renderer/vulkan/vk_device.rs @@ -1,4 +1,4 @@ -use crate::vulkan::{VkInstance, VkPhysicalDevice}; +use super::{VkInstance, VkPhysicalDevice}; use ash::prelude::VkResult; use ash::vk; use std::sync::Arc; diff --git a/src/vulkan/vk_fence.rs b/src/renderer/vulkan/vk_fence.rs similarity index 96% rename from src/vulkan/vk_fence.rs rename to src/renderer/vulkan/vk_fence.rs index 9d8ac52..5bbc52e 100644 --- a/src/vulkan/vk_fence.rs +++ b/src/renderer/vulkan/vk_fence.rs @@ -1,4 +1,4 @@ -use crate::vulkan::VkDevice; +use super::VkDevice; use ash::vk; use std::sync::Arc; diff --git a/src/vulkan/vk_framebuffer.rs b/src/renderer/vulkan/vk_framebuffer.rs similarity index 92% rename from src/vulkan/vk_framebuffer.rs rename to src/renderer/vulkan/vk_framebuffer.rs index c4dedb6..21d2c4f 100644 --- a/src/vulkan/vk_framebuffer.rs +++ b/src/renderer/vulkan/vk_framebuffer.rs @@ -1,5 +1,4 @@ -use crate::vulkan::vk_render_pass::VkRenderPass; -use crate::vulkan::{VkDevice, VkSwapchain}; +use super::{VkDevice, VkRenderPass, VkSwapchain}; use ash::vk; use std::sync::Arc; diff --git a/src/vulkan/vk_graphics_pipeline.rs b/src/renderer/vulkan/vk_graphics_pipeline.rs similarity index 97% rename from src/vulkan/vk_graphics_pipeline.rs rename to src/renderer/vulkan/vk_graphics_pipeline.rs index 11335ab..a979a2e 100644 --- a/src/vulkan/vk_graphics_pipeline.rs +++ b/src/renderer/vulkan/vk_graphics_pipeline.rs @@ -1,5 +1,4 @@ -use crate::vulkan::vk_render_pass::VkRenderPass; -use crate::vulkan::{VkDevice, VkShaderModule, VkSwapchain}; +use super::{VkDevice, VkRenderPass, VkShaderModule, VkSwapchain}; use ash::vk; use std::ffi::CStr; use std::sync::Arc; diff --git a/src/vulkan/vk_instance.rs b/src/renderer/vulkan/vk_instance.rs similarity index 96% rename from src/vulkan/vk_instance.rs rename to src/renderer/vulkan/vk_instance.rs index b813c9e..ddf520b 100644 --- a/src/vulkan/vk_instance.rs +++ b/src/renderer/vulkan/vk_instance.rs @@ -1,5 +1,7 @@ -use crate::vulkan::utils::layers::{use_layers, LayersSelector}; -use crate::vulkan::VkPhysicalDevice; +use crate::renderer::vulkan::{ + utils::layers::{use_layers, LayersSelector}, + VkPhysicalDevice, +}; use ash::khr::surface; use ash::{vk, Entry, Instance}; use std::ffi::{c_char, CStr, CString}; @@ -26,7 +28,7 @@ impl VkInstance { layer_property.layer_name_as_c_str().ok(), ) } - .unwrap_or_default(); + .unwrap_or_default(); log::debug!("{layer_property:#?} {layer_extensions:#?}"); } } diff --git a/src/vulkan/vk_physical_device.rs b/src/renderer/vulkan/vk_physical_device.rs similarity index 98% rename from src/vulkan/vk_physical_device.rs rename to src/renderer/vulkan/vk_physical_device.rs index e8c0ceb..e2a9d56 100644 --- a/src/vulkan/vk_physical_device.rs +++ b/src/renderer/vulkan/vk_physical_device.rs @@ -1,4 +1,4 @@ -use crate::vulkan::vk_surface::VkSurface; +use super::VkSurface; use ash::vk; pub struct VkPhysicalDevice { diff --git a/src/vulkan/vk_render_context.rs b/src/renderer/vulkan/vk_render_context.rs similarity index 99% rename from src/vulkan/vk_render_context.rs rename to src/renderer/vulkan/vk_render_context.rs index 0fc7d8c..f417809 100644 --- a/src/vulkan/vk_render_context.rs +++ b/src/renderer/vulkan/vk_render_context.rs @@ -1,4 +1,4 @@ -use crate::vulkan::{ +use super::{ VkCommandPool, VkDevice, VkFence, VkFramebuffer, VkGraphicsPipeline, VkInstance, VkPhysicalDevice, VkRenderPass, VkSemaphore, VkSurface, VkSwapchain, }; diff --git a/src/vulkan/vk_render_pass.rs b/src/renderer/vulkan/vk_render_pass.rs similarity index 97% rename from src/vulkan/vk_render_pass.rs rename to src/renderer/vulkan/vk_render_pass.rs index b450865..a37ab8c 100644 --- a/src/vulkan/vk_render_pass.rs +++ b/src/renderer/vulkan/vk_render_pass.rs @@ -1,4 +1,4 @@ -use crate::vulkan::{VkDevice, VkSwapchain}; +use super::{VkDevice, VkSwapchain}; use ash::prelude::VkResult; use ash::vk; use std::sync::Arc; diff --git a/src/vulkan/vk_semaphore.rs b/src/renderer/vulkan/vk_semaphore.rs similarity index 96% rename from src/vulkan/vk_semaphore.rs rename to src/renderer/vulkan/vk_semaphore.rs index 60f4b95..df5896f 100644 --- a/src/vulkan/vk_semaphore.rs +++ b/src/renderer/vulkan/vk_semaphore.rs @@ -1,4 +1,4 @@ -use crate::vulkan::VkDevice; +use super::VkDevice; use ash::vk; use std::sync::Arc; diff --git a/src/vulkan/vk_shader_module.rs b/src/renderer/vulkan/vk_shader_module.rs similarity index 97% rename from src/vulkan/vk_shader_module.rs rename to src/renderer/vulkan/vk_shader_module.rs index 0ed5f5b..11e927a 100644 --- a/src/vulkan/vk_shader_module.rs +++ b/src/renderer/vulkan/vk_shader_module.rs @@ -1,4 +1,4 @@ -use crate::vulkan::VkDevice; +use super::VkDevice; use ash::vk; use std::path::Path; use std::sync::Arc; diff --git a/src/vulkan/vk_surface.rs b/src/renderer/vulkan/vk_surface.rs similarity index 98% rename from src/vulkan/vk_surface.rs rename to src/renderer/vulkan/vk_surface.rs index a1d35da..788311a 100644 --- a/src/vulkan/vk_surface.rs +++ b/src/renderer/vulkan/vk_surface.rs @@ -1,4 +1,4 @@ -use crate::vulkan::{VkInstance, VkPhysicalDevice}; +use super::{VkInstance, VkPhysicalDevice}; use ash::prelude::VkResult; use ash::vk; use std::sync::Arc; diff --git a/src/vulkan/vk_swapchain.rs b/src/renderer/vulkan/vk_swapchain.rs similarity index 97% rename from src/vulkan/vk_swapchain.rs rename to src/renderer/vulkan/vk_swapchain.rs index 3241b35..e578d98 100644 --- a/src/vulkan/vk_swapchain.rs +++ b/src/renderer/vulkan/vk_swapchain.rs @@ -1,8 +1,5 @@ +use super::{SwapchainSupportDetails, VkDevice, VkFramebuffer, VkPhysicalDevice, VkRenderPass, VkSemaphore, VkSurface}; use crate::display::Window; -use crate::vulkan::vk_render_pass::VkRenderPass; -use crate::vulkan::vk_semaphore::VkSemaphore; -use crate::vulkan::vk_surface::SwapchainSupportDetails; -use crate::vulkan::{VkDevice, VkFramebuffer, VkPhysicalDevice, VkSurface}; use ash::prelude::VkResult; use ash::vk; use std::sync::Arc; diff --git a/src/vulkan/mod.rs b/src/vulkan/mod.rs deleted file mode 100644 index 5043262..0000000 --- a/src/vulkan/mod.rs +++ /dev/null @@ -1,41 +0,0 @@ -pub(self) mod vk_render_context; -pub use vk_render_context::VkRenderContext; - -pub(self) mod vk_instance; -pub use vk_instance::VkInstance; - -pub(self) mod vk_surface; -pub use vk_surface::VkSurface; - -pub(self) mod vk_physical_device; -pub use vk_physical_device::VkPhysicalDevice; - -pub(self) mod vk_device; -pub use vk_device::VkDevice; - -pub(self) mod vk_swapchain; -pub use vk_swapchain::VkSwapchain; - -pub(self) mod vk_shader_module; -pub use vk_shader_module::VkShaderModule; - -pub(self) mod vk_graphics_pipeline; -pub use vk_graphics_pipeline::VkGraphicsPipeline; - -mod vk_render_pass; -pub(self) use vk_render_pass::VkRenderPass; - -mod vk_semaphore; -pub(self) use vk_semaphore::VkSemaphore; - -mod vk_command_pool; -pub(self) use vk_command_pool::VkCommandPool; - -mod vk_framebuffer; -pub(self) use vk_framebuffer::VkFramebuffer; - -mod vk_fence; -pub(self) use vk_fence::VkFence; - -mod utils; -mod vertex;