missed some premature .build() calls!
This commit is contained in:
parent
ca651f07cb
commit
752fc1f1ee
|
@ -645,8 +645,7 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
let multisample_state_info = vk::PipelineMultisampleStateCreateInfo::builder()
|
let multisample_state_info = vk::PipelineMultisampleStateCreateInfo::builder()
|
||||||
.rasterization_samples(vk::SampleCountFlags::TYPE_1)
|
.rasterization_samples(vk::SampleCountFlags::TYPE_1);
|
||||||
.build();
|
|
||||||
|
|
||||||
let noop_stencil_state = vk::StencilOpState {
|
let noop_stencil_state = vk::StencilOpState {
|
||||||
fail_op: vk::StencilOp::KEEP,
|
fail_op: vk::StencilOp::KEEP,
|
||||||
|
@ -683,23 +682,23 @@ 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_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)
|
||||||
.viewport_state(&viewport_state_info)
|
.viewport_state(&viewport_state_info)
|
||||||
.rasterization_state(&rasterization_info)
|
.rasterization_state(&rasterization_info)
|
||||||
.multisample_state(&multisample_state_info)
|
.multisample_state(&multisample_state_info)
|
||||||
.depth_stencil_state(&depth_state_info)
|
.depth_stencil_state(&depth_state_info)
|
||||||
.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();
|
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_infos, None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let graphic_pipeline = graphics_pipelines[0];
|
let graphic_pipeline = graphics_pipelines[0];
|
||||||
|
|
|
@ -339,23 +339,23 @@ 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)
|
||||||
.viewport_state(&viewport_state_info)
|
.viewport_state(&viewport_state_info)
|
||||||
.rasterization_state(&rasterization_info)
|
.rasterization_state(&rasterization_info)
|
||||||
.multisample_state(&multisample_state_info)
|
.multisample_state(&multisample_state_info)
|
||||||
.depth_stencil_state(&depth_state_info)
|
.depth_stencil_state(&depth_state_info)
|
||||||
.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();
|
.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, 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];
|
||||||
|
|
|
@ -40,7 +40,6 @@ use std::default::Default;
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::ops::Drop;
|
use std::ops::Drop;
|
||||||
use std::os::raw::{c_char, c_void};
|
use std::os::raw::{c_char, c_void};
|
||||||
use std::ptr;
|
|
||||||
|
|
||||||
// Simple offset_of macro akin to C++ offsetof
|
// Simple offset_of macro akin to C++ offsetof
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
@ -82,22 +81,19 @@ pub fn record_submit_commandbuffer<D: DeviceV1_0, F: FnOnce(&D, vk::CommandBuffe
|
||||||
.end_command_buffer(command_buffer)
|
.end_command_buffer(command_buffer)
|
||||||
.expect("End commandbuffer");
|
.expect("End commandbuffer");
|
||||||
|
|
||||||
let fence_create_info = vk::FenceCreateInfo::default();
|
|
||||||
|
|
||||||
let submit_fence = device
|
let submit_fence = device
|
||||||
.create_fence(&fence_create_info, None)
|
.create_fence(&vk::FenceCreateInfo::default(), None)
|
||||||
.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();
|
.build()];
|
||||||
|
|
||||||
device
|
device
|
||||||
.queue_submit(submit_queue, &[submit_info], submit_fence)
|
.queue_submit(submit_queue, &submit_info, 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)
|
||||||
|
@ -342,14 +338,12 @@ impl ExampleBase {
|
||||||
.application_version(0)
|
.application_version(0)
|
||||||
.engine_name(&app_name)
|
.engine_name(&app_name)
|
||||||
.engine_version(0)
|
.engine_version(0)
|
||||||
.api_version(vk_make_version!(1, 0, 36))
|
.api_version(vk_make_version!(1, 0, 36));
|
||||||
.build();
|
|
||||||
|
|
||||||
let create_info = vk::InstanceCreateInfo::builder()
|
let create_info = vk::InstanceCreateInfo::builder()
|
||||||
.application_info(&appinfo)
|
.application_info(&appinfo)
|
||||||
.enabled_layer_names(&layers_names_raw)
|
.enabled_layer_names(&layers_names_raw)
|
||||||
.enabled_extension_names(&extension_names_raw)
|
.enabled_extension_names(&extension_names_raw);
|
||||||
.build();
|
|
||||||
|
|
||||||
let instance: Instance = entry
|
let instance: Instance = entry
|
||||||
.create_instance(&create_info, None)
|
.create_instance(&create_info, None)
|
||||||
|
@ -554,8 +548,7 @@ impl ExampleBase {
|
||||||
|
|
||||||
let depth_image_allocate_info = vk::MemoryAllocateInfo::builder()
|
let depth_image_allocate_info = vk::MemoryAllocateInfo::builder()
|
||||||
.allocation_size(depth_image_memory_req.size)
|
.allocation_size(depth_image_memory_req.size)
|
||||||
.memory_type_index(depth_image_memory_index)
|
.memory_type_index(depth_image_memory_index);
|
||||||
.build();
|
|
||||||
|
|
||||||
let depth_image_memory = device
|
let depth_image_memory = device
|
||||||
.allocate_memory(&depth_image_allocate_info, None)
|
.allocate_memory(&depth_image_allocate_info, None)
|
||||||
|
@ -570,26 +563,25 @@ impl ExampleBase {
|
||||||
setup_command_buffer,
|
setup_command_buffer,
|
||||||
present_queue,
|
present_queue,
|
||||||
&[],
|
&[],
|
||||||
// &[vk::PipelineStageFlags::BOTTOM_OF_PIPE],
|
|
||||||
&[],
|
&[],
|
||||||
&[],
|
&[],
|
||||||
|device, setup_command_buffer| {
|
|device, setup_command_buffer| {
|
||||||
let layout_transition_barrier = 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
|
||||||
| vk::AccessFlags::DEPTH_STENCIL_ATTACHMENT_WRITE,
|
| vk::AccessFlags::DEPTH_STENCIL_ATTACHMENT_WRITE,
|
||||||
)
|
)
|
||||||
.new_layout(vk::ImageLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL)
|
.new_layout(vk::ImageLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL)
|
||||||
.old_layout(vk::ImageLayout::UNDEFINED)
|
.old_layout(vk::ImageLayout::UNDEFINED)
|
||||||
.subresource_range(
|
.subresource_range(
|
||||||
vk::ImageSubresourceRange::builder()
|
vk::ImageSubresourceRange::builder()
|
||||||
.aspect_mask(vk::ImageAspectFlags::DEPTH)
|
.aspect_mask(vk::ImageAspectFlags::DEPTH)
|
||||||
.layer_count(1)
|
.layer_count(1)
|
||||||
.level_count(1)
|
.level_count(1)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.build();
|
.build()];
|
||||||
|
|
||||||
device.cmd_pipeline_barrier(
|
device.cmd_pipeline_barrier(
|
||||||
setup_command_buffer,
|
setup_command_buffer,
|
||||||
|
@ -598,7 +590,7 @@ impl ExampleBase {
|
||||||
vk::DependencyFlags::empty(),
|
vk::DependencyFlags::empty(),
|
||||||
&[],
|
&[],
|
||||||
&[],
|
&[],
|
||||||
&[layout_transition_barrier],
|
&layout_transition_barriers,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -613,8 +605,7 @@ impl ExampleBase {
|
||||||
)
|
)
|
||||||
.image(depth_image)
|
.image(depth_image)
|
||||||
.format(depth_image_create_info.format)
|
.format(depth_image_create_info.format)
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
.view_type(vk::ImageViewType::TYPE_2D);
|
||||||
.build();
|
|
||||||
|
|
||||||
let depth_image_view = device
|
let depth_image_view = device
|
||||||
.create_image_view(&depth_image_view_info, None)
|
.create_image_view(&depth_image_view_info, None)
|
||||||
|
|
Loading…
Reference in a new issue