Skip to content
This repository has been archived by the owner on Jan 30, 2022. It is now read-only.

Commit

Permalink
update to 0.20 (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeanedved authored Apr 10, 2021
1 parent c830fe5 commit e73625f
Show file tree
Hide file tree
Showing 30 changed files with 1,268 additions and 638 deletions.
1,374 changes: 826 additions & 548 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ publish = false

[dependencies]
# The `vulkano` crate is the main crate that you must use to use Vulkan.
vulkano = "0.19.0"
vulkano = "0.20"
# Provides the `shader!` macro that is used to generate code for using shaders.
vulkano-shaders = "0.19.0"
vulkano-shaders = "0.20"
# The Vulkan library doesn't provide any functionality to create and handle windows, as
# this would be out of scope. In order to open a window, we are going to use the `winit` crate.
winit = "0.22"
winit = "0.24"
# The `vulkano_win` crate is the link between `vulkano` and `winit`. Vulkano doesn't know about winit,
# and winit doesn't know about vulkano, so import a crate that will provide a link between the two.
vulkano-win = "0.19.0"
vulkano-win = "0.20"

cgmath = "0.17"
png = "0.15.0"
time = "0.1.38"
serde = { version="1.0.114", features = ["derive"] }
ron = "0.6.0"
6 changes: 3 additions & 3 deletions src/bin/basic-compute-shader.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand Down Expand Up @@ -99,7 +99,7 @@ fn main() {
}
}
let shader = cs::Shader::load(device.clone()).unwrap();
ComputePipeline::new(device.clone(), &shader.main_entry_point(), &()).unwrap()
ComputePipeline::new(device.clone(), &shader.main_entry_point(), &(), None).unwrap()
});

// We start by creating the buffer that will store the data.
Expand Down
12 changes: 8 additions & 4 deletions src/bin/buffer-pool.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2020 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand All @@ -20,7 +20,7 @@
// Finally, I have not profiled CpuBufferPool against CpuAccessibleBuffer

use vulkano::buffer::CpuBufferPool;
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState, SubpassContents};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::{ImageUsage, SwapchainImage};
Expand Down Expand Up @@ -279,7 +279,11 @@ fn main() {
)
.unwrap();
builder
.begin_render_pass(framebuffers[image_num].clone(), false, clear_values)
.begin_render_pass(
framebuffers[image_num].clone(),
SubpassContents::Inline,
clear_values,
)
.unwrap()
// Draw our buffer
.draw(pipeline.clone(), &dynamic_state, buffer, (), ())
Expand Down
6 changes: 4 additions & 2 deletions src/bin/debug.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2016 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand All @@ -11,6 +11,7 @@ use vulkano::device::{Device, DeviceExtensions};
use vulkano::format::Format;
use vulkano::image::Dimensions;
use vulkano::image::ImmutableImage;
use vulkano::image::MipmapsCount;
use vulkano::instance;
use vulkano::instance::debug::{DebugCallback, MessageSeverity, MessageType};
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice};
Expand Down Expand Up @@ -130,6 +131,7 @@ fn main() {
let _ = ImmutableImage::from_iter(
DATA.iter().cloned(),
dimensions,
MipmapsCount::One,
pixel_format,
queue.clone(),
)
Expand Down
4 changes: 2 additions & 2 deletions src/bin/deferred/frame/ambient_lighting_system.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand Down
4 changes: 2 additions & 2 deletions src/bin/deferred/frame/directional_lighting_system.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand Down
4 changes: 2 additions & 2 deletions src/bin/deferred/frame/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand Down
4 changes: 2 additions & 2 deletions src/bin/deferred/frame/point_lighting_system.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand Down
9 changes: 5 additions & 4 deletions src/bin/deferred/frame/system.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand All @@ -13,6 +13,7 @@ use cgmath::Vector3;
use std::sync::Arc;
use vulkano::command_buffer::AutoCommandBufferBuilder;
use vulkano::command_buffer::CommandBuffer;
use vulkano::command_buffer::SubpassContents;
use vulkano::device::Queue;
use vulkano::format::Format;
use vulkano::framebuffer::Framebuffer;
Expand Down Expand Up @@ -288,7 +289,7 @@ impl FrameSystem {
command_buffer_builder
.begin_render_pass(
framebuffer.clone(),
true,
SubpassContents::SecondaryCommandBuffers,
vec![
[0.0, 0.0, 0.0, 0.0].into(),
[0.0, 0.0, 0.0, 0.0].into(),
Expand Down Expand Up @@ -359,7 +360,7 @@ impl<'a> Frame<'a> {
self.command_buffer_builder
.as_mut()
.unwrap()
.next_subpass(true)
.next_subpass(SubpassContents::SecondaryCommandBuffers)
.unwrap();

// And returning an object that will allow the user to apply lighting to the scene.
Expand Down
6 changes: 3 additions & 3 deletions src/bin/deferred/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand All @@ -26,6 +26,7 @@
// drawn after the lighting, and that the whole process consumes more memory.

use vulkano::device::{Device, DeviceExtensions};
use vulkano::image::ImageUsage;
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::swapchain;
use vulkano::swapchain::{
Expand All @@ -34,7 +35,6 @@ use vulkano::swapchain::{
};
use vulkano::sync;
use vulkano::sync::{FlushError, GpuFuture};
use vulkano::image::ImageUsage;

use vulkano_win::VkSurfaceBuild;
use winit::event::{Event, WindowEvent};
Expand Down
4 changes: 2 additions & 2 deletions src/bin/deferred/triangle_draw_system.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand Down
12 changes: 9 additions & 3 deletions src/bin/dynamic-local-size.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2020 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand Down Expand Up @@ -155,7 +155,13 @@ fn main() {
constant_2: local_size_y,
};
let pipeline = Arc::new(
ComputePipeline::new(device.clone(), &shader.main_entry_point(), &spec_consts).unwrap(),
ComputePipeline::new(
device.clone(),
&shader.main_entry_point(),
&spec_consts,
None,
)
.unwrap(),
);

let image = StorageImage::new(
Expand Down
15 changes: 10 additions & 5 deletions src/bin/image/main.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Copyright (c) 2016 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.

use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState, SubpassContents};
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
use vulkano::device::{Device, DeviceExtensions};
use vulkano::format::Format;
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::{Dimensions, ImageUsage, ImmutableImage, SwapchainImage};
use vulkano::image::{Dimensions, ImageUsage, ImmutableImage, MipmapsCount, SwapchainImage};
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::pipeline::viewport::Viewport;
use vulkano::pipeline::GraphicsPipeline;
Expand Down Expand Up @@ -163,6 +163,7 @@ fn main() {
ImmutableImage::from_iter(
image_data.iter().cloned(),
dimensions,
MipmapsCount::One,
Format::R8G8B8A8Srgb,
queue.clone(),
)
Expand Down Expand Up @@ -273,7 +274,11 @@ fn main() {
AutoCommandBufferBuilder::primary_one_time_submit(device.clone(), queue.family())
.unwrap();
builder
.begin_render_pass(framebuffers[image_num].clone(), false, clear_values)
.begin_render_pass(
framebuffers[image_num].clone(),
SubpassContents::Inline,
clear_values,
)
.unwrap()
.draw(
pipeline.clone(),
Expand Down
16 changes: 11 additions & 5 deletions src/bin/indirect.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2019 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand Down Expand Up @@ -31,7 +31,9 @@ extern crate vulkano_win;
extern crate winit;

use vulkano::buffer::{BufferUsage, CpuBufferPool};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DrawIndirectCommand, DynamicState};
use vulkano::command_buffer::{
AutoCommandBufferBuilder, DrawIndirectCommand, DynamicState, SubpassContents,
};
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
use vulkano::descriptor::PipelineLayoutAbstract;
use vulkano::device::{Device, DeviceExtensions};
Expand Down Expand Up @@ -207,7 +209,7 @@ fn main() {
let vertex_pool: CpuBufferPool<Vertex> = CpuBufferPool::new(device.clone(), BufferUsage::all());

let compute_pipeline =
Arc::new(ComputePipeline::new(device.clone(), &cs.main_entry_point(), &()).unwrap());
Arc::new(ComputePipeline::new(device.clone(), &cs.main_entry_point(), &(), None).unwrap());

let render_pass = Arc::new(
single_pass_renderpass!(
Expand Down Expand Up @@ -349,7 +351,11 @@ fn main() {
(),
)
.unwrap()
.begin_render_pass(framebuffers[image_num].clone(), false, clear_values)
.begin_render_pass(
framebuffers[image_num].clone(),
SubpassContents::Inline,
clear_values,
)
.unwrap()
// The indirect draw call is placed in the command buffer with a reference to the GPU buffer that will
// contain the arguments when the draw is executed on the GPU
Expand Down
12 changes: 8 additions & 4 deletions src/bin/instancing.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2016 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
Expand All @@ -19,7 +19,7 @@ extern crate vulkano_win;
extern crate winit;

use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState, SubpassContents};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::{ImageUsage, SwapchainImage};
Expand Down Expand Up @@ -318,7 +318,11 @@ fn main() {
)
.unwrap();
builder
.begin_render_pass(framebuffers[image_num].clone(), false, clear_values)
.begin_render_pass(
framebuffers[image_num].clone(),
SubpassContents::Inline,
clear_values,
)
.unwrap()
.draw(
pipeline.clone(),
Expand Down
Loading

0 comments on commit e73625f

Please sign in to comment.