This commit is contained in:
colin 2018-12-09 08:01:13 -06:00
parent bb54ae4c5a
commit ca651f07cb
3 changed files with 18 additions and 9 deletions

View file

@ -390,11 +390,13 @@ fn main() {
.aspect_mask(vk::ImageAspectFlags::COLOR) .aspect_mask(vk::ImageAspectFlags::COLOR)
.layer_count(1) .layer_count(1)
.build(), .build(),
).image_extent(vk::Extent3D { )
.image_extent(vk::Extent3D {
width: image_dimensions.0, width: image_dimensions.0,
height: image_dimensions.1, height: image_dimensions.1,
depth: 1, depth: 1,
}).build()]; })
.build()];
device.cmd_copy_buffer_to_image( device.cmd_copy_buffer_to_image(
texture_command_buffer, texture_command_buffer,
@ -551,10 +553,12 @@ fn main() {
let mut frag_spv_file = let mut frag_spv_file =
File::open(Path::new("shader/texture/frag.spv")).expect("Could not find frag.spv."); File::open(Path::new("shader/texture/frag.spv")).expect("Could not find frag.spv.");
let vertex_code = read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file"); let vertex_code =
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");
let vertex_shader_info = vk::ShaderModuleCreateInfo::builder().code(&vertex_code); let vertex_shader_info = vk::ShaderModuleCreateInfo::builder().code(&vertex_code);
let frag_code = read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file"); let frag_code =
read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file");
let frag_shader_info = vk::ShaderModuleCreateInfo::builder().code(&frag_code); let frag_shader_info = vk::ShaderModuleCreateInfo::builder().code(&frag_code);
let vertex_shader_module = base let vertex_shader_module = base

View file

@ -207,10 +207,12 @@ fn main() {
let mut frag_spv_file = let mut frag_spv_file =
File::open(Path::new("shader/triangle/frag.spv")).expect("Could not find frag.spv."); File::open(Path::new("shader/triangle/frag.spv")).expect("Could not find frag.spv.");
let vertex_code = read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file"); let vertex_code =
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");
let vertex_shader_info = vk::ShaderModuleCreateInfo::builder().code(&vertex_code); let vertex_shader_info = vk::ShaderModuleCreateInfo::builder().code(&vertex_code);
let frag_code = read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file"); let frag_code =
read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file");
let frag_shader_info = vk::ShaderModuleCreateInfo::builder().code(&frag_code); let frag_shader_info = vk::ShaderModuleCreateInfo::builder().code(&frag_code);
let vertex_shader_module = base let vertex_shader_module = base

View file

@ -579,7 +579,8 @@ impl ExampleBase {
.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()
@ -587,7 +588,8 @@ impl ExampleBase {
.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,
@ -608,7 +610,8 @@ impl ExampleBase {
.level_count(1) .level_count(1)
.layer_count(1) .layer_count(1)
.build(), .build(),
).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(); .build();