update examples to use ImageUsage::color_attachment instead of caps.supported_usage_flags (#1373)

* add additional ImageUsage constructors

* update examples to use ImageUsage::color_attachment instead of caps.supported_usage_flags

* fix additional usage in multi-window example

* update ignore to not include mandelbrot.png and triangle.png

* update ignore to not include mandelbrot.png and triangle.png
This commit is contained in:
Austin Johnson 2020-06-01 02:10:02 -05:00 committed by GitHub
parent 536ac5303b
commit a4591a20cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 23 additions and 35 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
target
/Cargo.lock
.cargo
examples/src/bin/triangle.png
examples/**/triangle.png
examples/**/mandelbrot.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

View File

@ -23,7 +23,7 @@ use vulkano::buffer::CpuBufferPool;
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::SwapchainImage;
use vulkano::image::{SwapchainImage, ImageUsage};
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::pipeline::viewport::Viewport;
use vulkano::pipeline::GraphicsPipeline;
@ -86,8 +86,6 @@ fn main() {
let (mut swapchain, images) = {
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
let alpha = caps.supported_composite_alpha.iter().next().unwrap();
let format = caps.supported_formats[0].0;
let dimensions: [u32; 2] = surface.window().inner_size().into();
@ -99,7 +97,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -34,6 +34,7 @@ use vulkano::swapchain::{
};
use vulkano::sync;
use vulkano::sync::{FlushError, GpuFuture};
use vulkano::image::ImageUsage;
use vulkano_win::VkSurfaceBuild;
use winit::event::{Event, WindowEvent};
@ -82,8 +83,6 @@ fn main() {
let (mut swapchain, mut images) = {
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
let alpha = caps.supported_composite_alpha.iter().next().unwrap();
let format = caps.supported_formats[0].0;
let dimensions: [u32; 2] = surface.window().inner_size().into();
@ -95,7 +94,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -13,7 +13,7 @@ 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, ImmutableImage, SwapchainImage};
use vulkano::image::{Dimensions, ImmutableImage, SwapchainImage, ImageUsage};
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::pipeline::viewport::Viewport;
use vulkano::pipeline::GraphicsPipeline;
@ -74,8 +74,6 @@ fn main() {
let (mut swapchain, images) = {
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
let alpha = caps.supported_composite_alpha.iter().next().unwrap();
let format = caps.supported_formats[0].0;
let dimensions: [u32; 2] = surface.window().inner_size().into();
@ -87,7 +85,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -36,7 +36,7 @@ use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
use vulkano::descriptor::PipelineLayoutAbstract;
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::SwapchainImage;
use vulkano::image::{SwapchainImage, ImageUsage};
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::pipeline::viewport::Viewport;
use vulkano::pipeline::{ComputePipeline, GraphicsPipeline};
@ -101,7 +101,6 @@ fn main() {
let (mut swapchain, images) = {
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
let alpha = caps.supported_composite_alpha.iter().next().unwrap();
let format = caps.supported_formats[0].0;
let dimensions: [u32; 2] = surface.window().inner_size().into();
@ -113,7 +112,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -22,7 +22,7 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::SwapchainImage;
use vulkano::image::{SwapchainImage, ImageUsage};
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::pipeline::vertex::OneVertexOneInstanceDefinition;
use vulkano::pipeline::viewport::Viewport;
@ -99,7 +99,6 @@ fn main() {
let (mut swapchain, images) = {
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
let alpha = caps.supported_composite_alpha.iter().next().unwrap();
let format = caps.supported_formats[0].0;
let dimensions: [u32; 2] = surface.window().inner_size().into();
@ -111,7 +110,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -20,7 +20,7 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::SwapchainImage;
use vulkano::image::{SwapchainImage, ImageUsage};
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::pipeline::viewport::Viewport;
use vulkano::pipeline::GraphicsPipeline;
@ -97,7 +97,6 @@ fn main() {
// The swapchain and framebuffer images for this perticular window
let (swapchain, images) = {
let usage = surface_caps.supported_usage_flags;
let alpha = surface_caps
.supported_composite_alpha
.iter()
@ -113,7 +112,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,
@ -275,7 +274,6 @@ fn main() {
.unwrap();
let window_id = surface.window().id();
let (swapchain, images) = {
let usage = surface_caps.supported_usage_flags;
let alpha = surface_caps
.supported_composite_alpha
.iter()
@ -291,7 +289,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -32,7 +32,7 @@ use vulkano::device::Device;
use vulkano::device::DeviceExtensions;
use vulkano::format::Format;
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::SwapchainImage;
use vulkano::image::{SwapchainImage, ImageUsage};
use vulkano::instance::Instance;
use vulkano::pipeline::shader::{
GraphicsShaderType, ShaderInterfaceDef, ShaderInterfaceDefEntry, ShaderModule,
@ -100,7 +100,6 @@ fn main() {
let (mut swapchain, images) = {
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
let alpha = caps.supported_composite_alpha.iter().next().unwrap();
let format = caps.supported_formats[0].0;
let dimensions: [u32; 2] = surface.window().inner_size().into();
@ -112,7 +111,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -15,7 +15,7 @@ use vulkano::device::{Device, DeviceExtensions};
use vulkano::format::Format;
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::attachment::AttachmentImage;
use vulkano::image::SwapchainImage;
use vulkano::image::{SwapchainImage, ImageUsage};
use vulkano::instance::Instance;
use vulkano::instance::PhysicalDevice;
use vulkano::pipeline::vertex::TwoBuffersDefinition;
@ -83,7 +83,6 @@ fn main() {
let (mut swapchain, images) = {
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
let format = caps.supported_formats[0].0;
let alpha = caps.supported_composite_alpha.iter().next().unwrap();
@ -94,7 +93,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -22,7 +22,7 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::SwapchainImage;
use vulkano::image::{SwapchainImage, ImageUsage};
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::pipeline::viewport::Viewport;
use vulkano::pipeline::GraphicsPipeline;
@ -172,7 +172,6 @@ fn main() {
let (mut swapchain, images) = {
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
let alpha = caps.supported_composite_alpha.iter().next().unwrap();
let format = caps.supported_formats[0].0;
let dimensions: [u32; 2] = surface.window().inner_size().into();
@ -184,7 +183,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

View File

@ -20,7 +20,7 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::SwapchainImage;
use vulkano::image::{SwapchainImage, ImageUsage};
use vulkano::instance::{Instance, PhysicalDevice};
use vulkano::pipeline::viewport::Viewport;
use vulkano::pipeline::GraphicsPipeline;
@ -151,7 +151,6 @@ fn main() {
// Querying the capabilities of the surface. When we create the swapchain we can only
// pass values that are allowed by the capabilities.
let caps = surface.capabilities(physical).unwrap();
let usage = caps.supported_usage_flags;
// The alpha mode indicates how the alpha value of the final image will behave. For example
// you can choose whether the window will be opaque or transparent.
@ -180,7 +179,7 @@ fn main() {
format,
dimensions,
1,
usage,
ImageUsage::color_attachment(),
&queue,
SurfaceTransform::Identity,
alpha,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB