crystal-vk 0.0.4

Graphics wrapper for Vulkan
Documentation
pub mod compute;
pub mod graphics;

use graphics::*;

use std::sync::Arc;

use ash::vk;

use crate::{
    pipeline::{descriptor::layout::PipelineLayout, shader::Shader},
    render::RenderTarget,
    traits::CommandBufferBinding,
};

pub mod attribute;
pub mod descriptor;
pub mod shader;

pub enum PipelineInfo {
    Graphics(GraphicsPipelineInfo),
    None,
}

pub struct Pipeline {
    pub(crate) handle: vk::Pipeline,
    pub pipeline_layout: Arc<PipelineLayout>,
    pub bind_point: vk::PipelineBindPoint,
    pub(crate) _info: PipelineInfo,
    _shaders: Vec<Arc<Shader>>,
    _render_target: Option<Arc<RenderTarget>>,
}

unsafe impl Send for Pipeline {}
unsafe impl Sync for Pipeline {}
impl CommandBufferBinding for Pipeline {}

impl Drop for Pipeline {
    fn drop(&mut self) {
        unsafe {
            self.pipeline_layout
                .device
                .handle
                .destroy_pipeline(self.handle, None);
        }
    }
}