atagen

monolith

public
Star0
Watch0
824bf02b6e554e9c0b86328878fc8eb8caa6926d
1
ssh://brewery@pls.lobotomise.me:33/atagen/monolith.git

Blame: crates/render-vk/src/image.rs

824bf02b6e55atagen2026-10-16 09:15 UTC1
use crate::Error;
824bf02b6e55atagen2026-10-16 09:15 UTC2
use crate::device::Shared;
824bf02b6e55atagen2026-10-16 09:15 UTC3
use crate::format::{components, vk_format};
824bf02b6e55atagen2026-10-16 09:15 UTC4
use ash::vk;
824bf02b6e55atagen2026-10-16 09:15 UTC5
use gpu_allocator::MemoryLocation;
824bf02b6e55atagen2026-10-16 09:15 UTC6
use gpu_allocator::vulkan::{Allocation, AllocationCreateDesc, AllocationScheme};
824bf02b6e55atagen2026-10-16 09:15 UTC7
use smithay::backend::allocator::Fourcc;
824bf02b6e55atagen2026-10-16 09:15 UTC8
use smithay::backend::renderer::{Texture, TextureMapping};
824bf02b6e55atagen2026-10-16 09:15 UTC9
use std::fmt;
824bf02b6e55atagen2026-10-16 09:15 UTC10
use std::sync::{Arc, Mutex};
824bf02b6e55atagen2026-10-16 09:15 UTC11
824bf02b6e55atagen2026-10-16 09:15 UTC12
pub(crate) struct ImageInner {
824bf02b6e55atagen2026-10-16 09:15 UTC13
    pub shared: Arc<Shared>,
824bf02b6e55atagen2026-10-16 09:15 UTC14
    pub image: vk::Image,
824bf02b6e55atagen2026-10-16 09:15 UTC15
    pub view: vk::ImageView,
824bf02b6e55atagen2026-10-16 09:15 UTC16
    pub allocation: Mutex<Option<Allocation>>,
824bf02b6e55atagen2026-10-16 09:15 UTC17
    pub fourcc: Fourcc,
824bf02b6e55atagen2026-10-16 09:15 UTC18
    pub format: vk::Format,
824bf02b6e55atagen2026-10-16 09:15 UTC19
    pub width: u32,
824bf02b6e55atagen2026-10-16 09:15 UTC20
    pub height: u32,
824bf02b6e55atagen2026-10-16 09:15 UTC21
    pub layout: Mutex<vk::ImageLayout>,
824bf02b6e55atagen2026-10-16 09:15 UTC22
}
824bf02b6e55atagen2026-10-16 09:15 UTC23
824bf02b6e55atagen2026-10-16 09:15 UTC24
impl fmt::Debug for ImageInner {
824bf02b6e55atagen2026-10-16 09:15 UTC25
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
824bf02b6e55atagen2026-10-16 09:15 UTC26
        f.debug_struct("ImageInner")
824bf02b6e55atagen2026-10-16 09:15 UTC27
            .field("image", &self.image)
824bf02b6e55atagen2026-10-16 09:15 UTC28
            .field("fourcc", &self.fourcc)
824bf02b6e55atagen2026-10-16 09:15 UTC29
            .field("size", &(self.width, self.height))
824bf02b6e55atagen2026-10-16 09:15 UTC30
            .finish()
824bf02b6e55atagen2026-10-16 09:15 UTC31
    }
824bf02b6e55atagen2026-10-16 09:15 UTC32
}
824bf02b6e55atagen2026-10-16 09:15 UTC33
824bf02b6e55atagen2026-10-16 09:15 UTC34
impl Drop for ImageInner {
824bf02b6e55atagen2026-10-16 09:15 UTC35
    fn drop(&mut self) {
824bf02b6e55atagen2026-10-16 09:15 UTC36
        let d = &self.shared.device.device;
824bf02b6e55atagen2026-10-16 09:15 UTC37
        unsafe {
824bf02b6e55atagen2026-10-16 09:15 UTC38
            d.destroy_image_view(self.view, None);
824bf02b6e55atagen2026-10-16 09:15 UTC39
            d.destroy_image(self.image, None);
824bf02b6e55atagen2026-10-16 09:15 UTC40
        }
824bf02b6e55atagen2026-10-16 09:15 UTC41
        if let Some(a) = self
824bf02b6e55atagen2026-10-16 09:15 UTC42
            .allocation
824bf02b6e55atagen2026-10-16 09:15 UTC43
            .lock()
824bf02b6e55atagen2026-10-16 09:15 UTC44
            .unwrap_or_else(|e| e.into_inner())
824bf02b6e55atagen2026-10-16 09:15 UTC45
            .take()
824bf02b6e55atagen2026-10-16 09:15 UTC46
        {
824bf02b6e55atagen2026-10-16 09:15 UTC47
            let _ = self
824bf02b6e55atagen2026-10-16 09:15 UTC48
                .shared
824bf02b6e55atagen2026-10-16 09:15 UTC49
                .allocator
824bf02b6e55atagen2026-10-16 09:15 UTC50
                .lock()
824bf02b6e55atagen2026-10-16 09:15 UTC51
                .unwrap_or_else(|e| e.into_inner())
824bf02b6e55atagen2026-10-16 09:15 UTC52
                .free(a);
824bf02b6e55atagen2026-10-16 09:15 UTC53
        }
824bf02b6e55atagen2026-10-16 09:15 UTC54
    }
824bf02b6e55atagen2026-10-16 09:15 UTC55
}
824bf02b6e55atagen2026-10-16 09:15 UTC56
824bf02b6e55atagen2026-10-16 09:15 UTC57
impl ImageInner {
824bf02b6e55atagen2026-10-16 09:15 UTC58
    pub fn create(
824bf02b6e55atagen2026-10-16 09:15 UTC59
        shared: &Arc<Shared>,
824bf02b6e55atagen2026-10-16 09:15 UTC60
        fourcc: Fourcc,
824bf02b6e55atagen2026-10-16 09:15 UTC61
        width: u32,
824bf02b6e55atagen2026-10-16 09:15 UTC62
        height: u32,
824bf02b6e55atagen2026-10-16 09:15 UTC63
        usage: vk::ImageUsageFlags,
824bf02b6e55atagen2026-10-16 09:15 UTC64
    ) -> Result<Arc<Self>, Error> {
824bf02b6e55atagen2026-10-16 09:15 UTC65
        let fmt = vk_format(fourcc).ok_or(Error::UnsupportedFormat(fourcc))?;
824bf02b6e55atagen2026-10-16 09:15 UTC66
        if width == 0 || height == 0 {
824bf02b6e55atagen2026-10-16 09:15 UTC67
            return Err(Error::InvalidSize(width as i32, height as i32));
824bf02b6e55atagen2026-10-16 09:15 UTC68
        }
824bf02b6e55atagen2026-10-16 09:15 UTC69
        let d = &shared.device.device;
824bf02b6e55atagen2026-10-16 09:15 UTC70
        let info = vk::ImageCreateInfo::default()
824bf02b6e55atagen2026-10-16 09:15 UTC71
            .image_type(vk::ImageType::TYPE_2D)
824bf02b6e55atagen2026-10-16 09:15 UTC72
            .format(fmt.format)
824bf02b6e55atagen2026-10-16 09:15 UTC73
            .extent(vk::Extent3D {
824bf02b6e55atagen2026-10-16 09:15 UTC74
                width,
824bf02b6e55atagen2026-10-16 09:15 UTC75
                height,
824bf02b6e55atagen2026-10-16 09:15 UTC76
                depth: 1,
824bf02b6e55atagen2026-10-16 09:15 UTC77
            })
824bf02b6e55atagen2026-10-16 09:15 UTC78
            .mip_levels(1)
824bf02b6e55atagen2026-10-16 09:15 UTC79
            .array_layers(1)
824bf02b6e55atagen2026-10-16 09:15 UTC80
            .samples(vk::SampleCountFlags::TYPE_1)
824bf02b6e55atagen2026-10-16 09:15 UTC81
            .tiling(vk::ImageTiling::OPTIMAL)
824bf02b6e55atagen2026-10-16 09:15 UTC82
            .usage(usage)
824bf02b6e55atagen2026-10-16 09:15 UTC83
            .initial_layout(vk::ImageLayout::UNDEFINED);
824bf02b6e55atagen2026-10-16 09:15 UTC84
        let image = unsafe { d.create_image(&info, None)? };
824bf02b6e55atagen2026-10-16 09:15 UTC85
        let requirements = unsafe { d.get_image_memory_requirements(image) };
824bf02b6e55atagen2026-10-16 09:15 UTC86
        let allocation = shared
824bf02b6e55atagen2026-10-16 09:15 UTC87
            .allocator
824bf02b6e55atagen2026-10-16 09:15 UTC88
            .lock()
824bf02b6e55atagen2026-10-16 09:15 UTC89
            .unwrap_or_else(|e| e.into_inner())
824bf02b6e55atagen2026-10-16 09:15 UTC90
            .allocate(&AllocationCreateDesc {
824bf02b6e55atagen2026-10-16 09:15 UTC91
                name: "image",
824bf02b6e55atagen2026-10-16 09:15 UTC92
                requirements,
824bf02b6e55atagen2026-10-16 09:15 UTC93
                location: MemoryLocation::GpuOnly,
824bf02b6e55atagen2026-10-16 09:15 UTC94
                linear: false,
824bf02b6e55atagen2026-10-16 09:15 UTC95
                allocation_scheme: AllocationScheme::GpuAllocatorManaged,
824bf02b6e55atagen2026-10-16 09:15 UTC96
            });
824bf02b6e55atagen2026-10-16 09:15 UTC97
        let allocation = match allocation {
824bf02b6e55atagen2026-10-16 09:15 UTC98
            Ok(a) => a,
824bf02b6e55atagen2026-10-16 09:15 UTC99
            Err(e) => {
824bf02b6e55atagen2026-10-16 09:15 UTC100
                unsafe { d.destroy_image(image, None) };
824bf02b6e55atagen2026-10-16 09:15 UTC101
                return Err(e.into());
824bf02b6e55atagen2026-10-16 09:15 UTC102
            }
824bf02b6e55atagen2026-10-16 09:15 UTC103
        };
824bf02b6e55atagen2026-10-16 09:15 UTC104
        unsafe { d.bind_image_memory(image, allocation.memory(), allocation.offset())? };
824bf02b6e55atagen2026-10-16 09:15 UTC105
        let view_info = vk::ImageViewCreateInfo::default()
824bf02b6e55atagen2026-10-16 09:15 UTC106
            .image(image)
824bf02b6e55atagen2026-10-16 09:15 UTC107
            .view_type(vk::ImageViewType::TYPE_2D)
824bf02b6e55atagen2026-10-16 09:15 UTC108
            .format(fmt.format)
824bf02b6e55atagen2026-10-16 09:15 UTC109
            .components(components(fmt.opaque))
824bf02b6e55atagen2026-10-16 09:15 UTC110
            .subresource_range(color_range());
824bf02b6e55atagen2026-10-16 09:15 UTC111
        let view = unsafe { d.create_image_view(&view_info, None)? };
824bf02b6e55atagen2026-10-16 09:15 UTC112
        Ok(Arc::new(Self {
824bf02b6e55atagen2026-10-16 09:15 UTC113
            shared: shared.clone(),
824bf02b6e55atagen2026-10-16 09:15 UTC114
            image,
824bf02b6e55atagen2026-10-16 09:15 UTC115
            view,
824bf02b6e55atagen2026-10-16 09:15 UTC116
            allocation: Mutex::new(Some(allocation)),
824bf02b6e55atagen2026-10-16 09:15 UTC117
            fourcc,
824bf02b6e55atagen2026-10-16 09:15 UTC118
            format: fmt.format,
824bf02b6e55atagen2026-10-16 09:15 UTC119
            width,
824bf02b6e55atagen2026-10-16 09:15 UTC120
            height,
824bf02b6e55atagen2026-10-16 09:15 UTC121
            layout: Mutex::new(vk::ImageLayout::UNDEFINED),
824bf02b6e55atagen2026-10-16 09:15 UTC122
        }))
824bf02b6e55atagen2026-10-16 09:15 UTC123
    }
824bf02b6e55atagen2026-10-16 09:15 UTC124
824bf02b6e55atagen2026-10-16 09:15 UTC125
    pub fn layout(&self) -> vk::ImageLayout {
824bf02b6e55atagen2026-10-16 09:15 UTC126
        *self.layout.lock().unwrap_or_else(|e| e.into_inner())
824bf02b6e55atagen2026-10-16 09:15 UTC127
    }
824bf02b6e55atagen2026-10-16 09:15 UTC128
824bf02b6e55atagen2026-10-16 09:15 UTC129
    pub fn set_layout(&self, layout: vk::ImageLayout) {
824bf02b6e55atagen2026-10-16 09:15 UTC130
        *self.layout.lock().unwrap_or_else(|e| e.into_inner()) = layout;
824bf02b6e55atagen2026-10-16 09:15 UTC131
    }
824bf02b6e55atagen2026-10-16 09:15 UTC132
}
824bf02b6e55atagen2026-10-16 09:15 UTC133
824bf02b6e55atagen2026-10-16 09:15 UTC134
pub(crate) fn color_range() -> vk::ImageSubresourceRange {
824bf02b6e55atagen2026-10-16 09:15 UTC135
    vk::ImageSubresourceRange::default()
824bf02b6e55atagen2026-10-16 09:15 UTC136
        .aspect_mask(vk::ImageAspectFlags::COLOR)
824bf02b6e55atagen2026-10-16 09:15 UTC137
        .level_count(1)
824bf02b6e55atagen2026-10-16 09:15 UTC138
        .layer_count(1)
824bf02b6e55atagen2026-10-16 09:15 UTC139
}
824bf02b6e55atagen2026-10-16 09:15 UTC140
824bf02b6e55atagen2026-10-16 09:15 UTC141
/// A host-visible buffer for uploads and readbacks.
824bf02b6e55atagen2026-10-16 09:15 UTC142
pub(crate) struct Staging {
824bf02b6e55atagen2026-10-16 09:15 UTC143
    pub shared: Arc<Shared>,
824bf02b6e55atagen2026-10-16 09:15 UTC144
    pub buffer: vk::Buffer,
824bf02b6e55atagen2026-10-16 09:15 UTC145
    pub allocation: Option<Allocation>,
824bf02b6e55atagen2026-10-16 09:15 UTC146
}
824bf02b6e55atagen2026-10-16 09:15 UTC147
824bf02b6e55atagen2026-10-16 09:15 UTC148
impl Staging {
824bf02b6e55atagen2026-10-16 09:15 UTC149
    pub fn new(
824bf02b6e55atagen2026-10-16 09:15 UTC150
        shared: &Arc<Shared>,
824bf02b6e55atagen2026-10-16 09:15 UTC151
        size: usize,
824bf02b6e55atagen2026-10-16 09:15 UTC152
        usage: vk::BufferUsageFlags,
824bf02b6e55atagen2026-10-16 09:15 UTC153
        location: MemoryLocation,
824bf02b6e55atagen2026-10-16 09:15 UTC154
    ) -> Result<Self, Error> {
824bf02b6e55atagen2026-10-16 09:15 UTC155
        let d = &shared.device.device;
824bf02b6e55atagen2026-10-16 09:15 UTC156
        let buffer = unsafe {
824bf02b6e55atagen2026-10-16 09:15 UTC157
            d.create_buffer(
824bf02b6e55atagen2026-10-16 09:15 UTC158
                &vk::BufferCreateInfo::default()
824bf02b6e55atagen2026-10-16 09:15 UTC159
                    .size(size as u64)
824bf02b6e55atagen2026-10-16 09:15 UTC160
                    .usage(usage),
824bf02b6e55atagen2026-10-16 09:15 UTC161
                None,
824bf02b6e55atagen2026-10-16 09:15 UTC162
            )?
824bf02b6e55atagen2026-10-16 09:15 UTC163
        };
824bf02b6e55atagen2026-10-16 09:15 UTC164
        let requirements = unsafe { d.get_buffer_memory_requirements(buffer) };
824bf02b6e55atagen2026-10-16 09:15 UTC165
        let allocation = shared
824bf02b6e55atagen2026-10-16 09:15 UTC166
            .allocator
824bf02b6e55atagen2026-10-16 09:15 UTC167
            .lock()
824bf02b6e55atagen2026-10-16 09:15 UTC168
            .unwrap_or_else(|e| e.into_inner())
824bf02b6e55atagen2026-10-16 09:15 UTC169
            .allocate(&AllocationCreateDesc {
824bf02b6e55atagen2026-10-16 09:15 UTC170
                name: "staging",
824bf02b6e55atagen2026-10-16 09:15 UTC171
                requirements,
824bf02b6e55atagen2026-10-16 09:15 UTC172
                location,
824bf02b6e55atagen2026-10-16 09:15 UTC173
                linear: true,
824bf02b6e55atagen2026-10-16 09:15 UTC174
                allocation_scheme: AllocationScheme::GpuAllocatorManaged,
824bf02b6e55atagen2026-10-16 09:15 UTC175
            });
824bf02b6e55atagen2026-10-16 09:15 UTC176
        let allocation = match allocation {
824bf02b6e55atagen2026-10-16 09:15 UTC177
            Ok(a) => a,
824bf02b6e55atagen2026-10-16 09:15 UTC178
            Err(e) => {
824bf02b6e55atagen2026-10-16 09:15 UTC179
                unsafe { d.destroy_buffer(buffer, None) };
824bf02b6e55atagen2026-10-16 09:15 UTC180
                return Err(e.into());
824bf02b6e55atagen2026-10-16 09:15 UTC181
            }
824bf02b6e55atagen2026-10-16 09:15 UTC182
        };
824bf02b6e55atagen2026-10-16 09:15 UTC183
        unsafe { d.bind_buffer_memory(buffer, allocation.memory(), allocation.offset())? };
824bf02b6e55atagen2026-10-16 09:15 UTC184
        Ok(Self {
824bf02b6e55atagen2026-10-16 09:15 UTC185
            shared: shared.clone(),
824bf02b6e55atagen2026-10-16 09:15 UTC186
            buffer,
824bf02b6e55atagen2026-10-16 09:15 UTC187
            allocation: Some(allocation),
824bf02b6e55atagen2026-10-16 09:15 UTC188
        })
824bf02b6e55atagen2026-10-16 09:15 UTC189
    }
824bf02b6e55atagen2026-10-16 09:15 UTC190
824bf02b6e55atagen2026-10-16 09:15 UTC191
    pub fn bytes(&self) -> &[u8] {
824bf02b6e55atagen2026-10-16 09:15 UTC192
        self.allocation
824bf02b6e55atagen2026-10-16 09:15 UTC193
            .as_ref()
824bf02b6e55atagen2026-10-16 09:15 UTC194
            .and_then(|a| a.mapped_slice())
824bf02b6e55atagen2026-10-16 09:15 UTC195
            .unwrap_or(&[])
824bf02b6e55atagen2026-10-16 09:15 UTC196
    }
824bf02b6e55atagen2026-10-16 09:15 UTC197
824bf02b6e55atagen2026-10-16 09:15 UTC198
    pub fn bytes_mut(&mut self) -> &mut [u8] {
824bf02b6e55atagen2026-10-16 09:15 UTC199
        self.allocation
824bf02b6e55atagen2026-10-16 09:15 UTC200
            .as_mut()
824bf02b6e55atagen2026-10-16 09:15 UTC201
            .and_then(|a| a.mapped_slice_mut())
824bf02b6e55atagen2026-10-16 09:15 UTC202
            .unwrap_or(&mut [])
824bf02b6e55atagen2026-10-16 09:15 UTC203
    }
824bf02b6e55atagen2026-10-16 09:15 UTC204
}
824bf02b6e55atagen2026-10-16 09:15 UTC205
824bf02b6e55atagen2026-10-16 09:15 UTC206
impl Drop for Staging {
824bf02b6e55atagen2026-10-16 09:15 UTC207
    fn drop(&mut self) {
824bf02b6e55atagen2026-10-16 09:15 UTC208
        unsafe { self.shared.device.device.destroy_buffer(self.buffer, None) };
824bf02b6e55atagen2026-10-16 09:15 UTC209
        if let Some(a) = self.allocation.take() {
824bf02b6e55atagen2026-10-16 09:15 UTC210
            let _ = self
824bf02b6e55atagen2026-10-16 09:15 UTC211
                .shared
824bf02b6e55atagen2026-10-16 09:15 UTC212
                .allocator
824bf02b6e55atagen2026-10-16 09:15 UTC213
                .lock()
824bf02b6e55atagen2026-10-16 09:15 UTC214
                .unwrap_or_else(|e| e.into_inner())
824bf02b6e55atagen2026-10-16 09:15 UTC215
                .free(a);
824bf02b6e55atagen2026-10-16 09:15 UTC216
        }
824bf02b6e55atagen2026-10-16 09:15 UTC217
    }
824bf02b6e55atagen2026-10-16 09:15 UTC218
}
824bf02b6e55atagen2026-10-16 09:15 UTC219
824bf02b6e55atagen2026-10-16 09:15 UTC220
/// A sampled texture.
824bf02b6e55atagen2026-10-16 09:15 UTC221
#[derive(Clone, Debug)]
824bf02b6e55atagen2026-10-16 09:15 UTC222
pub struct VulkanTexture(pub(crate) Arc<ImageInner>);
824bf02b6e55atagen2026-10-16 09:15 UTC223
824bf02b6e55atagen2026-10-16 09:15 UTC224
/// An image the renderer can draw into, from [`smithay::backend::renderer::Offscreen`].
824bf02b6e55atagen2026-10-16 09:15 UTC225
#[derive(Debug)]
824bf02b6e55atagen2026-10-16 09:15 UTC226
pub struct VulkanImage(pub(crate) Arc<ImageInner>);
824bf02b6e55atagen2026-10-16 09:15 UTC227
824bf02b6e55atagen2026-10-16 09:15 UTC228
impl VulkanImage {
824bf02b6e55atagen2026-10-16 09:15 UTC229
    /// The image's contents as a texture, for drawing it elsewhere.
824bf02b6e55atagen2026-10-16 09:15 UTC230
    pub fn texture(&self) -> VulkanTexture {
824bf02b6e55atagen2026-10-16 09:15 UTC231
        VulkanTexture(self.0.clone())
824bf02b6e55atagen2026-10-16 09:15 UTC232
    }
824bf02b6e55atagen2026-10-16 09:15 UTC233
}
824bf02b6e55atagen2026-10-16 09:15 UTC234
824bf02b6e55atagen2026-10-16 09:15 UTC235
/// A bound render target.
824bf02b6e55atagen2026-10-16 09:15 UTC236
#[derive(Debug)]
824bf02b6e55atagen2026-10-16 09:15 UTC237
pub struct VulkanTarget<'a>(pub(crate) &'a mut VulkanImage);
824bf02b6e55atagen2026-10-16 09:15 UTC238
824bf02b6e55atagen2026-10-16 09:15 UTC239
/// Pixels read back from the GPU.
824bf02b6e55atagen2026-10-16 09:15 UTC240
#[derive(Debug)]
824bf02b6e55atagen2026-10-16 09:15 UTC241
pub struct VulkanMapping {
824bf02b6e55atagen2026-10-16 09:15 UTC242
    pub(crate) data: Vec<u8>,
824bf02b6e55atagen2026-10-16 09:15 UTC243
    pub(crate) width: u32,
824bf02b6e55atagen2026-10-16 09:15 UTC244
    pub(crate) height: u32,
824bf02b6e55atagen2026-10-16 09:15 UTC245
    pub(crate) fourcc: Fourcc,
824bf02b6e55atagen2026-10-16 09:15 UTC246
}
824bf02b6e55atagen2026-10-16 09:15 UTC247
824bf02b6e55atagen2026-10-16 09:15 UTC248
macro_rules! texture_impl {
824bf02b6e55atagen2026-10-16 09:15 UTC249
    ($t:ty, |$s:ident| $inner:expr) => {
824bf02b6e55atagen2026-10-16 09:15 UTC250
        impl Texture for $t {
824bf02b6e55atagen2026-10-16 09:15 UTC251
            fn width(&self) -> u32 {
824bf02b6e55atagen2026-10-16 09:15 UTC252
                let $s = self;
824bf02b6e55atagen2026-10-16 09:15 UTC253
                $inner.width
824bf02b6e55atagen2026-10-16 09:15 UTC254
            }
824bf02b6e55atagen2026-10-16 09:15 UTC255
            fn height(&self) -> u32 {
824bf02b6e55atagen2026-10-16 09:15 UTC256
                let $s = self;
824bf02b6e55atagen2026-10-16 09:15 UTC257
                $inner.height
824bf02b6e55atagen2026-10-16 09:15 UTC258
            }
824bf02b6e55atagen2026-10-16 09:15 UTC259
            fn format(&self) -> Option<Fourcc> {
824bf02b6e55atagen2026-10-16 09:15 UTC260
                let $s = self;
824bf02b6e55atagen2026-10-16 09:15 UTC261
                Some($inner.fourcc)
824bf02b6e55atagen2026-10-16 09:15 UTC262
            }
824bf02b6e55atagen2026-10-16 09:15 UTC263
        }
824bf02b6e55atagen2026-10-16 09:15 UTC264
    };
824bf02b6e55atagen2026-10-16 09:15 UTC265
}
824bf02b6e55atagen2026-10-16 09:15 UTC266
824bf02b6e55atagen2026-10-16 09:15 UTC267
texture_impl!(VulkanTexture, |s| s.0);
824bf02b6e55atagen2026-10-16 09:15 UTC268
texture_impl!(VulkanImage, |s| s.0);
824bf02b6e55atagen2026-10-16 09:15 UTC269
texture_impl!(VulkanTarget<'_>, |s| s.0.0);
824bf02b6e55atagen2026-10-16 09:15 UTC270
texture_impl!(VulkanMapping, |s| s);
824bf02b6e55atagen2026-10-16 09:15 UTC271
824bf02b6e55atagen2026-10-16 09:15 UTC272
impl TextureMapping for VulkanMapping {
824bf02b6e55atagen2026-10-16 09:15 UTC273
    fn flipped(&self) -> bool {
824bf02b6e55atagen2026-10-16 09:15 UTC274
        false
824bf02b6e55atagen2026-10-16 09:15 UTC275
    }
824bf02b6e55atagen2026-10-16 09:15 UTC276
}