Merge remote-tracking branch 'origin/generator' into generator

This commit is contained in:
Tim 2018-08-03 11:55:27 +02:00
commit eeb17a07a1
4 changed files with 19 additions and 25 deletions

View file

@ -1,6 +1,6 @@
environment: environment:
matrix: matrix:
- TARGET: 1.21.0-x86_64-pc-windows - TARGET: 1.28.0-x86_64-pc-windows
COMPILER: msvc COMPILER: msvc
install: install:
- if %COMPILER%==gnu choco install -y mingw - if %COMPILER%==gnu choco install -y mingw

View file

@ -13,8 +13,6 @@ documentation = "https://docs.rs/ash"
shared_library = "0.1.5" shared_library = "0.1.5"
lazy_static = "0.2.1" lazy_static = "0.2.1"
libc = "0.2.26" libc = "0.2.26"
enumflags = "*"
enumflags_derive = "*"
[features] [features]
default = [] default = []

View file

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["maik klein <maikklein@googlemail.com>"] authors = ["maik klein <maikklein@googlemail.com>"]
[dependencies] [dependencies]
winit = "0.11.1" winit = "0.16"
image = "0.10.4" image = "0.10.4"
ash = { path = "../ash" } ash = { path = "../ash" }

View file

@ -46,8 +46,7 @@ pub fn record_submit_commandbuffer<D: DeviceV1_0, F: FnOnce(&D, vk::CommandBuffe
.reset_command_buffer( .reset_command_buffer(
command_buffer, command_buffer,
vk::CommandBufferResetFlags::RELEASE_RESOURCES, vk::CommandBufferResetFlags::RELEASE_RESOURCES,
) ).expect("Reset command buffer failed.");
.expect("Reset command buffer failed.");
let command_buffer_begin_info = vk::CommandBufferBeginInfo { let command_buffer_begin_info = vk::CommandBufferBeginInfo {
s_type: vk::StructureType::COMMAND_BUFFER_BEGIN_INFO, s_type: vk::StructureType::COMMAND_BUFFER_BEGIN_INFO,
p_next: ptr::null(), p_next: ptr::null(),
@ -254,7 +253,7 @@ impl ExampleBase {
ControlFlow::Continue ControlFlow::Continue
} }
} }
WindowEvent::Closed => winit::ControlFlow::Break, WindowEvent::Destroyed => winit::ControlFlow::Break,
_ => ControlFlow::Continue, _ => ControlFlow::Continue,
}, },
_ => ControlFlow::Continue, _ => ControlFlow::Continue,
@ -267,8 +266,10 @@ impl ExampleBase {
let events_loop = winit::EventsLoop::new(); let events_loop = winit::EventsLoop::new();
let window = winit::WindowBuilder::new() let window = winit::WindowBuilder::new()
.with_title("Ash - Example") .with_title("Ash - Example")
.with_dimensions(window_width, window_height) .with_dimensions(winit::dpi::LogicalSize::new(
.build(&events_loop) window_width as f64,
window_height as f64,
)).build(&events_loop)
.unwrap(); .unwrap();
let entry = Entry::new().unwrap(); let entry = Entry::new().unwrap();
let app_name = CString::new("VulkanTriangle").unwrap(); let app_name = CString::new("VulkanTriangle").unwrap();
@ -331,8 +332,8 @@ impl ExampleBase {
.enumerate() .enumerate()
.filter_map(|(index, ref info)| { .filter_map(|(index, ref info)| {
let supports_graphic_and_surface = let supports_graphic_and_surface =
info.queue_flags.subset(vk::QueueFlags::GRAPHICS) info.queue_flags.subset(vk::QueueFlags::GRAPHICS) && surface_loader
&& surface_loader.get_physical_device_surface_support_khr( .get_physical_device_surface_support_khr(
*pdevice, *pdevice,
index as u32, index as u32,
surface, surface,
@ -341,10 +342,8 @@ impl ExampleBase {
true => Some((*pdevice, index)), true => Some((*pdevice, index)),
_ => None, _ => None,
} }
}) }).nth(0)
.nth(0) }).filter_map(|v| v)
})
.filter_map(|v| v)
.nth(0) .nth(0)
.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;
@ -390,8 +389,7 @@ impl ExampleBase {
color_space: sfmt.color_space, color_space: sfmt.color_space,
}, },
_ => sfmt.clone(), _ => sfmt.clone(),
}) }).nth(0)
.nth(0)
.expect("Unable to find suitable surface format."); .expect("Unable to find suitable surface format.");
let surface_capabilities = surface_loader let surface_capabilities = surface_loader
.get_physical_device_surface_capabilities_khr(pdevice, surface) .get_physical_device_surface_capabilities_khr(pdevice, surface)
@ -498,8 +496,7 @@ impl ExampleBase {
image: image, image: image,
}; };
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 depth_image_create_info = vk::ImageCreateInfo { let depth_image_create_info = vk::ImageCreateInfo {
s_type: vk::StructureType::IMAGE_CREATE_INFO, s_type: vk::StructureType::IMAGE_CREATE_INFO,
@ -524,12 +521,11 @@ impl ExampleBase {
}; };
let depth_image = device.create_image(&depth_image_create_info, None).unwrap(); let depth_image = device.create_image(&depth_image_create_info, None).unwrap();
let depth_image_memory_req = device.get_image_memory_requirements(depth_image); let depth_image_memory_req = device.get_image_memory_requirements(depth_image);
let depth_image_memory_index = let depth_image_memory_index = find_memorytype_index(
find_memorytype_index( &depth_image_memory_req,
&depth_image_memory_req, &device_memory_properties,
&device_memory_properties, vk::MemoryPropertyFlags::DEVICE_LOCAL,
vk::MemoryPropertyFlags::DEVICE_LOCAL, ).expect("Unable to find suitable memory index for depth image.");
).expect("Unable to find suitable memory index for depth image.");
let depth_image_allocate_info = vk::MemoryAllocateInfo { let depth_image_allocate_info = vk::MemoryAllocateInfo {
s_type: vk::StructureType::MEMORY_ALLOCATE_INFO, s_type: vk::StructureType::MEMORY_ALLOCATE_INFO,