(&mut self, device: &Device)
| 602 | ) { |
| 603 | let marker_buffer = self.buffers.markers.as_ref().map(|vb| &vb.buffer); |
| 604 | let marker_instances = self |
| 605 | .buffers |
| 606 | .markers |
| 607 | .as_ref() |
| 608 | .map(|vb| vb.vertex_count) |
| 609 | .unwrap_or(0); |
| 610 | |
| 611 | self.picking.service( |
| 612 | instance_id, |
| 613 | device, |
| 614 | queue, |
| 615 | &self.camera_bind_group, |
| 616 | &self.camera_bgl, |
| 617 | marker_buffer, |
| 618 | marker_instances, |
| 619 | &state.points, |
| 620 | &state.series, |
| 621 | ); |
| 622 | } |
| 623 | |
| 624 | pub fn ensure_marker_pipeline(&mut self, device: &Device) { |
| 625 | if self.pipelines.marker.is_some() { |
| 626 | return; |
| 627 | } |
| 628 | let shader = device.create_shader_module(include_wgsl!("../shaders/markers.wgsl")); |
| 629 | let layout = device.create_pipeline_layout(&PipelineLayoutDescriptor { |
| 630 | label: Some("markers layout"), |
| 631 | bind_group_layouts: &[&self.camera_bgl], |
| 632 | push_constant_ranges: &[], |
| 633 | }); |
| 634 | let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor { |
| 635 | label: Some("markers pipeline"), |
| 636 | layout: Some(&layout), |
| 637 | vertex: VertexState { |
| 638 | module: &shader, |
| 639 | entry_point: Some("vs_main"), |
| 640 | compilation_options: PipelineCompilationOptions::default(), |
| 641 | buffers: &[VertexBufferLayout { |
| 642 | // Explicit 36-byte stride: vec2<f32> position (8) + vec4<f32> color (16) |
| 643 | // + u32 marker (4) + f32 size (4) + u32 size_mode/pickable flags (4) = 36 |
| 644 | array_stride: 36u64, |
| 645 | step_mode: VertexStepMode::Instance, |
| 646 | attributes: &[ |
| 647 | VertexAttribute { |
| 648 | offset: 0, |
| 649 | shader_location: 0, |
| 650 | format: VertexFormat::Float32x2, |
| 651 | }, |
| 652 | VertexAttribute { |
| 653 | offset: std::mem::size_of::<[f32; 2]>() as u64, |
| 654 | shader_location: 1, |
| 655 | format: VertexFormat::Float32x4, |
| 656 | }, |
| 657 | VertexAttribute { |
| 658 | offset: std::mem::size_of::<[f32; 6]>() as u64, |
| 659 | shader_location: 2, |
| 660 | format: VertexFormat::Uint32, |
| 661 | }, |
no test coverage detected