use crate::core::{Buffer as CoreBuffer, Device, Image as CoreImage};
use ash::vk;
use std::sync::Arc;
pub struct EzBuffer {
device: Arc<Device>,
buffer: CoreBuffer,
}
impl EzBuffer {
pub(crate) fn new(device: Arc<Device>, buffer: CoreBuffer) -> Self {
Self { device, buffer }
}
#[inline]
pub fn handle(&self) -> vk::Buffer {
self.buffer.handle()
}
#[inline]
pub fn size(&self) -> vk::DeviceSize {
self.buffer.size()
}
#[inline]
pub fn usage(&self) -> vk::BufferUsageFlags {
self.buffer.usage()
}
#[inline]
pub fn core_buffer(&self) -> &CoreBuffer {
&self.buffer
}
}
impl Drop for EzBuffer {
fn drop(&mut self) {
self.buffer.destroy(&self.device);
}
}
pub struct EzImage {
device: Arc<Device>,
image: CoreImage,
}
impl EzImage {
pub(crate) fn new(device: Arc<Device>, image: CoreImage) -> Self {
Self { device, image }
}
#[inline]
pub fn handle(&self) -> vk::Image {
self.image.handle()
}
#[inline]
pub fn view(&self) -> vk::ImageView {
self.image.view()
}
#[inline]
pub fn extent(&self) -> vk::Extent3D {
self.image.extent()
}
#[inline]
pub fn format(&self) -> vk::Format {
self.image.format()
}
#[inline]
pub fn usage(&self) -> vk::ImageUsageFlags {
self.image.usage()
}
#[inline]
pub fn core_image(&self) -> &CoreImage {
&self.image
}
}
impl Drop for EzImage {
fn drop(&mut self) {
self.image.destroy(&self.device);
}
}