diff --git a/examples/src/bin/buffer-pool.rs b/examples/src/bin/buffer-pool.rs index 1b427a9452..2f9577aa70 100644 --- a/examples/src/bin/buffer-pool.rs +++ b/examples/src/bin/buffer-pool.rs @@ -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; @@ -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() diff --git a/examples/src/bin/clear_attachments.rs b/examples/src/bin/clear_attachments.rs index 5c9ac08aa2..f1aa84e3e1 100644 --- a/examples/src/bin/clear_attachments.rs +++ b/examples/src/bin/clear_attachments.rs @@ -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 @@ -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() diff --git a/examples/src/bin/deferred/frame/system.rs b/examples/src/bin/deferred/frame/system.rs index a7097d7d07..d543b07a1b 100644 --- a/examples/src/bin/deferred/frame/system.rs +++ b/examples/src/bin/deferred/frame/system.rs @@ -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; @@ -159,7 +159,7 @@ impl FrameSystem { Format::A2B10G10R10_UNORM_PACK32, atch_usage, ) - .unwrap(), + .unwrap(), ImageViewType::Dim2d ) .unwrap(); let normals_buffer = ImageView::new( @@ -169,7 +169,7 @@ impl FrameSystem { Format::R16G16B16A16_SFLOAT, atch_usage, ) - .unwrap(), + .unwrap(), ImageViewType::Dim2d ) .unwrap(); let depth_buffer = ImageView::new( @@ -179,7 +179,7 @@ impl FrameSystem { Format::D16_UNORM, atch_usage, ) - .unwrap(), + .unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -254,7 +254,7 @@ impl FrameSystem { Format::A2B10G10R10_UNORM_PACK32, atch_usage, ) - .unwrap(), + .unwrap(), ImageViewType::Dim2d ) .unwrap(); self.normals_buffer = ImageView::new( @@ -264,7 +264,7 @@ impl FrameSystem { Format::R16G16B16A16_SFLOAT, atch_usage, ) - .unwrap(), + .unwrap(), ImageViewType::Dim2d ) .unwrap(); self.depth_buffer = ImageView::new( @@ -274,7 +274,7 @@ impl FrameSystem { Format::D16_UNORM, atch_usage, ) - .unwrap(), + .unwrap(), ImageViewType::Dim2d ) .unwrap(); } diff --git a/examples/src/bin/deferred/main.rs b/examples/src/bin/deferred/main.rs index 54ac0299a7..0861629d92 100644 --- a/examples/src/bin/deferred/main.rs +++ b/examples/src/bin/deferred/main.rs @@ -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; @@ -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::>(); (swapchain, images) }; @@ -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::>(); swapchain = new_swapchain; diff --git a/examples/src/bin/dynamic-local-size.rs b/examples/src/bin/dynamic-local-size.rs index 274637de65..b9333eeb12 100644 --- a/examples/src/bin/dynamic-local-size.rs +++ b/examples/src/bin/dynamic-local-size.rs @@ -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; @@ -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( diff --git a/examples/src/bin/image-self-copy-blit/main.rs b/examples/src/bin/image-self-copy-blit/main.rs index e1e57ef0ec..7e0da16d30 100644 --- a/examples/src/bin/image-self-copy-blit/main.rs +++ b/examples/src/bin/image-self-copy-blit/main.rs @@ -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 @@ -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(), ) }; @@ -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() diff --git a/examples/src/bin/image/main.rs b/examples/src/bin/image/main.rs index 283cffe765..f26b2800fa 100644 --- a/examples/src/bin/image/main.rs +++ b/examples/src/bin/image/main.rs @@ -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 @@ -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()) @@ -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() diff --git a/examples/src/bin/immutable-sampler/main.rs b/examples/src/bin/immutable-sampler/main.rs index afa893ae66..b38517abb7 100644 --- a/examples/src/bin/immutable-sampler/main.rs +++ b/examples/src/bin/immutable-sampler/main.rs @@ -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(); @@ -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()) @@ -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() diff --git a/examples/src/bin/indirect.rs b/examples/src/bin/indirect.rs index c005175b1b..5e56e353eb 100644 --- a/examples/src/bin/indirect.rs +++ b/examples/src/bin/indirect.rs @@ -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; @@ -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() diff --git a/examples/src/bin/instancing.rs b/examples/src/bin/instancing.rs index 5be95b9abd..0ddea082ad 100644 --- a/examples/src/bin/instancing.rs +++ b/examples/src/bin/instancing.rs @@ -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; @@ -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() diff --git a/examples/src/bin/interactive_fractal/renderer.rs b/examples/src/bin/interactive_fractal/renderer.rs index 916a24429d..084d3991fc 100644 --- a/examples/src/bin/interactive_fractal/renderer.rs +++ b/examples/src/bin/interactive_fractal/renderer.rs @@ -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, }; @@ -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::>(); (swap_chain, images) } @@ -309,7 +309,7 @@ impl Renderer { ..ImageUsage::none() }, ) - .unwrap(), + .unwrap(), ImageViewType::Dim2d ) .unwrap(); self.interim_image_views @@ -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::>(); self.final_views = new_images; // Resize images that follow swapchain size diff --git a/examples/src/bin/msaa-renderpass.rs b/examples/src/bin/msaa-renderpass.rs index dc0251deda..4e57bccf62 100644 --- a/examples/src/bin/msaa-renderpass.rs +++ b/examples/src/bin/msaa-renderpass.rs @@ -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}; @@ -140,7 +141,7 @@ fn main() { SampleCount::Sample4, Format::R8G8B8A8_UNORM, ) - .unwrap(), + .unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -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 diff --git a/examples/src/bin/multi-window.rs b/examples/src/bin/multi-window.rs index 4bcea652de..e63df83b42 100644 --- a/examples/src/bin/multi-window.rs +++ b/examples/src/bin/multi-window.rs @@ -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; @@ -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() diff --git a/examples/src/bin/multiview.rs b/examples/src/bin/multiview.rs index 994ec384a2..7c999eb43f 100644 --- a/examples/src/bin/multiview.rs +++ b/examples/src/bin/multiview.rs @@ -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, @@ -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)] diff --git a/examples/src/bin/occlusion-query.rs b/examples/src/bin/occlusion-query.rs index 95f64885c4..9d002c01c5 100644 --- a/examples/src/bin/occlusion-query.rs +++ b/examples/src/bin/occlusion-query.rs @@ -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(); @@ -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() diff --git a/examples/src/bin/push-descriptors/main.rs b/examples/src/bin/push-descriptors/main.rs index d006155d6e..9dac2544d8 100644 --- a/examples/src/bin/push-descriptors/main.rs +++ b/examples/src/bin/push-descriptors/main.rs @@ -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() { let required_extensions = vulkano_win::required_extensions(); @@ -172,7 +173,7 @@ fn main() { queue.clone(), ) .unwrap(); - (ImageView::new(image).unwrap(), future) + (ImageView::new(image, ImageViewType::Dim2d).unwrap(), future) }; let sampler = Sampler::start(device.clone()) @@ -319,7 +320,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() diff --git a/examples/src/bin/runtime-shader/main.rs b/examples/src/bin/runtime-shader/main.rs index 69334c4a7e..0e1aca7b89 100644 --- a/examples/src/bin/runtime-shader/main.rs +++ b/examples/src/bin/runtime-shader/main.rs @@ -27,7 +27,7 @@ use vulkano::buffer::{BufferUsage, 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; @@ -311,7 +311,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() diff --git a/examples/src/bin/runtime_array/main.rs b/examples/src/bin/runtime_array/main.rs index b64cc25cba..0e09a622f1 100644 --- a/examples/src/bin/runtime_array/main.rs +++ b/examples/src/bin/runtime_array/main.rs @@ -38,6 +38,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 @@ -235,7 +236,7 @@ fn main() { .unwrap() .0; - ImageView::new(image).unwrap() + ImageView::new(image, ImageViewType::Dim2d).unwrap() }; let vulkano_texture = { @@ -263,7 +264,7 @@ fn main() { .unwrap() .0; - ImageView::new(image).unwrap() + ImageView::new(image, ImageViewType::Dim2d).unwrap() }; let sampler = Sampler::start(device.clone()) @@ -447,7 +448,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() diff --git a/examples/src/bin/teapot/main.rs b/examples/src/bin/teapot/main.rs index 49efb87aff..a75d412ae3 100644 --- a/examples/src/bin/teapot/main.rs +++ b/examples/src/bin/teapot/main.rs @@ -19,7 +19,7 @@ use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType}; use vulkano::device::{Device, DeviceExtensions, Features}; use vulkano::format::Format; use vulkano::image::attachment::AttachmentImage; -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::depth_stencil::DepthStencilState; @@ -310,14 +310,14 @@ fn window_size_dependent_setup( let dimensions = images[0].dimensions().width_height(); let depth_buffer = ImageView::new( - AttachmentImage::transient(device.clone(), dimensions, Format::D16_UNORM).unwrap(), + AttachmentImage::transient(device.clone(), dimensions, Format::D16_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); let framebuffers = 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() diff --git a/examples/src/bin/tessellation.rs b/examples/src/bin/tessellation.rs index cc81981cc8..d67f37bce6 100644 --- a/examples/src/bin/tessellation.rs +++ b/examples/src/bin/tessellation.rs @@ -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, PrimitiveTopology}; @@ -412,7 +412,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() diff --git a/examples/src/bin/texture_array/main.rs b/examples/src/bin/texture_array/main.rs index 2917f9009c..0901199582 100644 --- a/examples/src/bin/texture_array/main.rs +++ b/examples/src/bin/texture_array/main.rs @@ -25,6 +25,7 @@ use vulkano::image::{ ImageDimensions, ImageUsage, ImmutableImage, MipmapsCount, SwapchainImage, view::ImageView, }; use vulkano::image::ImageAccess; +use vulkano::image::view::ImageViewType; use vulkano::instance::Instance; use vulkano::pipeline::{GraphicsPipeline, Pipeline, PipelineBindPoint}; use vulkano::pipeline::graphics::color_blend::ColorBlendState; @@ -180,7 +181,7 @@ fn main() { queue.clone(), ) .unwrap(); - (ImageView::new(image).unwrap(), future) + (ImageView::new(image, ImageViewType::Dim2dArray).unwrap(), future) }; let sampler = Sampler::simple_repeat_linear(device.clone()).unwrap(); @@ -331,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() diff --git a/examples/src/bin/triangle.rs b/examples/src/bin/triangle.rs index 0dfe4231d6..a4ef44c13f 100644 --- a/examples/src/bin/triangle.rs +++ b/examples/src/bin/triangle.rs @@ -21,7 +21,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; @@ -539,7 +539,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() diff --git a/vulkano/src/image/view.rs b/vulkano/src/image/view.rs index 17c9c25454..4aaff17595 100644 --- a/vulkano/src/image/view.rs +++ b/vulkano/src/image/view.rs @@ -52,23 +52,12 @@ where { /// Creates a default `ImageView`. Equivalent to `ImageView::start(image).build()`. #[inline] - pub fn new(image: Arc) -> Result>, ImageViewCreationError> { - Self::start(image).build() + pub fn new(image: Arc, ty: ImageViewType) -> Result>, ImageViewCreationError> { + Self::start(image, ty).build() } /// Begins building an `ImageView`. - pub fn start(image: Arc) -> ImageViewBuilder { - let ty = match image.dimensions() { - ImageDimensions::Dim1d { - array_layers: 1, .. - } => ImageViewType::Dim1d, - ImageDimensions::Dim1d { .. } => ImageViewType::Dim1dArray, - ImageDimensions::Dim2d { - array_layers: 1, .. - } => ImageViewType::Dim2d, - ImageDimensions::Dim2d { .. } => ImageViewType::Dim2dArray, - ImageDimensions::Dim3d { .. } => ImageViewType::Dim3d, - }; + pub fn start(image: Arc, ty: ImageViewType) -> ImageViewBuilder { let mipmap_levels = 0..image.mipmap_levels(); let array_layers = 0..image.dimensions().array_layers(); diff --git a/vulkano/src/render_pass/compat_atch.rs b/vulkano/src/render_pass/compat_atch.rs index 082a9dc073..3cfd41ed04 100644 --- a/vulkano/src/render_pass/compat_atch.rs +++ b/vulkano/src/render_pass/compat_atch.rs @@ -180,7 +180,7 @@ mod tests { use super::ensure_image_view_compatible; use super::IncompatibleRenderPassAttachmentError; use crate::format::Format; - use crate::image::view::ImageView; + use crate::image::view::{ImageView, ImageViewType}; use crate::image::AttachmentImage; use crate::render_pass::RenderPassDesc; @@ -205,7 +205,7 @@ mod tests { .unwrap(); let view = ImageView::new( - AttachmentImage::new(device, [128, 128], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device, [128, 128], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -233,7 +233,7 @@ mod tests { .unwrap(); let view = ImageView::new( - AttachmentImage::new(device, [128, 128], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device, [128, 128], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -252,7 +252,7 @@ mod tests { let rp = RenderPassDesc::empty(); let view = ImageView::new( - AttachmentImage::new(device, [128, 128], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device, [128, 128], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); diff --git a/vulkano/src/render_pass/framebuffer.rs b/vulkano/src/render_pass/framebuffer.rs index 17fb5f2d5f..7d879ba92b 100644 --- a/vulkano/src/render_pass/framebuffer.rs +++ b/vulkano/src/render_pass/framebuffer.rs @@ -485,7 +485,7 @@ impl From for FramebufferCreationError { mod tests { use crate::format::Format; use crate::image::attachment::AttachmentImage; - use crate::image::view::ImageView; + use crate::image::view::{ImageView, ImageViewType}; use crate::render_pass::Framebuffer; use crate::render_pass::FramebufferCreationError; use crate::render_pass::RenderPass; @@ -511,7 +511,7 @@ mod tests { .unwrap(); let view = ImageView::new( - AttachmentImage::new(device.clone(), [1024, 768], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [1024, 768], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); let _ = Framebuffer::start(render_pass) @@ -554,7 +554,7 @@ mod tests { .unwrap(); let view = ImageView::new( - AttachmentImage::new(device.clone(), [1024, 768], Format::R8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [1024, 768], Format::R8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -587,7 +587,7 @@ mod tests { .unwrap(); let view = ImageView::new( - AttachmentImage::new(device.clone(), [600, 600], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [600, 600], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -619,7 +619,7 @@ mod tests { .unwrap(); let view = ImageView::new( - AttachmentImage::new(device.clone(), [512, 700], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [512, 700], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -662,11 +662,11 @@ mod tests { .unwrap(); let a = ImageView::new( - AttachmentImage::new(device.clone(), [512, 512], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [512, 512], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); let b = ImageView::new( - AttachmentImage::new(device.clone(), [512, 513], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [512, 513], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -709,11 +709,11 @@ mod tests { .unwrap(); let a = ImageView::new( - AttachmentImage::new(device.clone(), [256, 512], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [256, 512], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); let b = ImageView::new( - AttachmentImage::new(device.clone(), [512, 128], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [512, 128], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -758,7 +758,7 @@ mod tests { .unwrap(); let view = ImageView::new( - AttachmentImage::new(device.clone(), [256, 512], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [256, 512], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); @@ -797,11 +797,11 @@ mod tests { .unwrap(); let a = ImageView::new( - AttachmentImage::new(device.clone(), [256, 512], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [256, 512], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap(); let b = ImageView::new( - AttachmentImage::new(device.clone(), [256, 512], Format::R8G8B8A8_UNORM).unwrap(), + AttachmentImage::new(device.clone(), [256, 512], Format::R8G8B8A8_UNORM).unwrap(), ImageViewType::Dim2d ) .unwrap();