Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: monocodus[bot] <49363530+monocodus[bot]@users.noreply.github.com>
  • Loading branch information
Limeth and monocodus[bot] authored Aug 2, 2020
1 parent 99e6df7 commit 2bfbd4d
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions src/backend/vulkan/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,39 +693,37 @@ impl d::Device<B> for Device {
None
};

let view_offsets = if multiview_enabled {
Some(
dependencies
.iter()
.map(|dependency| {
dependency.borrow().view_offset
})
.collect::<Vec<i32>>()
)
} else {
None
};
let view_offsets = if multiview_enabled {
Some(
dependencies
.iter()
.map(|dependency| dependency.borrow().view_offset)
.collect::<Vec<i32>>(),
)
} else {
None
};

let result = inplace_it::inplace_or_alloc_array(vk_dependencies.len(), |uninit_guard| {
let vk_dependencies =
uninit_guard.init_with_iter(vk_dependencies);

let mut info_builder = vk::RenderPassCreateInfo::builder()
.flags(vk::RenderPassCreateFlags::empty())
.attachments(&attachments)
.subpasses(&subpasses)
.dependencies(&vk_dependencies);
let mut multiview;

if multiview_enabled {
multiview = vk::RenderPassMultiviewCreateInfo::builder()
.view_masks(&view_masks.unwrap())
.view_offsets(&view_offsets.unwrap())
.correlation_masks(correlation_masks.unwrap())
.build();

info_builder = info_builder.push_next(&mut multiview);
}
let result =
inplace_it::inplace_or_alloc_array(vk_dependencies.len(), |uninit_guard| {
let vk_dependencies = uninit_guard.init_with_iter(vk_dependencies);

let mut info_builder = vk::RenderPassCreateInfo::builder()
.flags(vk::RenderPassCreateFlags::empty())
.attachments(&attachments)
.subpasses(&subpasses)
.dependencies(&vk_dependencies);
let mut multiview;

if multiview_enabled {
multiview = vk::RenderPassMultiviewCreateInfo::builder()
.view_masks(&view_masks.unwrap())
.view_offsets(&view_offsets.unwrap())
.correlation_masks(correlation_masks.unwrap())
.build();

info_builder = info_builder.push_next(&mut multiview);
}

self.shared.raw.create_render_pass(&info_builder.build(), None)
});
Expand Down

0 comments on commit 2bfbd4d

Please sign in to comment.