MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / ensure_pipeline

Method ensure_pipeline

src/picking.rs:669–745  ·  view source on GitHub ↗
(&mut self, device: &Device, camera_bgl: &BindGroupLayout)

Source from the content-addressed store, hash-verified

667 }
668
669 fn ensure_pipeline(&mut self, device: &Device, camera_bgl: &BindGroupLayout) {
670 if self.pipeline.is_some() {
671 return;
672 }
673 let shader = device.create_shader_module(include_wgsl!("shaders/pick_markers.wgsl"));
674 let layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
675 label: Some("pick layout"),
676 bind_group_layouts: &[camera_bgl],
677 push_constant_ranges: &[],
678 });
679 let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {
680 label: Some("pick pipeline"),
681 layout: Some(&layout),
682 vertex: VertexState {
683 module: &shader,
684 entry_point: Some("vs_main"),
685 compilation_options: PipelineCompilationOptions::default(),
686 buffers: &[VertexBufferLayout {
687 // Must match markers: 36 bytes per instance.
688 // Location 4 packs size_mode in bit 0 and pickable in bit 1.
689 array_stride: 36,
690 step_mode: VertexStepMode::Instance,
691 attributes: &[
692 VertexAttribute {
693 offset: 0,
694 shader_location: 0,
695 format: VertexFormat::Float32x2,
696 },
697 VertexAttribute {
698 offset: 8,
699 shader_location: 1,
700 format: VertexFormat::Float32x4,
701 },
702 VertexAttribute {
703 offset: 24,
704 shader_location: 2,
705 format: VertexFormat::Uint32,
706 },
707 VertexAttribute {
708 offset: 28,
709 shader_location: 3,
710 format: VertexFormat::Float32,
711 },
712 VertexAttribute {
713 offset: 32,
714 shader_location: 4,
715 format: VertexFormat::Uint32,
716 },
717 ],
718 }],
719 },
720 fragment: Some(FragmentState {
721 module: &shader,
722 entry_point: Some("fs_main"),
723 compilation_options: PipelineCompilationOptions::default(),
724 targets: &[Some(ColorTargetState {
725 format: TextureFormat::R32Uint,
726 blend: None,

Callers 1

serviceMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected