use crate::engine::Engine;
use crate::prelude::renderer_types::TextureResource;
use crate::prelude::wgpu::{self, RenderPass};
use wgpu::TextureFormat;

pub trait Shader {
    /// The key of the shader, used to identify the shader.
    fn key(&self) -> &'static str;
    /// Create a new pipeline
    fn new_pipeline(
        &self,
        format: TextureFormat,
        depth_format: Option<TextureFormat>,
        camera_buffer: &wgpu::Buffer,
        transparent: bool,
    ) -> Box<dyn SpritePipeline>;
}

pub trait SpritePipeline {
    /// Render
    fn render(
        &self,
        pass: &mut RenderPass,
        texture: Option<&TextureResource>,
        shader_data: Option<&[u8]>,
    );
}

pub trait PostShader {
    fn resize(&self, g: &Engine);
    fn draw(&self, texture: &TextureResource, pass: &mut RenderPass);
    fn frame_pass(&self, g: &Engine, pass: &mut RenderPass);
    fn frame_end(&self, pass: &mut RenderPass);
}
