update to ash builders
This commit is contained in:
parent
249c3be4c8
commit
78ed257291
1 changed files with 93 additions and 63 deletions
|
@ -125,16 +125,17 @@ impl VulkanWindowInner {
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||||
{
|
{
|
||||||
extension_names.push(vk::KhrPortabilityEnumerationFn::NAME.as_ptr());
|
extension_names.push(vk::KhrPortabilityEnumerationFn::name().as_ptr());
|
||||||
extension_names.push(vk::KhrGetPhysicalDeviceProperties2Fn::NAME.as_ptr());
|
extension_names.push(vk::KhrGetPhysicalDeviceProperties2Fn::name().as_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
let appinfo = vk::ApplicationInfo::default()
|
let appinfo = vk::ApplicationInfo::builder()
|
||||||
.application_name(&name)
|
.application_name(&name)
|
||||||
.engine_name(&name)
|
.engine_name(&name)
|
||||||
.application_version(0)
|
.application_version(0)
|
||||||
.engine_version(0)
|
.engine_version(0)
|
||||||
.api_version(vk::make_api_version(0, 1, 0, 0));
|
.api_version(vk::make_api_version(0, 1, 0, 0))
|
||||||
|
.build();
|
||||||
|
|
||||||
let create_flags = if cfg!(any(target_os = "macos", target_os = "ios")) {
|
let create_flags = if cfg!(any(target_os = "macos", target_os = "ios")) {
|
||||||
vk::InstanceCreateFlags::ENUMERATE_PORTABILITY_KHR
|
vk::InstanceCreateFlags::ENUMERATE_PORTABILITY_KHR
|
||||||
|
@ -142,10 +143,11 @@ impl VulkanWindowInner {
|
||||||
vk::InstanceCreateFlags::default()
|
vk::InstanceCreateFlags::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let create_info = vk::InstanceCreateInfo::default()
|
let create_info = vk::InstanceCreateInfo::builder()
|
||||||
.application_info(&appinfo)
|
.application_info(&appinfo)
|
||||||
.enabled_extension_names(&extension_names)
|
.enabled_extension_names(&extension_names)
|
||||||
.flags(create_flags);
|
.flags(create_flags)
|
||||||
|
.build();
|
||||||
|
|
||||||
let instance = entry.create_instance(&create_info, None).unwrap();
|
let instance = entry.create_instance(&create_info, None).unwrap();
|
||||||
|
|
||||||
|
@ -188,9 +190,9 @@ impl VulkanWindowInner {
|
||||||
.expect("Couldn't find suitable device.");
|
.expect("Couldn't find suitable device.");
|
||||||
let queue_family_index = queue_family_index as u32;
|
let queue_family_index = queue_family_index as u32;
|
||||||
let device_extension_names_raw = [
|
let device_extension_names_raw = [
|
||||||
Swapchain::NAME.as_ptr(),
|
Swapchain::name().as_ptr(),
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||||
vk::KhrPortabilitySubsetFn::NAME.as_ptr(),
|
vk::KhrPortabilitySubsetFn::name().as_ptr(),
|
||||||
];
|
];
|
||||||
let features = vk::PhysicalDeviceFeatures {
|
let features = vk::PhysicalDeviceFeatures {
|
||||||
shader_clip_distance: 1,
|
shader_clip_distance: 1,
|
||||||
|
@ -198,14 +200,16 @@ impl VulkanWindowInner {
|
||||||
};
|
};
|
||||||
let priorities = [1.0];
|
let priorities = [1.0];
|
||||||
|
|
||||||
let queue_info = vk::DeviceQueueCreateInfo::default()
|
let queue_info = vk::DeviceQueueCreateInfo::builder()
|
||||||
.queue_family_index(queue_family_index)
|
.queue_family_index(queue_family_index)
|
||||||
.queue_priorities(&priorities);
|
.queue_priorities(&priorities)
|
||||||
|
.build();
|
||||||
|
|
||||||
let device_create_info = vk::DeviceCreateInfo::default()
|
let device_create_info = vk::DeviceCreateInfo::builder()
|
||||||
.queue_create_infos(std::slice::from_ref(&queue_info))
|
.queue_create_infos(std::slice::from_ref(&queue_info))
|
||||||
.enabled_extension_names(&device_extension_names_raw)
|
.enabled_extension_names(&device_extension_names_raw)
|
||||||
.enabled_features(&features);
|
.enabled_features(&features)
|
||||||
|
.build();
|
||||||
|
|
||||||
let device = instance
|
let device = instance
|
||||||
.create_device(pdevice, &device_create_info, None)
|
.create_device(pdevice, &device_create_info, None)
|
||||||
|
@ -251,7 +255,7 @@ impl VulkanWindowInner {
|
||||||
.unwrap_or(vk::PresentModeKHR::FIFO);
|
.unwrap_or(vk::PresentModeKHR::FIFO);
|
||||||
let swapchain_loader = Swapchain::new(&instance, &device);
|
let swapchain_loader = Swapchain::new(&instance, &device);
|
||||||
|
|
||||||
let swapchain_create_info = vk::SwapchainCreateInfoKHR::default()
|
let swapchain_create_info = vk::SwapchainCreateInfoKHR::builder()
|
||||||
.surface(surface)
|
.surface(surface)
|
||||||
.min_image_count(desired_image_count)
|
.min_image_count(desired_image_count)
|
||||||
.image_color_space(surface_format.color_space)
|
.image_color_space(surface_format.color_space)
|
||||||
|
@ -263,22 +267,25 @@ impl VulkanWindowInner {
|
||||||
.composite_alpha(vk::CompositeAlphaFlagsKHR::OPAQUE)
|
.composite_alpha(vk::CompositeAlphaFlagsKHR::OPAQUE)
|
||||||
.present_mode(present_mode)
|
.present_mode(present_mode)
|
||||||
.clipped(true)
|
.clipped(true)
|
||||||
.image_array_layers(1);
|
.image_array_layers(1)
|
||||||
|
.build();
|
||||||
|
|
||||||
let swapchain = swapchain_loader
|
let swapchain = swapchain_loader
|
||||||
.create_swapchain(&swapchain_create_info, None)
|
.create_swapchain(&swapchain_create_info, None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let pool_create_info = vk::CommandPoolCreateInfo::default()
|
let pool_create_info = vk::CommandPoolCreateInfo::builder()
|
||||||
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER)
|
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER)
|
||||||
.queue_family_index(queue_family_index);
|
.queue_family_index(queue_family_index)
|
||||||
|
.build();
|
||||||
|
|
||||||
let pool = device.create_command_pool(&pool_create_info, None).unwrap();
|
let pool = device.create_command_pool(&pool_create_info, None).unwrap();
|
||||||
|
|
||||||
let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::default()
|
let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::builder()
|
||||||
.command_buffer_count(2)
|
.command_buffer_count(2)
|
||||||
.command_pool(pool)
|
.command_pool(pool)
|
||||||
.level(vk::CommandBufferLevel::PRIMARY);
|
.level(vk::CommandBufferLevel::PRIMARY)
|
||||||
|
.build();
|
||||||
|
|
||||||
let command_buffers = device
|
let command_buffers = device
|
||||||
.allocate_command_buffers(&command_buffer_allocate_info)
|
.allocate_command_buffers(&command_buffer_allocate_info)
|
||||||
|
@ -290,7 +297,7 @@ impl VulkanWindowInner {
|
||||||
let present_image_views: Vec<vk::ImageView> = present_images
|
let present_image_views: Vec<vk::ImageView> = present_images
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&image| {
|
.map(|&image| {
|
||||||
let create_view_info = vk::ImageViewCreateInfo::default()
|
let create_view_info = vk::ImageViewCreateInfo::builder()
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
.view_type(vk::ImageViewType::TYPE_2D)
|
||||||
.format(surface_format.format)
|
.format(surface_format.format)
|
||||||
.components(vk::ComponentMapping {
|
.components(vk::ComponentMapping {
|
||||||
|
@ -306,14 +313,16 @@ impl VulkanWindowInner {
|
||||||
base_array_layer: 0,
|
base_array_layer: 0,
|
||||||
layer_count: 1,
|
layer_count: 1,
|
||||||
})
|
})
|
||||||
.image(image);
|
.image(image)
|
||||||
|
.build();
|
||||||
device.create_image_view(&create_view_info, None).unwrap()
|
device.create_image_view(&create_view_info, None).unwrap()
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let device_memory_properties = instance.get_physical_device_memory_properties(pdevice);
|
let device_memory_properties = instance.get_physical_device_memory_properties(pdevice);
|
||||||
|
|
||||||
let fence_create_info =
|
let fence_create_info = vk::FenceCreateInfo::builder()
|
||||||
vk::FenceCreateInfo::default().flags(vk::FenceCreateFlags::SIGNALED);
|
.flags(vk::FenceCreateFlags::SIGNALED)
|
||||||
|
.build();
|
||||||
|
|
||||||
let draw_commands_reuse_fence = device
|
let draw_commands_reuse_fence = device
|
||||||
.create_fence(&fence_create_info, None)
|
.create_fence(&fence_create_info, None)
|
||||||
|
@ -352,14 +361,16 @@ impl VulkanWindowInner {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}];
|
}];
|
||||||
|
|
||||||
let subpass = vk::SubpassDescription::default()
|
let subpass = vk::SubpassDescription::builder()
|
||||||
.color_attachments(&color_attachment_refs)
|
.color_attachments(&color_attachment_refs)
|
||||||
.pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS);
|
.pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS)
|
||||||
|
.build();
|
||||||
|
|
||||||
let renderpass_create_info = vk::RenderPassCreateInfo::default()
|
let renderpass_create_info = vk::RenderPassCreateInfo::builder()
|
||||||
.attachments(&renderpass_attachments)
|
.attachments(&renderpass_attachments)
|
||||||
.subpasses(std::slice::from_ref(&subpass))
|
.subpasses(std::slice::from_ref(&subpass))
|
||||||
.dependencies(&dependencies);
|
.dependencies(&dependencies)
|
||||||
|
.build();
|
||||||
|
|
||||||
let renderpass = device
|
let renderpass = device
|
||||||
.create_render_pass(&renderpass_create_info, None)
|
.create_render_pass(&renderpass_create_info, None)
|
||||||
|
@ -369,12 +380,13 @@ impl VulkanWindowInner {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&present_image_view| {
|
.map(|&present_image_view| {
|
||||||
let framebuffer_attachments = [present_image_view];
|
let framebuffer_attachments = [present_image_view];
|
||||||
let frame_buffer_create_info = vk::FramebufferCreateInfo::default()
|
let frame_buffer_create_info = vk::FramebufferCreateInfo::builder()
|
||||||
.render_pass(renderpass)
|
.render_pass(renderpass)
|
||||||
.attachments(&framebuffer_attachments)
|
.attachments(&framebuffer_attachments)
|
||||||
.width(surface_resolution.width)
|
.width(surface_resolution.width)
|
||||||
.height(surface_resolution.height)
|
.height(surface_resolution.height)
|
||||||
.layers(1);
|
.layers(1)
|
||||||
|
.build();
|
||||||
|
|
||||||
device
|
device
|
||||||
.create_framebuffer(&frame_buffer_create_info, None)
|
.create_framebuffer(&frame_buffer_create_info, None)
|
||||||
|
@ -530,13 +542,15 @@ impl VulkanWindowInner {
|
||||||
&[],
|
&[],
|
||||||
&[texture_barrier],
|
&[texture_barrier],
|
||||||
);
|
);
|
||||||
let buffer_copy_regions = vk::BufferImageCopy::default()
|
let buffer_copy_regions = vk::BufferImageCopy::builder()
|
||||||
.image_subresource(
|
.image_subresource(
|
||||||
vk::ImageSubresourceLayers::default()
|
vk::ImageSubresourceLayers::builder()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.layer_count(1),
|
.layer_count(1)
|
||||||
|
.build(),
|
||||||
)
|
)
|
||||||
.image_extent(image_extent.into());
|
.image_extent(image_extent.into())
|
||||||
|
.build();
|
||||||
|
|
||||||
device.cmd_copy_buffer_to_image(
|
device.cmd_copy_buffer_to_image(
|
||||||
texture_command_buffer,
|
texture_command_buffer,
|
||||||
|
@ -617,9 +631,10 @@ impl VulkanWindowInner {
|
||||||
descriptor_count: 1,
|
descriptor_count: 1,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let descriptor_pool_info = vk::DescriptorPoolCreateInfo::default()
|
let descriptor_pool_info = vk::DescriptorPoolCreateInfo::builder()
|
||||||
.pool_sizes(&descriptor_sizes)
|
.pool_sizes(&descriptor_sizes)
|
||||||
.max_sets(1);
|
.max_sets(1)
|
||||||
|
.build();
|
||||||
|
|
||||||
let descriptor_pool = device
|
let descriptor_pool = device
|
||||||
.create_descriptor_pool(&descriptor_pool_info, None)
|
.create_descriptor_pool(&descriptor_pool_info, None)
|
||||||
|
@ -639,16 +654,19 @@ impl VulkanWindowInner {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let descriptor_info =
|
let descriptor_info = vk::DescriptorSetLayoutCreateInfo::builder()
|
||||||
vk::DescriptorSetLayoutCreateInfo::default().bindings(&desc_layout_bindings);
|
.bindings(&desc_layout_bindings)
|
||||||
|
.build();
|
||||||
|
|
||||||
let desc_set_layouts = [device
|
let desc_set_layouts = [device
|
||||||
.create_descriptor_set_layout(&descriptor_info, None)
|
.create_descriptor_set_layout(&descriptor_info, None)
|
||||||
.unwrap()];
|
.unwrap()];
|
||||||
|
|
||||||
let desc_alloc_info = vk::DescriptorSetAllocateInfo::default()
|
let desc_alloc_info = vk::DescriptorSetAllocateInfo::builder()
|
||||||
.descriptor_pool(descriptor_pool)
|
.descriptor_pool(descriptor_pool)
|
||||||
.set_layouts(&desc_set_layouts);
|
.set_layouts(&desc_set_layouts)
|
||||||
|
.build();
|
||||||
|
|
||||||
let descriptor_sets = device.allocate_descriptor_sets(&desc_alloc_info).unwrap();
|
let descriptor_sets = device.allocate_descriptor_sets(&desc_alloc_info).unwrap();
|
||||||
|
|
||||||
let tex_descriptor = vk::DescriptorImageInfo {
|
let tex_descriptor = vk::DescriptorImageInfo {
|
||||||
|
@ -668,15 +686,16 @@ impl VulkanWindowInner {
|
||||||
device.update_descriptor_sets(&write_desc_sets, &[]);
|
device.update_descriptor_sets(&write_desc_sets, &[]);
|
||||||
|
|
||||||
let shader = ash::util::read_spv(&mut std::io::Cursor::new(SHADER)).unwrap();
|
let shader = ash::util::read_spv(&mut std::io::Cursor::new(SHADER)).unwrap();
|
||||||
let shader_info = vk::ShaderModuleCreateInfo::default().code(&shader);
|
let shader_info = vk::ShaderModuleCreateInfo::builder().code(&shader).build();
|
||||||
println!("shader info: {:#?}", shader_info);
|
println!("shader info: {:#?}", shader_info);
|
||||||
|
|
||||||
let shader_module = device
|
let shader_module = device
|
||||||
.create_shader_module(&shader_info, None)
|
.create_shader_module(&shader_info, None)
|
||||||
.expect("Error creating shader module");
|
.expect("Error creating shader module");
|
||||||
|
|
||||||
let layout_create_info =
|
let layout_create_info = vk::PipelineLayoutCreateInfo::builder()
|
||||||
vk::PipelineLayoutCreateInfo::default().set_layouts(&desc_set_layouts);
|
.set_layouts(&desc_set_layouts)
|
||||||
|
.build();
|
||||||
|
|
||||||
let pipeline_layout = device
|
let pipeline_layout = device
|
||||||
.create_pipeline_layout(&layout_create_info, None)
|
.create_pipeline_layout(&layout_create_info, None)
|
||||||
|
@ -711,9 +730,10 @@ impl VulkanWindowInner {
|
||||||
format: vk::Format::R32G32B32A32_SFLOAT,
|
format: vk::Format::R32G32B32A32_SFLOAT,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
}];
|
}];
|
||||||
let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::default()
|
let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::builder()
|
||||||
.vertex_attribute_descriptions(&vertex_input_attribute_descriptions)
|
.vertex_attribute_descriptions(&vertex_input_attribute_descriptions)
|
||||||
.vertex_binding_descriptions(&vertex_input_binding_descriptions);
|
.vertex_binding_descriptions(&vertex_input_binding_descriptions)
|
||||||
|
.build();
|
||||||
|
|
||||||
let vertex_input_assembly_state_info = vk::PipelineInputAssemblyStateCreateInfo {
|
let vertex_input_assembly_state_info = vk::PipelineInputAssemblyStateCreateInfo {
|
||||||
topology: vk::PrimitiveTopology::TRIANGLE_LIST,
|
topology: vk::PrimitiveTopology::TRIANGLE_LIST,
|
||||||
|
@ -728,9 +748,10 @@ impl VulkanWindowInner {
|
||||||
max_depth: 1.0,
|
max_depth: 1.0,
|
||||||
}];
|
}];
|
||||||
let scissors = [surface_resolution.into()];
|
let scissors = [surface_resolution.into()];
|
||||||
let viewport_state_info = vk::PipelineViewportStateCreateInfo::default()
|
let viewport_state_info = vk::PipelineViewportStateCreateInfo::builder()
|
||||||
.scissors(&scissors)
|
.scissors(&scissors)
|
||||||
.viewports(&viewports);
|
.viewports(&viewports)
|
||||||
|
.build();
|
||||||
|
|
||||||
let rasterization_info = vk::PipelineRasterizationStateCreateInfo {
|
let rasterization_info = vk::PipelineRasterizationStateCreateInfo {
|
||||||
front_face: vk::FrontFace::COUNTER_CLOCKWISE,
|
front_face: vk::FrontFace::COUNTER_CLOCKWISE,
|
||||||
|
@ -739,8 +760,9 @@ impl VulkanWindowInner {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let multisample_state_info = vk::PipelineMultisampleStateCreateInfo::default()
|
let multisample_state_info = vk::PipelineMultisampleStateCreateInfo::builder()
|
||||||
.rasterization_samples(vk::SampleCountFlags::TYPE_1);
|
.rasterization_samples(vk::SampleCountFlags::TYPE_1)
|
||||||
|
.build();
|
||||||
|
|
||||||
let color_blend_attachment_states = [vk::PipelineColorBlendAttachmentState {
|
let color_blend_attachment_states = [vk::PipelineColorBlendAttachmentState {
|
||||||
blend_enable: 0,
|
blend_enable: 0,
|
||||||
|
@ -752,15 +774,17 @@ impl VulkanWindowInner {
|
||||||
alpha_blend_op: vk::BlendOp::ADD,
|
alpha_blend_op: vk::BlendOp::ADD,
|
||||||
color_write_mask: vk::ColorComponentFlags::RGBA,
|
color_write_mask: vk::ColorComponentFlags::RGBA,
|
||||||
}];
|
}];
|
||||||
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::default()
|
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder()
|
||||||
.logic_op(vk::LogicOp::CLEAR)
|
.logic_op(vk::LogicOp::CLEAR)
|
||||||
.attachments(&color_blend_attachment_states);
|
.attachments(&color_blend_attachment_states)
|
||||||
|
.build();
|
||||||
|
|
||||||
let dynamic_state = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
|
let dynamic_state = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
|
||||||
let dynamic_state_info =
|
let dynamic_state_info = vk::PipelineDynamicStateCreateInfo::builder()
|
||||||
vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&dynamic_state);
|
.dynamic_states(&dynamic_state)
|
||||||
|
.build();
|
||||||
|
|
||||||
let graphic_pipeline_infos = vk::GraphicsPipelineCreateInfo::default()
|
let graphic_pipeline_infos = vk::GraphicsPipelineCreateInfo::builder()
|
||||||
.stages(&shader_stage_create_infos)
|
.stages(&shader_stage_create_infos)
|
||||||
.vertex_input_state(&vertex_input_state_info)
|
.vertex_input_state(&vertex_input_state_info)
|
||||||
.input_assembly_state(&vertex_input_assembly_state_info)
|
.input_assembly_state(&vertex_input_assembly_state_info)
|
||||||
|
@ -770,7 +794,8 @@ impl VulkanWindowInner {
|
||||||
.color_blend_state(&color_blend_state)
|
.color_blend_state(&color_blend_state)
|
||||||
.dynamic_state(&dynamic_state_info)
|
.dynamic_state(&dynamic_state_info)
|
||||||
.layout(pipeline_layout)
|
.layout(pipeline_layout)
|
||||||
.render_pass(renderpass);
|
.render_pass(renderpass)
|
||||||
|
.build();
|
||||||
|
|
||||||
let graphics_pipelines = device
|
let graphics_pipelines = device
|
||||||
.create_graphics_pipelines(vk::PipelineCache::null(), &[graphic_pipeline_infos], None)
|
.create_graphics_pipelines(vk::PipelineCache::null(), &[graphic_pipeline_infos], None)
|
||||||
|
@ -874,13 +899,15 @@ impl VulkanWindowInner {
|
||||||
&[],
|
&[],
|
||||||
&[texture_barrier],
|
&[texture_barrier],
|
||||||
);
|
);
|
||||||
let buffer_copy_regions = vk::BufferImageCopy::default()
|
let buffer_copy_regions = vk::BufferImageCopy::builder()
|
||||||
.image_subresource(
|
.image_subresource(
|
||||||
vk::ImageSubresourceLayers::default()
|
vk::ImageSubresourceLayers::builder()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.layer_count(1),
|
.layer_count(1)
|
||||||
|
.build(),
|
||||||
)
|
)
|
||||||
.image_extent(self.image_extent.into());
|
.image_extent(self.image_extent.into())
|
||||||
|
.build();
|
||||||
|
|
||||||
device.cmd_copy_buffer_to_image(
|
device.cmd_copy_buffer_to_image(
|
||||||
texture_command_buffer,
|
texture_command_buffer,
|
||||||
|
@ -934,11 +961,12 @@ impl VulkanWindowInner {
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
|
|
||||||
let render_pass_begin_info = vk::RenderPassBeginInfo::default()
|
let render_pass_begin_info = vk::RenderPassBeginInfo::builder()
|
||||||
.render_pass(self.renderpass)
|
.render_pass(self.renderpass)
|
||||||
.framebuffer(self.framebuffers[present_index as usize])
|
.framebuffer(self.framebuffers[present_index as usize])
|
||||||
.render_area(self.surface_resolution.into())
|
.render_area(self.surface_resolution.into())
|
||||||
.clear_values(&clear_values);
|
.clear_values(&clear_values)
|
||||||
|
.build();
|
||||||
|
|
||||||
record_submit_commandbuffer(
|
record_submit_commandbuffer(
|
||||||
&self.device,
|
&self.device,
|
||||||
|
@ -1074,8 +1102,9 @@ fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
|
||||||
)
|
)
|
||||||
.expect("Reset command buffer failed.");
|
.expect("Reset command buffer failed.");
|
||||||
|
|
||||||
let command_buffer_begin_info = vk::CommandBufferBeginInfo::default()
|
let command_buffer_begin_info = vk::CommandBufferBeginInfo::builder()
|
||||||
.flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT);
|
.flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT)
|
||||||
|
.build();
|
||||||
|
|
||||||
device
|
device
|
||||||
.begin_command_buffer(command_buffer, &command_buffer_begin_info)
|
.begin_command_buffer(command_buffer, &command_buffer_begin_info)
|
||||||
|
@ -1087,11 +1116,12 @@ fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
|
||||||
|
|
||||||
let command_buffers = vec![command_buffer];
|
let command_buffers = vec![command_buffer];
|
||||||
|
|
||||||
let submit_info = vk::SubmitInfo::default()
|
let submit_info = vk::SubmitInfo::builder()
|
||||||
.wait_semaphores(wait_semaphores)
|
.wait_semaphores(wait_semaphores)
|
||||||
.wait_dst_stage_mask(wait_mask)
|
.wait_dst_stage_mask(wait_mask)
|
||||||
.command_buffers(&command_buffers)
|
.command_buffers(&command_buffers)
|
||||||
.signal_semaphores(signal_semaphores);
|
.signal_semaphores(signal_semaphores)
|
||||||
|
.build();
|
||||||
|
|
||||||
device
|
device
|
||||||
.queue_submit(submit_queue, &[submit_info], command_buffer_reuse_fence)
|
.queue_submit(submit_queue, &[submit_info], command_buffer_reuse_fence)
|
||||||
|
|
Loading…
Add table
Reference in a new issue