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

Method ensure_line_pipeline

src/plot_renderer/shader.rs:684–792  ·  view source on GitHub ↗
(&mut self, device: &Device)

Source from the content-addressed store, hash-verified

682 format: self.format,
683 blend: Some(BlendState::ALPHA_BLENDING),
684 write_mask: ColorWrites::ALL,
685 })],
686 }),
687 primitive: PrimitiveState {
688 topology: PrimitiveTopology::TriangleStrip,
689 strip_index_format: None,
690 front_face: FrontFace::Ccw,
691 cull_mode: Some(Face::Back),
692 polygon_mode: PolygonMode::Fill,
693 unclipped_depth: false,
694 conservative: false,
695 },
696 depth_stencil: None,
697 multisample: msaa_state(),
698 multiview: None,
699 cache: None,
700 });
701 self.pipelines.marker = Some(pipeline);
702 }
703
704 pub fn ensure_line_pipeline(&mut self, device: &Device) {
705 if self.pipelines.line.is_some() {
706 return;
707 }
708 let shader = device.create_shader_module(include_wgsl!("../shaders/line.wgsl"));
709 let layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
710 label: Some("line layout"),
711 bind_group_layouts: &[&self.camera_bgl],
712 push_constant_ranges: &[],
713 });
714 let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {
715 label: Some("line pipeline"),
716 layout: Some(&layout),
717 vertex: VertexState {
718 module: &shader,
719 entry_point: Some("vs_main"),
720 compilation_options: PipelineCompilationOptions::default(),
721 buffers: &[VertexBufferLayout {
722 // vec2<f32> segment_start (8) + vec2<f32> segment_end (8) + vec4<f32> color (16)
723 // + u32 line_style (4) + f32 distance_start (4) + f32 segment_length_world (4)
724 // + f32 style_param (4) + f32 width (4) + u32 width_mode (4)
725 // + f32 along (4) + f32 side (4)
726 array_stride: 64,
727 step_mode: VertexStepMode::Vertex,
728 attributes: &[
729 VertexAttribute {
730 offset: 0,
731 shader_location: 0,
732 format: VertexFormat::Float32x2, // segment_start
733 },
734 VertexAttribute {
735 offset: 8,
736 shader_location: 1,
737 format: VertexFormat::Float32x2, // segment_end
738 },
739 VertexAttribute {
740 offset: 16,
741 shader_location: 2,

Callers 1

Calls 1

msaa_stateFunction · 0.85

Tested by

no test coverage detected