/// Creates a new [MeshRenderPipeline] with the given parameters.
Creates a new [MeshRenderPipeline] with the given parameters.
Creates a new [ MeshRenderPipeline ] with the given parameters .
pub fn new(
        cx: &Context,
        samples: u32,
        format: wgpu::TextureFormat,
        blend: Option<wgpu::BlendState>,
        depth_stencil: Option<wgpu::DepthStencilState>,
    ) -> Self {
        let (layout, _) = PipelineLayout(&[
            BindGroupLayout(&[LayoutEntry::UniformBuffer {
                visible: wgpu::ShaderStages::VERTEX_FRAGMENT,
                count: None,
                dynamic_offset: true,
                min_binding_size: Some(
                    NonZeroU64::new(GpuDraw::std430_size_static() as _).unwrap(),
                ),
            }]),
            BindGroupLayout(&[LayoutEntry::Texture {
                visible: wgpu::ShaderStages::FRAGMENT,
                count: None,
                ty: wgpu::TextureSampleType::Float { filterable: true },
                dimension: wgpu::TextureViewDimension::D2,
                multisampled: false,
            }]),
            BindGroupLayout(&[LayoutEntry::Sampler {
                visible: wgpu::ShaderStages::FRAGMENT,
                count: None,
                comparison: false,
            }]),
        ])
        .create(cx);
        let shader = cx
            .device
            .create_shader_module(&wgpu::ShaderModuleDescriptor {
                label: None,
                source: wgpu::ShaderSource::Wgsl(include_str!("shader/mesh.wgsl").into()),
            });
        let pipeline = SimpleRenderPipeline {
            layout: Some(&layout),
            vertex: &shader,
            fragment: &shader,
            vertex_entry: "vs_main",
            fragment_entry: "fs_main",
            vertex_layout: Vertex::layout(),
            samples,
            format,
            blend,
            depth_stencil,
        }
        .create(cx);
        MeshRenderPipeline {
            layout: Arc::new(layout),
            pipeline: Arc::new(pipeline),
        }
    }
pub fn new ( cx : & Context , samples : u32 , format : wgpu :: TextureFormat , blend : Option < wgpu :: BlendState > , depth_stencil : Option < wgpu :: DepthStencilState > , ) -> Self { let ( layout , _ ) = PipelineLayout ( & [ BindGroupLayout ( & [ LayoutEntry :: UniformBuffer { visible : wgpu :: ShaderStages :: VERTEX_FRAGMENT , count : None , dynamic_offset : true , min_binding_size : Some ( NonZeroU64 :: new ( GpuDraw :: std430_size_static ( ) as _ ) . unwrap ( ) , ) , } ] ) , BindGroupLayout ( & [ LayoutEntry :: Texture { visible : wgpu :: ShaderStages :: FRAGMENT , count : None , ty : wgpu :: TextureSampleType :: Float { filterable : true } , dimension : wgpu :: TextureViewDimension :: D2 , multisampled : false , } ] ) , BindGroupLayout ( & [ LayoutEntry :: Sampler { visible : wgpu :: ShaderStages :: FRAGMENT , count : None , comparison : false , } ] ) , ] ) . create ( cx ) ; let shader = cx . device . create_shader_module ( & wgpu :: ShaderModuleDescriptor { label : None , source : wgpu :: ShaderSource :: Wgsl ( include_str ! ( " " ) . into ( ) ) , } ) ; let pipeline = SimpleRenderPipeline { layout : Some ( & layout ) , vertex : & shader , fragment : & shader , vertex_entry : " " , fragment_entry : " " , vertex_layout : Vertex :: layout ( ) , samples , format , blend , depth_stencil , } . create ( cx ) ; MeshRenderPipeline { layout : Arc :: new ( layout ) , pipeline : Arc :: new ( pipeline ) , } }
Creates a new [MeshRenderPipeline] with the given parameters.
Creates a new [ MeshRenderPipeline ] with the given parameters .
cx
&Context
samples
u32
format
wgpu::TextureFormat
blend
Option<wgpu::BlendState>
depth_stencil
Option<wgpu::DepthStencilState>