inlining slices when on Device methods
This commit is contained in:
parent
5422a8032d
commit
f0251c157a
|
@ -384,7 +384,7 @@ fn main() {
|
||||||
&[],
|
&[],
|
||||||
&[texture_barrier],
|
&[texture_barrier],
|
||||||
);
|
);
|
||||||
let buffer_copy_regions = [vk::BufferImageCopy::builder()
|
let buffer_copy_regions = vk::BufferImageCopy::builder()
|
||||||
.image_subresource(
|
.image_subresource(
|
||||||
vk::ImageSubresourceLayers::builder()
|
vk::ImageSubresourceLayers::builder()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
|
@ -395,15 +395,14 @@ fn main() {
|
||||||
width: image_dimensions.0,
|
width: image_dimensions.0,
|
||||||
height: image_dimensions.1,
|
height: image_dimensions.1,
|
||||||
depth: 1,
|
depth: 1,
|
||||||
})
|
});
|
||||||
.build()];
|
|
||||||
|
|
||||||
device.cmd_copy_buffer_to_image(
|
device.cmd_copy_buffer_to_image(
|
||||||
texture_command_buffer,
|
texture_command_buffer,
|
||||||
image_buffer,
|
image_buffer,
|
||||||
texture_image,
|
texture_image,
|
||||||
vk::ImageLayout::TRANSFER_DST_OPTIMAL,
|
vk::ImageLayout::TRANSFER_DST_OPTIMAL,
|
||||||
&buffer_copy_regions,
|
&[buffer_copy_regions.build()],
|
||||||
);
|
);
|
||||||
let texture_barrier_end = vk::ImageMemoryBarrier {
|
let texture_barrier_end = vk::ImageMemoryBarrier {
|
||||||
src_access_mask: vk::AccessFlags::TRANSFER_WRITE,
|
src_access_mask: vk::AccessFlags::TRANSFER_WRITE,
|
||||||
|
@ -682,7 +681,7 @@ fn main() {
|
||||||
let dynamic_state_info =
|
let dynamic_state_info =
|
||||||
vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&dynamic_state);
|
vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&dynamic_state);
|
||||||
|
|
||||||
let graphic_pipeline_infos = [vk::GraphicsPipelineCreateInfo::builder()
|
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)
|
||||||
|
@ -693,12 +692,15 @@ fn main() {
|
||||||
.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 = base
|
let graphics_pipelines = base
|
||||||
.device
|
.device
|
||||||
.create_graphics_pipelines(vk::PipelineCache::null(), &graphic_pipeline_infos, None)
|
.create_graphics_pipelines(
|
||||||
|
vk::PipelineCache::null(),
|
||||||
|
&[graphic_pipeline_infos.build()],
|
||||||
|
None,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let graphic_pipeline = graphics_pipelines[0];
|
let graphic_pipeline = graphics_pipelines[0];
|
||||||
|
|
|
@ -339,7 +339,7 @@ fn main() {
|
||||||
let dynamic_state_info =
|
let dynamic_state_info =
|
||||||
vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&dynamic_state);
|
vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&dynamic_state);
|
||||||
|
|
||||||
let graphic_pipeline_info = [vk::GraphicsPipelineCreateInfo::builder()
|
let graphic_pipeline_info = 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)
|
||||||
|
@ -350,12 +350,15 @@ fn main() {
|
||||||
.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 = base
|
let graphics_pipelines = base
|
||||||
.device
|
.device
|
||||||
.create_graphics_pipelines(vk::PipelineCache::null(), &graphic_pipeline_info, None)
|
.create_graphics_pipelines(
|
||||||
|
vk::PipelineCache::null(),
|
||||||
|
&[graphic_pipeline_info.build()],
|
||||||
|
None,
|
||||||
|
)
|
||||||
.expect("Unable to create graphics pipeline");
|
.expect("Unable to create graphics pipeline");
|
||||||
|
|
||||||
let graphic_pipeline = graphics_pipelines[0];
|
let graphic_pipeline = graphics_pipelines[0];
|
||||||
|
|
|
@ -87,14 +87,15 @@ pub fn record_submit_commandbuffer<D: DeviceV1_0, F: FnOnce(&D, vk::CommandBuffe
|
||||||
.expect("Create fence failed.");
|
.expect("Create fence failed.");
|
||||||
|
|
||||||
let command_buffers = vec![command_buffer];
|
let command_buffers = vec![command_buffer];
|
||||||
let submit_info = [vk::SubmitInfo::builder()
|
|
||||||
|
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, submit_fence)
|
.queue_submit(submit_queue, &[submit_info.build()], submit_fence)
|
||||||
.expect("queue submit failed.");
|
.expect("queue submit failed.");
|
||||||
device
|
device
|
||||||
.wait_for_fences(&[submit_fence], true, std::u64::MAX)
|
.wait_for_fences(&[submit_fence], true, std::u64::MAX)
|
||||||
|
@ -567,7 +568,7 @@ impl ExampleBase {
|
||||||
&[],
|
&[],
|
||||||
&[],
|
&[],
|
||||||
|device, setup_command_buffer| {
|
|device, setup_command_buffer| {
|
||||||
let layout_transition_barriers = [vk::ImageMemoryBarrier::builder()
|
let layout_transition_barriers = vk::ImageMemoryBarrier::builder()
|
||||||
.image(depth_image)
|
.image(depth_image)
|
||||||
.dst_access_mask(
|
.dst_access_mask(
|
||||||
vk::AccessFlags::DEPTH_STENCIL_ATTACHMENT_READ
|
vk::AccessFlags::DEPTH_STENCIL_ATTACHMENT_READ
|
||||||
|
@ -581,8 +582,7 @@ impl ExampleBase {
|
||||||
.layer_count(1)
|
.layer_count(1)
|
||||||
.level_count(1)
|
.level_count(1)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
);
|
||||||
.build()];
|
|
||||||
|
|
||||||
device.cmd_pipeline_barrier(
|
device.cmd_pipeline_barrier(
|
||||||
setup_command_buffer,
|
setup_command_buffer,
|
||||||
|
@ -591,7 +591,7 @@ impl ExampleBase {
|
||||||
vk::DependencyFlags::empty(),
|
vk::DependencyFlags::empty(),
|
||||||
&[],
|
&[],
|
||||||
&[],
|
&[],
|
||||||
&layout_transition_barriers,
|
&[layout_transition_barriers.build()],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue