//! Pipeline + MtlRenderPipeline

use crate::ffi::*;

/// A compiled compute pipeline state. Wraps `id<MTLComputePipelineState>`.
pub struct Pipeline {
    raw: ObjcId,
}

impl Pipeline {
    pub(crate) fn from_raw(raw: ObjcId) -> Self {
        Pipeline { raw }
    }

    /// Maximum total threads per threadgroup for this pipeline.
    pub fn max_total_threads_per_threadgroup(&self) -> usize {
        unsafe { msg0_usize(self.raw, SEL_maxTotalThreadsPerThreadgroup()) }
    }

    /// Thread execution width (SIMD width).
    pub fn thread_execution_width(&self) -> usize {
        unsafe { msg0_usize(self.raw, SEL_threadExecutionWidth()) }
    }

    /// Static threadgroup memory length used by this pipeline (bytes).
    #[mutants::skip] // 0 is correct for most shaders โ€” mutant โ†’ 0 passes
    pub fn static_threadgroup_memory_length(&self) -> usize {
        unsafe { msg0_usize(self.raw, SEL_staticThreadgroupMemoryLength()) }
    }

    pub fn as_raw(&self) -> ObjcId {
        self.raw
    }
}

impl Drop for Pipeline {
    #[mutants::skip] // RAII release โ€” tested by drop_stress_leak
    fn drop(&mut self) {
        unsafe { release(self.raw) };
    }
}

Homonyms

soft3/glia/import/pipeline.rs
neural/trident/src/api/pipeline.rs
cyb/honeycrisp/aruminium/src/pipeline.rs
cyb/honeycrisp/unimem/examples/pipeline.rs
cyb/honeycrisp/aruminium/src/render/pipeline.rs
neural/trident/benches/references/std/compiler/pipeline.rs
cyb/evy/forks/bevy_post_process/src/motion_blur/pipeline.rs
cyb/evy/forks/bevy_render/src/render_resource/pipeline.rs
cyb/evy/forks/bevy_post_process/src/auto_exposure/pipeline.rs
cyb/honeycrisp/.claude/worktrees/agent-ad6c77c38e86bc291/aruminium/src/pipeline.rs
cyb/honeycrisp/.claude/worktrees/agent-ad6c77c38e86bc291/unimem/examples/pipeline.rs
cyb/honeycrisp/.claude/worktrees/agent-aa1259cb10112b22a/unimem/examples/pipeline.rs
cyb/honeycrisp/.claude/worktrees/agent-aa1259cb10112b22a/aruminium/src/render/pipeline.rs
cyb/honeycrisp/.claude/worktrees/agent-ad6c77c38e86bc291/aruminium/src/render/pipeline.rs

Graph