unsafe fn make_pipeline<B: gfx_hal::Backend>(
    device: &B::Device,
    render_pass: &B::RenderPass,
    pipeline_layout: &B::PipelineLayout,
    vertex_shader: &str,
    fragment_shader: &str,
) -> B::GraphicsPipeline {
    let vertex_shader_module = device
        .create_shader_module(&compile_shader(vertex_shader, ShaderKind::Vertex))
        .expect("Failed to create vertex shader module");

    let fragment_shader_module = device
        .create_shader_module(&compile_shader(fragment_shader, ShaderKind::Fragment))
        .expect("Failed to create fragment shader module");

    let (vs_entry, fs_entry) = (
        EntryPoint {
            entry: "main",
            module: &vertex_shader_module,
            specialization: Specialization::default(),
        },
        EntryPoint {
            entry: "main",
            module: &fragment_shader_module,
            specialization: Specialization::default(),
        },
    );
    let primitive_assembler = PrimitiveAssemblerDesc::Vertex {
        buffers: &[],
        attributes: &[],
        input_assembler: InputAssemblerDesc::new(Primitive::TriangleStrip),
        vertex: vs_entry,
        tessellation: None,
        geometry: None,
    };
    let mut pipeline_desc = GraphicsPipelineDesc::new(
        primitive_assembler,
        Rasterizer {
            cull_face: Face::BACK,
            ..Rasterizer::FILL
        },
        Some(fs_entry),
        pipeline_layout,
        Subpass {
            index: 0,
            main_pass: render_pass,
        },
    );

    pipeline_desc.blender.targets.push(ColorBlendDesc {
        mask: ColorMask::ALL,
        blend: Some(BlendState::ALPHA),
    });
    let pipeline = device
        .create_graphics_pipeline(&pipeline_desc, None)
        .expect("Failed to create graphics pipeline");

    device.destroy_shader_module(vertex_shader_module);
    device.destroy_shader_module(fragment_shader_module);

    pipeline
}
/// Create a pipeline with the given layout and shaders.
///
/// A pipeline contains nearly all the required information for rendering,
/// and is only usable within the render pass it's defined for.
Create a pipeline with the given layout and shaders.
A pipeline contains nearly all the required information for rendering,
and is only usable within the render pass it's defined for.
Create a pipeline with the given layout and shaders . A pipeline contains nearly all the required information for rendering and is only usable within the render pass it ' s defined for .
unsafe fn make_pipeline<B: gfx_hal::Backend>(
    device: &B::Device,
    render_pass: &B::RenderPass,
    pipeline_layout: &B::PipelineLayout,
    vertex_shader: &str,
    fragment_shader: &str,
) -> B::GraphicsPipeline {
    let vertex_shader_module = device
        .create_shader_module(&compile_shader(vertex_shader, ShaderKind::Vertex))
        .expect("Failed to create vertex shader module");
    let fragment_shader_module = device
        .create_shader_module(&compile_shader(fragment_shader, ShaderKind::Fragment))
        .expect("Failed to create fragment shader module");
    let (vs_entry, fs_entry) = (
        EntryPoint {
            entry: "main",
            module: &vertex_shader_module,
            specialization: Specialization::default(),
        },
        EntryPoint {
            entry: "main",
            module: &fragment_shader_module,
            specialization: Specialization::default(),
        },
    );
    let primitive_assembler = PrimitiveAssemblerDesc::Vertex {
        buffers: &[],
        attributes: &[],
        input_assembler: InputAssemblerDesc::new(Primitive::TriangleStrip),
        vertex: vs_entry,
        tessellation: None,
        geometry: None,
    };
    let mut pipeline_desc = GraphicsPipelineDesc::new(
        primitive_assembler,
        Rasterizer {
            cull_face: Face::BACK,
            ..Rasterizer::FILL
        },
        Some(fs_entry),
        pipeline_layout,
        Subpass {
            index: 0,
            main_pass: render_pass,
        },
    );
    pipeline_desc.blender.targets.push(ColorBlendDesc {
        mask: ColorMask::ALL,
        blend: Some(BlendState::ALPHA),
    });
    let pipeline = device
        .create_graphics_pipeline(&pipeline_desc, None)
        .expect("Failed to create graphics pipeline");
    device.destroy_shader_module(vertex_shader_module);
    device.destroy_shader_module(fragment_shader_module);
    pipeline
}
unsafe fn make_pipeline < B : gfx_hal :: Backend > ( device : & B :: Device , render_pass : & B :: RenderPass , pipeline_layout : & B :: PipelineLayout , vertex_shader : & str , fragment_shader : & str , ) -> B :: GraphicsPipeline { let vertex_shader_module = device . create_shader_module ( & compile_shader ( vertex_shader , ShaderKind :: Vertex ) ) . expect ( " " ) ; let fragment_shader_module = device . create_shader_module ( & compile_shader ( fragment_shader , ShaderKind :: Fragment ) ) . expect ( " " ) ; let ( vs_entry , fs_entry ) = ( EntryPoint { entry : " " , module : & vertex_shader_module , specialization : Specialization :: default ( ) , } , EntryPoint { entry : " " , module : & fragment_shader_module , specialization : Specialization :: default ( ) , } , ) ; let primitive_assembler = PrimitiveAssemblerDesc :: Vertex { buffers : & [ ] , attributes : & [ ] , input_assembler : InputAssemblerDesc :: new ( Primitive :: TriangleStrip ) , vertex : vs_entry , tessellation : None , geometry : None , } ; let mut pipeline_desc = GraphicsPipelineDesc :: new ( primitive_assembler , Rasterizer { cull_face : Face :: BACK , .. Rasterizer :: FILL } , Some ( fs_entry ) , pipeline_layout , Subpass { index : 0 , main_pass : render_pass , } , ) ; pipeline_desc . blender . targets . push ( ColorBlendDesc { mask : ColorMask :: ALL , blend : Some ( BlendState :: ALPHA ) , } ) ; let pipeline = device . create_graphics_pipeline ( & pipeline_desc , None ) . expect ( " " ) ; device . destroy_shader_module ( vertex_shader_module ) ; device . destroy_shader_module ( fragment_shader_module ) ; pipeline }
Create a pipeline with the given layout and shaders.
Create a pipeline with the given layout and shaders .
device
&B::Device
render_pass
&B::RenderPass
pipeline_layout
&B::PipelineLayout
vertex_shader
&str
fragment_shader
&str