vk: fix some bugs in the format

This commit is contained in:
chyyran 2023-01-10 22:22:42 -05:00
parent 18a96d5e5e
commit 9dd656d49f
5 changed files with 10 additions and 70 deletions

View file

@ -105,6 +105,11 @@ impl FilterPass {
let render_pass_info = vk::RenderPassBeginInfo::builder()
.framebuffer(output.output.framebuffer)
.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 {
offset: Default::default(),
extent: output.output.size.into(),

View file

@ -6,64 +6,6 @@ use ash::vk;
use ash::vk::{ImageAspectFlags, ImageViewType};
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)]
pub(crate) struct OutputFramebuffer {
pub framebuffer: vk::Framebuffer,
@ -73,16 +15,6 @@ pub(crate) struct OutputFramebuffer {
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 {
pub fn new(vulkan: &Vulkan, render_pass: &VulkanRenderPass, image: vk::Image, size: Size<u32>) -> error::Result<OutputFramebuffer> {
let image_subresource = vk::ImageSubresourceRange::builder()

View file

@ -324,6 +324,7 @@ impl VulkanWindow {
.queue_present(vulkan.base.graphics_queue, &present_info)
.unwrap();
vulkan.base.device.device_wait_idle().unwrap();
drop(intermediates)
}
}

View file

@ -24,7 +24,7 @@ impl VulkanRenderPass {
.flags(vk::AttachmentDescriptionFlags::empty())
.format(format.into())
.samples(SampleCountFlags::TYPE_1)
.load_op(AttachmentLoadOp::CLEAR)
.load_op(AttachmentLoadOp::DONT_CARE)
.store_op(AttachmentStoreOp::STORE)
.stencil_load_op(AttachmentLoadOp::DONT_CARE)
.stencil_store_op(AttachmentStoreOp::DONT_CARE)

View file

@ -36,6 +36,7 @@ impl OwnedTexture {
.array_layers(1)
.samples(SampleCountFlags::TYPE_1)
.tiling(ImageTiling::OPTIMAL)
.flags(vk::ImageCreateFlags::MUTABLE_FORMAT)
.usage(
ImageUsageFlags::SAMPLED
| ImageUsageFlags::COLOR_ATTACHMENT
@ -129,7 +130,8 @@ impl OwnedTexture {
format
}, self.max_miplevels)?;
std::mem::swap(self, &mut new)
let old = std::mem::replace(self, new);
drop(old)
}
Ok(size)
}