memkit-gpu 0.2.0-beta.1

Backend-agnostic GPU memory management for memkit
//! GPU memory types.

/// GPU memory type classification.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MkMemoryType {
    /// Device-local memory (fastest for GPU, not CPU-accessible).
    DeviceLocal,
    
    /// Host-visible memory (CPU can read/write, slower for GPU).
    HostVisible,
    
    /// Host-cached memory (CPU-cached, good for readback).
    HostCached,
    
    /// Unified memory (shared between CPU and GPU, if available).
    Unified,
}

impl Default for MkMemoryType {
    fn default() -> Self {
        Self::DeviceLocal
    }
}

impl MkMemoryType {
    /// Check if this memory type is CPU-accessible.
    pub fn is_host_accessible(&self) -> bool {
        matches!(self, Self::HostVisible | Self::HostCached | Self::Unified)
    }
    
    /// Check if this memory type is device-local.
    pub fn is_device_local(&self) -> bool {
        matches!(self, Self::DeviceLocal | Self::Unified)
    }
}