vk: fix some bugs in the format
This commit is contained in:
parent
18a96d5e5e
commit
9dd656d49f
|
@ -105,6 +105,11 @@ impl FilterPass {
|
||||||
let render_pass_info = vk::RenderPassBeginInfo::builder()
|
let render_pass_info = vk::RenderPassBeginInfo::builder()
|
||||||
.framebuffer(output.output.framebuffer)
|
.framebuffer(output.output.framebuffer)
|
||||||
.render_pass(self.graphics_pipeline.render_pass.handle)
|
.render_pass(self.graphics_pipeline.render_pass.handle)
|
||||||
|
.clear_values(&[vk::ClearValue {
|
||||||
|
color: vk::ClearColorValue {
|
||||||
|
float32: [0.0, 0.0, 0.0, 0.0]
|
||||||
|
}
|
||||||
|
}])
|
||||||
.render_area(vk::Rect2D {
|
.render_area(vk::Rect2D {
|
||||||
offset: Default::default(),
|
offset: Default::default(),
|
||||||
extent: output.output.size.into(),
|
extent: output.output.size.into(),
|
||||||
|
|
|
@ -6,64 +6,6 @@ use ash::vk;
|
||||||
use ash::vk::{ImageAspectFlags, ImageViewType};
|
use ash::vk::{ImageAspectFlags, ImageViewType};
|
||||||
use librashader_common::Size;
|
use librashader_common::Size;
|
||||||
|
|
||||||
pub struct VulkanFramebuffer {
|
|
||||||
pub device: ash::Device,
|
|
||||||
pub framebuffer: vk::Framebuffer,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for VulkanFramebuffer {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
unsafe {
|
|
||||||
if self.framebuffer != vk::Framebuffer::null() {
|
|
||||||
self.device.destroy_framebuffer(self.framebuffer, None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// pub struct OwnedFramebuffer {
|
|
||||||
// pub size: Size<u32>,
|
|
||||||
// pub image: OwnedTexture,
|
|
||||||
// pub render_pass: VulkanRenderPass,
|
|
||||||
// pub framebuffer: VulkanFramebuffer,
|
|
||||||
// pub view: vk::ImageView,
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// impl OwnedFramebuffer {
|
|
||||||
// pub fn new(
|
|
||||||
// vulkan: &Vulkan,
|
|
||||||
// size: Size<u32>,
|
|
||||||
// render_pass: VulkanRenderPass,
|
|
||||||
// max_miplevels: u32,
|
|
||||||
// ) -> error::Result<Self> {
|
|
||||||
// let image = OwnedTexture::new(vulkan, size, render_pass.format, max_miplevels)?;
|
|
||||||
// let fb_view = image.create_texture_view()?;
|
|
||||||
// let framebuffer = unsafe {
|
|
||||||
// vulkan.device.create_framebuffer(
|
|
||||||
// &vk::FramebufferCreateInfo::builder()
|
|
||||||
// .render_pass(render_pass.handle)
|
|
||||||
// .attachments(&[image.image_view])
|
|
||||||
// .width(image.image.size.width)
|
|
||||||
// .height(image.image.size.height)
|
|
||||||
// .layers(1)
|
|
||||||
// .build(),
|
|
||||||
// None,
|
|
||||||
// )?
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// Ok(OwnedFramebuffer {
|
|
||||||
// size,
|
|
||||||
// image,
|
|
||||||
// view: fb_view,
|
|
||||||
// render_pass,
|
|
||||||
// framebuffer: VulkanFramebuffer {
|
|
||||||
// device: vulkan.device.clone(),
|
|
||||||
// framebuffer,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(crate) struct OutputFramebuffer {
|
pub(crate) struct OutputFramebuffer {
|
||||||
pub framebuffer: vk::Framebuffer,
|
pub framebuffer: vk::Framebuffer,
|
||||||
|
@ -73,16 +15,6 @@ pub(crate) struct OutputFramebuffer {
|
||||||
image: vk::Image,
|
image: vk::Image,
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// pub struct OutputFramebuffer<'a> {
|
|
||||||
// device: ash::Device,
|
|
||||||
// render_pass: &'a VulkanRenderPass,
|
|
||||||
// pub handle: vk::Framebuffer,
|
|
||||||
// pub size: Size<u32>,
|
|
||||||
// pub image: vk::Image,
|
|
||||||
// pub image_view: vk::ImageView,
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
impl OutputFramebuffer {
|
impl OutputFramebuffer {
|
||||||
pub fn new(vulkan: &Vulkan, render_pass: &VulkanRenderPass, image: vk::Image, size: Size<u32>) -> error::Result<OutputFramebuffer> {
|
pub fn new(vulkan: &Vulkan, render_pass: &VulkanRenderPass, image: vk::Image, size: Size<u32>) -> error::Result<OutputFramebuffer> {
|
||||||
let image_subresource = vk::ImageSubresourceRange::builder()
|
let image_subresource = vk::ImageSubresourceRange::builder()
|
||||||
|
|
|
@ -324,6 +324,7 @@ impl VulkanWindow {
|
||||||
.queue_present(vulkan.base.graphics_queue, &present_info)
|
.queue_present(vulkan.base.graphics_queue, &present_info)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
vulkan.base.device.device_wait_idle().unwrap();
|
||||||
drop(intermediates)
|
drop(intermediates)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl VulkanRenderPass {
|
||||||
.flags(vk::AttachmentDescriptionFlags::empty())
|
.flags(vk::AttachmentDescriptionFlags::empty())
|
||||||
.format(format.into())
|
.format(format.into())
|
||||||
.samples(SampleCountFlags::TYPE_1)
|
.samples(SampleCountFlags::TYPE_1)
|
||||||
.load_op(AttachmentLoadOp::CLEAR)
|
.load_op(AttachmentLoadOp::DONT_CARE)
|
||||||
.store_op(AttachmentStoreOp::STORE)
|
.store_op(AttachmentStoreOp::STORE)
|
||||||
.stencil_load_op(AttachmentLoadOp::DONT_CARE)
|
.stencil_load_op(AttachmentLoadOp::DONT_CARE)
|
||||||
.stencil_store_op(AttachmentStoreOp::DONT_CARE)
|
.stencil_store_op(AttachmentStoreOp::DONT_CARE)
|
||||||
|
|
|
@ -36,6 +36,7 @@ impl OwnedTexture {
|
||||||
.array_layers(1)
|
.array_layers(1)
|
||||||
.samples(SampleCountFlags::TYPE_1)
|
.samples(SampleCountFlags::TYPE_1)
|
||||||
.tiling(ImageTiling::OPTIMAL)
|
.tiling(ImageTiling::OPTIMAL)
|
||||||
|
.flags(vk::ImageCreateFlags::MUTABLE_FORMAT)
|
||||||
.usage(
|
.usage(
|
||||||
ImageUsageFlags::SAMPLED
|
ImageUsageFlags::SAMPLED
|
||||||
| ImageUsageFlags::COLOR_ATTACHMENT
|
| ImageUsageFlags::COLOR_ATTACHMENT
|
||||||
|
@ -129,7 +130,8 @@ impl OwnedTexture {
|
||||||
format
|
format
|
||||||
}, self.max_miplevels)?;
|
}, self.max_miplevels)?;
|
||||||
|
|
||||||
std::mem::swap(self, &mut new)
|
let old = std::mem::replace(self, new);
|
||||||
|
drop(old)
|
||||||
}
|
}
|
||||||
Ok(size)
|
Ok(size)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue