|
|
@ -32,7 +32,7 @@ use vulkano::pipeline::viewport::Viewport;
|
|
|
|
use image::ImageFormat;
|
|
|
|
use image::ImageFormat;
|
|
|
|
use vulkano::image::immutable::ImmutableImage;
|
|
|
|
use vulkano::image::immutable::ImmutableImage;
|
|
|
|
use vulkano::image::attachment::AttachmentImage;
|
|
|
|
use vulkano::image::attachment::AttachmentImage;
|
|
|
|
use vulkano::image::Dimensions;
|
|
|
|
use vulkano::image::{Dimensions, ImageUsage};
|
|
|
|
use vulkano::format::Format;
|
|
|
|
use vulkano::format::Format;
|
|
|
|
use vulkano::sampler::{Sampler, Filter, MipmapMode, SamplerAddressMode};
|
|
|
|
use vulkano::sampler::{Sampler, Filter, MipmapMode, SamplerAddressMode};
|
|
|
|
|
|
|
|
|
|
|
@ -104,7 +104,7 @@ pub struct VkProcessor<'a> {
|
|
|
|
pub queues: QueuesIter,
|
|
|
|
pub queues: QueuesIter,
|
|
|
|
pub queue: Arc<Queue>,
|
|
|
|
pub queue: Arc<Queue>,
|
|
|
|
pub compute_set: Option<Arc<PersistentDescriptorSet<std::sync::Arc<ComputePipeline<PipelineLayout<shade_runner::layouts::ComputeLayout>>>, ((((), PersistentDescriptorSetBuf<std::sync::Arc<vulkano::buffer::cpu_access::CpuAccessibleBuffer<[u8]>>>), PersistentDescriptorSetBuf<std::sync::Arc<vulkano::buffer::cpu_access::CpuAccessibleBuffer<[u8]>>>), PersistentDescriptorSetBuf<std::sync::Arc<vulkano::buffer::cpu_access::CpuAccessibleBuffer<[u32]>>>)>>>,
|
|
|
|
pub compute_set: Option<Arc<PersistentDescriptorSet<std::sync::Arc<ComputePipeline<PipelineLayout<shade_runner::layouts::ComputeLayout>>>, ((((), PersistentDescriptorSetBuf<std::sync::Arc<vulkano::buffer::cpu_access::CpuAccessibleBuffer<[u8]>>>), PersistentDescriptorSetBuf<std::sync::Arc<vulkano::buffer::cpu_access::CpuAccessibleBuffer<[u8]>>>), PersistentDescriptorSetBuf<std::sync::Arc<vulkano::buffer::cpu_access::CpuAccessibleBuffer<[u32]>>>)>>>,
|
|
|
|
pub img_set: Option<Arc<PersistentDescriptorSet<Arc<dyn GraphicsPipelineAbstract + Send + Sync>, (((), PersistentDescriptorSetImg<Arc<ImmutableImage<Format>>>), PersistentDescriptorSetSampler)>>>,
|
|
|
|
pub img_set: Option<Arc<PersistentDescriptorSet<Arc<dyn GraphicsPipelineAbstract + Send + Sync>, ((((), PersistentDescriptorSetImg<Arc<ImmutableImage<Format>>>), PersistentDescriptorSetSampler), PersistentDescriptorSetImg<Arc<AttachmentImage>>)>>>,
|
|
|
|
pub graphics_image_buffer: Option<Arc<ImmutableImage<Format>>>,
|
|
|
|
pub graphics_image_buffer: Option<Arc<ImmutableImage<Format>>>,
|
|
|
|
pub image_buffer: Vec<u8>,
|
|
|
|
pub image_buffer: Vec<u8>,
|
|
|
|
pub img_buffers: Vec<Arc<CpuAccessibleBuffer<[u8]>>>,
|
|
|
|
pub img_buffers: Vec<Arc<CpuAccessibleBuffer<[u8]>>>,
|
|
|
@ -115,7 +115,7 @@ pub struct VkProcessor<'a> {
|
|
|
|
pub render_pass: Option<Arc<RenderPassAbstract + Send + Sync>>,
|
|
|
|
pub render_pass: Option<Arc<RenderPassAbstract + Send + Sync>>,
|
|
|
|
pub vertex_buffer: Option<Arc<(dyn BufferAccess + std::marker::Send + std::marker::Sync + 'static)>>,
|
|
|
|
pub vertex_buffer: Option<Arc<(dyn BufferAccess + std::marker::Send + std::marker::Sync + 'static)>>,
|
|
|
|
pub dynamic_state: DynamicState,
|
|
|
|
pub dynamic_state: DynamicState,
|
|
|
|
pub graphics_iamge_swap_buffer: Option<i32>,
|
|
|
|
pub graphics_iamge_swap_buffer: Option<std::sync::Arc<vulkano::image::attachment::AttachmentImage>>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -341,15 +341,21 @@ impl<'a> VkProcessor<'a> {
|
|
|
|
).unwrap()
|
|
|
|
).unwrap()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let image = {
|
|
|
|
let attachment_image = {
|
|
|
|
let image = image::load_from_memory_with_format(include_bytes!("../resources/images/funky-bird.jpg"),
|
|
|
|
let image = image::load_from_memory_with_format(include_bytes!("../resources/images/funky-bird.jpg"),
|
|
|
|
ImageFormat::JPEG).unwrap().to_rgba();
|
|
|
|
ImageFormat::JPEG).unwrap().to_rgba();
|
|
|
|
let dimensions = image.dimensions();
|
|
|
|
let dimensions = image.dimensions();
|
|
|
|
let image_data = image.into_raw().clone();
|
|
|
|
let image_data = image.into_raw().clone();
|
|
|
|
|
|
|
|
|
|
|
|
AttachmentImage::new(self.device.clone(),
|
|
|
|
let mut usage = ImageUsage::none();
|
|
|
|
|
|
|
|
usage.transfer_destination = true;
|
|
|
|
|
|
|
|
usage.storage = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AttachmentImage::with_usage(
|
|
|
|
|
|
|
|
self.device.clone(),
|
|
|
|
[dimensions.0, dimensions.1],
|
|
|
|
[dimensions.0, dimensions.1],
|
|
|
|
Format::R8G8B8A8Srgb)
|
|
|
|
Format::R8G8B8A8Uint,
|
|
|
|
|
|
|
|
usage)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let sampler = Sampler::new(self.device.clone(), Filter::Linear, Filter::Linear,
|
|
|
|
let sampler = Sampler::new(self.device.clone(), Filter::Linear, Filter::Linear,
|
|
|
@ -395,11 +401,11 @@ impl<'a> VkProcessor<'a> {
|
|
|
|
|
|
|
|
|
|
|
|
self.img_set = Some(Arc::new(PersistentDescriptorSet::start(self.graphics_pipeline.clone().unwrap().clone(), 0)
|
|
|
|
self.img_set = Some(Arc::new(PersistentDescriptorSet::start(self.graphics_pipeline.clone().unwrap().clone(), 0)
|
|
|
|
.add_sampled_image(texture.clone(), sampler.clone()).unwrap()
|
|
|
|
.add_sampled_image(texture.clone(), sampler.clone()).unwrap()
|
|
|
|
.add_image(image.unwrap().clone()).unwrap()
|
|
|
|
.add_image(attachment_image.clone().unwrap().clone()).unwrap()
|
|
|
|
.build().unwrap()));
|
|
|
|
.build().unwrap()));
|
|
|
|
|
|
|
|
|
|
|
|
self.graphics_image_buffer = Some(texture.clone());
|
|
|
|
self.graphics_image_buffer = Some(texture.clone());
|
|
|
|
self.graphics_iamge_swap_buffer = Some(image.clone().unwrap());
|
|
|
|
self.graphics_iamge_swap_buffer = Some(attachment_image.clone().unwrap());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|