From 86f4e6a0471b2f8588e6802bf9381c09c47c4ff4 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 18 Nov 2024 13:11:31 +0100 Subject: [PATCH] Cleaning comments --- src/vulkan/vk_render_context.rs | 109 +------------------------------- 1 file changed, 3 insertions(+), 106 deletions(-) diff --git a/src/vulkan/vk_render_context.rs b/src/vulkan/vk_render_context.rs index 620e2a1..9726fdf 100644 --- a/src/vulkan/vk_render_context.rs +++ b/src/vulkan/vk_render_context.rs @@ -11,18 +11,6 @@ pub struct VkRenderContext { device: Arc, swapchain: Arc, - // present_queue: vk::Queue, - // - // pool: vk::CommandPool, - // - // setup_command_buffer: vk::CommandBuffer, - // draw_command_buffer: vk::CommandBuffer, - // - // draw_commands_reuse_fence: vk::Fence, - // setup_commands_reuse_fence: vk::Fence, - // - // present_complete_semaphore: vk::Semaphore, - // rendering_complete_semaphore: vk::Semaphore, } impl VkRenderContext { @@ -41,7 +29,7 @@ impl VkRenderContext { Some(vk::QueueFlags::GRAPHICS), Some(&surface), ) - .ok_or_else(|| anyhow::anyhow!("Unable to find physical device"))?; + .ok_or_else(|| anyhow::anyhow!("Unable to find physical device"))?; log::debug!( "Selected queue {properties:#?} for physical device {:?}", physical_device.properties.device_name_as_c_str() @@ -99,7 +87,8 @@ impl VkRenderContext { let rasterizer = vk::PipelineRasterizationStateCreateInfo::default() .polygon_mode(vk::PolygonMode::FILL) .cull_mode(vk::CullModeFlags::BACK) - .front_face(vk::FrontFace::CLOCKWISE); + .front_face(vk::FrontFace::CLOCKWISE) + .line_width(1.0); let multisampling = vk::PipelineMultisampleStateCreateInfo::default() .rasterization_samples(vk::SampleCountFlags::TYPE_1) @@ -123,108 +112,16 @@ impl VkRenderContext { unsafe { device.handle.destroy_pipeline_layout(pipeline_layout, None) }; - // let present_queue = device.get_device_queue(0); - // - // let pool_create_info = vk::CommandPoolCreateInfo::default() - // .flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER); - // - // let pool = device.create_command_pool(&pool_create_info) - // .expect("Failed to create command pool"); - // - // let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::default() - // .command_buffer_count(2) - // .command_pool(pool) - // .level(vk::CommandBufferLevel::PRIMARY); - // - // let command_buffers = device - // .allocate_command_buffers(&command_buffer_allocate_info) - // .expect("Failed to create command buffers"); - // let setup_command_buffer = command_buffers[0]; - // let draw_command_buffer = command_buffers[1]; - // - // let fence_create_info = - // vk::FenceCreateInfo::default().flags(vk::FenceCreateFlags::SIGNALED); - // - // let draw_commands_reuse_fence = device - // .create_fence(&fence_create_info) - // .expect("Failed to create draw commands fence"); - // let setup_commands_reuse_fence = device - // .create_fence(&fence_create_info) - // .expect("Failed to create setup commands fence"); - // - // let semaphore_create_info = vk::SemaphoreCreateInfo::default(); - // - // let present_complete_semaphore = device - // .create_semaphore(&semaphore_create_info) - // .expect("Failed to create present complete semaphore"); - // let rendering_complete_semaphore = device - // .create_semaphore(&semaphore_create_info) - // .expect("Failed to create rendering complete semaphore"); - Ok(Self { instance, surface, device, swapchain, - // present_queue, - // - // pool, - // - // setup_command_buffer, - // draw_command_buffer, - // - // present_complete_semaphore, - // rendering_complete_semaphore, - // - // draw_commands_reuse_fence, - // setup_commands_reuse_fence, }) } pub fn render(&mut self) -> anyhow::Result<()> { - // unsafe { - // self.device.handle - // .wait_for_fences(&[self.draw_commands_reuse_fence], true, u64::MAX) - // .expect("Wait for fence failed."); - // - // self.device.handle - // .reset_fences(&[self.draw_commands_reuse_fence]) - // .expect("Reset fences failed."); - // - // self.device.handle - // .reset_command_buffer( - // self.draw_command_buffer, - // vk::CommandBufferResetFlags::RELEASE_RESOURCES, - // ) - // .expect("Reset command buffer failed."); - // - // let command_buffer_begin_info = vk::CommandBufferBeginInfo::default() - // .flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT); - // - // self.device.handle - // .begin_command_buffer(self.draw_command_buffer, &command_buffer_begin_info) - // .expect("Begin commandbuffer"); - // - // self.device.handle - // .end_command_buffer(self.draw_command_buffer) - // .expect("End commandbuffer"); - // - // let command_buffers = vec![self.draw_command_buffer]; - // let semaphores = vec![self.rendering_complete_semaphore]; - // let wait_mask = vec![vk::PipelineStageFlags::default()]; - // - // let submit_info = vk::SubmitInfo::default() - // .wait_semaphores(&semaphores) - // .wait_dst_stage_mask(&wait_mask) - // .command_buffers(&command_buffers) - // .signal_semaphores(&semaphores); - // - // self.device.handle - // .queue_submit(self.present_queue, &[submit_info], self.draw_commands_reuse_fence) - // .expect("queue submit failed."); - // } - Ok(()) }