use same pdev

This commit is contained in:
Alex Janka 2023-10-02 18:40:02 +11:00
parent e5a75ce06a
commit fa501247ad

View file

@ -36,14 +36,10 @@ impl WindowData {
use_render_pass: true, use_render_pass: true,
disable_cache: false, disable_cache: false,
}; };
let physical_devices = unsafe { inner.instance.enumerate_physical_devices().unwrap() };
let physical_device = physical_devices.first().unwrap(); let vulkan =
let vulkan = VulkanObjects::try_from(( VulkanObjects::try_from((inner.pdevice, inner.instance.clone(), inner.device.clone()))
*physical_device, .unwrap();
inner.instance.clone(),
inner.device.clone(),
))
.unwrap();
let filter_chain = unsafe { let filter_chain = unsafe {
FilterChain::load_from_path(options.shader_path, vulkan, Some(&filter_chain_options)) FilterChain::load_from_path(options.shader_path, vulkan, Some(&filter_chain_options))
} }
@ -69,6 +65,8 @@ impl WindowData {
} }
struct VulkanWindowInner { struct VulkanWindowInner {
pdevice: vk::PhysicalDevice,
instance: Instance, instance: Instance,
device: Device, device: Device,
surface_loader: Surface, surface_loader: Surface,
@ -686,7 +684,6 @@ impl VulkanWindowInner {
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::builder().code(&shader).build(); let shader_info = vk::ShaderModuleCreateInfo::builder().code(&shader).build();
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)
@ -837,6 +834,7 @@ impl VulkanWindowInner {
image_buffer_memory_req, image_buffer_memory_req,
image_extent, image_extent,
texture_image, texture_image,
pdevice,
} }
} }