Skip to content

Commit

Permalink
Change ImageView constructor to explicitly require ImageViewType
Browse files Browse the repository at this point in the history
  • Loading branch information
TJYSunset committed Jan 20, 2022
1 parent b54cafc commit 3ad5571
Show file tree
Hide file tree
Showing 25 changed files with 83 additions and 84 deletions.
4 changes: 2 additions & 2 deletions examples/src/bin/buffer-pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use vulkano::buffer::CpuBufferPool;
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage, SubpassContents};
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::{Device, DeviceExtensions, Features};
use vulkano::image::view::ImageView;
use vulkano::image::view::{ImageView, ImageViewType};
use vulkano::image::{ImageAccess, ImageUsage, SwapchainImage};
use vulkano::instance::Instance;
use vulkano::pipeline::graphics::input_assembly::InputAssemblyState;
Expand Down Expand Up @@ -332,7 +332,7 @@ fn window_size_dependent_setup(
images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
3 changes: 2 additions & 1 deletion examples/src/bin/clear_attachments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use vulkano_win::VkSurfaceBuild;
use winit::event::{Event, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::{Window, WindowBuilder};
use vulkano::image::view::ImageViewType;

fn main() {
// The start of this example is exactly the same as `triangle`. You should read the
Expand Down Expand Up @@ -289,7 +290,7 @@ fn window_size_dependent_setup(
images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
14 changes: 7 additions & 7 deletions examples/src/bin/deferred/frame/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use vulkano::command_buffer::{
};
use vulkano::device::Queue;
use vulkano::format::Format;
use vulkano::image::view::ImageView;
use vulkano::image::view::{ImageView, ImageViewType};
use vulkano::image::AttachmentImage;
use vulkano::image::ImageAccess;
use vulkano::image::ImageUsage;
Expand Down Expand Up @@ -159,7 +159,7 @@ impl FrameSystem {
Format::A2B10G10R10_UNORM_PACK32,
atch_usage,
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();
let normals_buffer = ImageView::new(
Expand All @@ -169,7 +169,7 @@ impl FrameSystem {
Format::R16G16B16A16_SFLOAT,
atch_usage,
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();
let depth_buffer = ImageView::new(
Expand All @@ -179,7 +179,7 @@ impl FrameSystem {
Format::D16_UNORM,
atch_usage,
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();

Expand Down Expand Up @@ -254,7 +254,7 @@ impl FrameSystem {
Format::A2B10G10R10_UNORM_PACK32,
atch_usage,
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();
self.normals_buffer = ImageView::new(
Expand All @@ -264,7 +264,7 @@ impl FrameSystem {
Format::R16G16B16A16_SFLOAT,
atch_usage,
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();
self.depth_buffer = ImageView::new(
Expand All @@ -274,7 +274,7 @@ impl FrameSystem {
Format::D16_UNORM,
atch_usage,
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();
}
Expand Down
6 changes: 3 additions & 3 deletions examples/src/bin/deferred/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use cgmath::SquareMatrix;
use cgmath::Vector3;
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::{Device, DeviceExtensions, Features};
use vulkano::image::view::ImageView;
use vulkano::image::view::{ImageView, ImageViewType};
use vulkano::image::ImageUsage;
use vulkano::instance::Instance;
use vulkano::swapchain;
Expand Down Expand Up @@ -113,7 +113,7 @@ fn main() {
.unwrap();
let images = images
.into_iter()
.map(|image| ImageView::new(image.clone()).unwrap())
.map(|image| ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap())
.collect::<Vec<_>>();
(swapchain, images)
};
Expand Down Expand Up @@ -152,7 +152,7 @@ fn main() {
};
let new_images = new_images
.into_iter()
.map(|image| ImageView::new(image.clone()).unwrap())
.map(|image| ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap())
.collect::<Vec<_>>();

swapchain = new_swapchain;
Expand Down
3 changes: 2 additions & 1 deletion examples/src/bin/dynamic-local-size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::{Device, DeviceExtensions, Features};
use vulkano::format::Format;
use vulkano::image::{view::ImageView, ImageDimensions, StorageImage};
use vulkano::image::view::ImageViewType;
use vulkano::instance::{Instance, InstanceExtensions};
use vulkano::pipeline::{ComputePipeline, Pipeline, PipelineBindPoint};
use vulkano::sync;
Expand Down Expand Up @@ -193,7 +194,7 @@ fn main() {
Some(queue.family()),
)
.unwrap();
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();

let layout = pipeline.layout().descriptor_set_layouts().get(0).unwrap();
let set = PersistentDescriptorSet::new(
Expand Down
5 changes: 3 additions & 2 deletions examples/src/bin/image-self-copy-blit/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use vulkano_win::VkSurfaceBuild;
use winit::event::{Event, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::{Window, WindowBuilder};
use vulkano::image::view::ImageViewType;

fn main() {
// The start of this example is exactly the same as `triangle`. You should read the
Expand Down Expand Up @@ -238,7 +239,7 @@ fn main() {
let command_buffer = builder.build().unwrap();

(
ImageView::new(image).unwrap(),
ImageView::new(image, ImageViewType::Dim2d).unwrap(),
command_buffer.execute(queue.clone()).unwrap(),
)
};
Expand Down Expand Up @@ -395,7 +396,7 @@ fn window_size_dependent_setup(
images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
5 changes: 3 additions & 2 deletions examples/src/bin/image/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use vulkano_win::VkSurfaceBuild;
use winit::event::{Event, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::{Window, WindowBuilder};
use vulkano::image::view::ImageViewType;

fn main() {
// The start of this example is exactly the same as `triangle`. You should read the
Expand Down Expand Up @@ -174,7 +175,7 @@ fn main() {
queue.clone(),
)
.unwrap();
(ImageView::new(image).unwrap(), future)
(ImageView::new(image, ImageViewType::Dim2d).unwrap(), future)
};

let sampler = Sampler::start(device.clone())
Expand Down Expand Up @@ -329,7 +330,7 @@ fn window_size_dependent_setup(
images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
5 changes: 3 additions & 2 deletions examples/src/bin/immutable-sampler/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use vulkano_win::VkSurfaceBuild;
use winit::event::{Event, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::{Window, WindowBuilder};
use vulkano::image::view::ImageViewType;

fn main() {
let required_extensions = vulkano_win::required_extensions();
Expand Down Expand Up @@ -180,7 +181,7 @@ fn main() {
queue.clone(),
)
.unwrap();
(ImageView::new(image).unwrap(), future)
(ImageView::new(image, ImageViewType::Dim2d).unwrap(), future)
};

let sampler = Sampler::start(device.clone())
Expand Down Expand Up @@ -337,7 +338,7 @@ fn window_size_dependent_setup(
images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
4 changes: 2 additions & 2 deletions examples/src/bin/indirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use vulkano::command_buffer::{
use vulkano::descriptor_set::{PersistentDescriptorSet, WriteDescriptorSet};
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::{Device, DeviceExtensions, Features};
use vulkano::image::view::ImageView;
use vulkano::image::view::{ImageView, ImageViewType};
use vulkano::image::{ImageAccess, ImageUsage, SwapchainImage};
use vulkano::instance::Instance;
use vulkano::pipeline::graphics::input_assembly::InputAssemblyState;
Expand Down Expand Up @@ -415,7 +415,7 @@ fn window_size_dependent_setup(
images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
4 changes: 2 additions & 2 deletions examples/src/bin/instancing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer, TypedBufferAccess};
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage, SubpassContents};
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::{Device, DeviceExtensions, Features};
use vulkano::image::view::ImageView;
use vulkano::image::view::{ImageView, ImageViewType};
use vulkano::image::{ImageAccess, ImageUsage, SwapchainImage};
use vulkano::instance::Instance;
use vulkano::pipeline::graphics::input_assembly::InputAssemblyState;
Expand Down Expand Up @@ -382,7 +382,7 @@ fn window_size_dependent_setup(
images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
8 changes: 4 additions & 4 deletions examples/src/bin/interactive_fractal/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::sync::Arc;
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::{Device, DeviceExtensions, Features, Queue};
use vulkano::format::Format;
use vulkano::image::view::ImageView;
use vulkano::image::view::{ImageView, ImageViewType};
use vulkano::image::{
AttachmentImage, ImageAccess, ImageUsage, ImageViewAbstract, SampleCount, SwapchainImage,
};
Expand Down Expand Up @@ -211,7 +211,7 @@ impl Renderer {
.unwrap();
let images = images
.into_iter()
.map(|image| ImageView::new(image).unwrap())
.map(|image| ImageView::new(image, ImageViewType::Dim2d).unwrap())
.collect::<Vec<_>>();
(swap_chain, images)
}
Expand Down Expand Up @@ -309,7 +309,7 @@ impl Renderer {
..ImageUsage::none()
},
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();
self.interim_image_views
Expand Down Expand Up @@ -427,7 +427,7 @@ impl Renderer {
self.swap_chain = new_swapchain;
let new_images = new_images
.into_iter()
.map(|image| ImageView::new(image).unwrap())
.map(|image| ImageView::new(image, ImageViewType::Dim2d).unwrap())
.collect::<Vec<_>>();
self.final_views = new_images;
// Resize images that follow swapchain size
Expand Down
7 changes: 4 additions & 3 deletions examples/src/bin/msaa-renderpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ use vulkano::format::Format;
use vulkano::image::{
view::ImageView, AttachmentImage, ImageDimensions, SampleCount, StorageImage,
};
use vulkano::image::view::ImageViewType;
use vulkano::instance::Instance;
use vulkano::pipeline::graphics::vertex_input::BuffersDefinition;
use vulkano::pipeline::graphics::viewport::{Viewport, ViewportState};
Expand Down Expand Up @@ -140,7 +141,7 @@ fn main() {
SampleCount::Sample4,
Format::R8G8B8A8_UNORM,
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();

Expand All @@ -153,10 +154,10 @@ fn main() {
array_layers: 1,
},
Format::R8G8B8A8_UNORM,
Some(queue.family()),
Some(queue.family())
)
.unwrap();
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();

// In this example, we are going to perform the *resolve* (ie. turning a multisampled image
// into a non-multisampled one) as part of the render pass. This is the preferred method of
Expand Down
4 changes: 2 additions & 2 deletions examples/src/bin/multi-window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer, TypedBufferAccess};
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage, SubpassContents};
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::{Device, DeviceExtensions, Features};
use vulkano::image::view::ImageView;
use vulkano::image::view::{ImageView, ImageViewType};
use vulkano::image::{ImageAccess, ImageUsage, SwapchainImage};
use vulkano::instance::Instance;
use vulkano::pipeline::graphics::input_assembly::InputAssemblyState;
Expand Down Expand Up @@ -411,7 +411,7 @@ fn window_size_dependent_setup(
images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
4 changes: 2 additions & 2 deletions examples/src/bin/multiview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage, Subp
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::{Device, DeviceExtensions, Features};
use vulkano::format::Format;
use vulkano::image::view::ImageView;
use vulkano::image::view::{ImageView, ImageViewType};
use vulkano::image::{
ImageAccess, ImageCreateFlags, ImageDimensions, ImageLayout, ImageUsage, SampleCount,
StorageImage,
Expand Down Expand Up @@ -129,7 +129,7 @@ fn main() {
)
.unwrap();

let image_view = ImageView::new(image.clone()).unwrap();
let image_view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();

#[repr(C)]
#[derive(Default, Debug, Clone)]
Expand Down
7 changes: 4 additions & 3 deletions examples/src/bin/occlusion-query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use vulkano_win::VkSurfaceBuild;
use winit::event::{Event, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::{Window, WindowBuilder};
use vulkano::image::view::ImageViewType;

fn main() {
let required_extensions = vulkano_win::required_extensions();
Expand Down Expand Up @@ -451,16 +452,16 @@ fn window_size_dependent_setup(
depth_stencil_attachment: true,
transient_attachment: true,
..ImageUsage::none()
},
}
)
.unwrap(),
.unwrap(), ImageViewType::Dim2d
)
.unwrap();

images
.iter()
.map(|image| {
let view = ImageView::new(image.clone()).unwrap();
let view = ImageView::new(image.clone(), ImageViewType::Dim2d).unwrap();
Framebuffer::start(render_pass.clone())
.add(view)
.unwrap()
Expand Down
Loading

0 comments on commit 3ad5571

Please sign in to comment.