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

Method service

src/picking.rs:368–519  ·  view source on GitHub ↗
(
        &mut self,
        instance_id: u64,
        device: &Device,
        queue: &Queue,
        camera_bg: &BindGroup,
        camera_bgl: &BindGroupLayout,
        marker_vb: Option<&Buffer>,

Source from the content-addressed store, hash-verified

366 /// Publishes a PickResult via the registry.
367 #[allow(clippy::too_many_arguments)]
368 pub(crate) fn service(
369 &mut self,
370 instance_id: u64,
371 device: &Device,
372 queue: &Queue,
373 camera_bg: &BindGroup,
374 camera_bgl: &BindGroupLayout,
375 marker_vb: Option<&Buffer>,
376 marker_instances: u32,
377 points: &[Point],
378 series: &[SeriesSpan],
379 ) {
380 self.poll_pending(device, points, series);
381
382 if self.pending.is_some() {
383 return;
384 }
385
386 // Take the latest request, if any
387 let req = match take_latest_request(instance_id) {
388 Some(r) => r,
389 None => return,
390 };
391
392 if marker_vb.is_none() || marker_instances == 0 {
393 publish_result(
394 instance_id,
395 GpuPickResult {
396 seq: req.seq,
397 hit: None,
398 },
399 );
400 return;
401 }
402
403 // Ensure resources
404 self.ensure_target(device);
405 self.ensure_pipeline(device, camera_bgl);
406
407 let vb = marker_vb.unwrap();
408 let view = self.pick_view.as_ref().unwrap();
409
410 // Draw IDs into pick texture
411 let mut encoder = device.create_command_encoder(&CommandEncoderDescriptor {
412 label: Some("pick encoder"),
413 });
414 {
415 let mut pass = encoder.begin_render_pass(&RenderPassDescriptor {
416 label: Some("pick pass"),
417 color_attachments: &[Some(RenderPassColorAttachment {
418 view,
419 resolve_target: None,
420 ops: Operations {
421 load: LoadOp::Clear(Color {
422 r: 0.0,
423 g: 0.0,
424 b: 0.0,
425 a: 0.0,

Callers 1

service_pickingMethod · 0.80

Calls 8

take_latest_requestFunction · 0.85
publish_resultFunction · 0.85
poll_pendingMethod · 0.80
ensure_targetMethod · 0.80
ensure_stagingMethod · 0.80
newFunction · 0.50
ensure_pipelineMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected