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

Method ensure_msaa_targets

src/plot_renderer/shader.rs:443–501  ·  view source on GitHub ↗
(&mut self, device: &Device, width: u32, height: u32)

Source from the content-addressed store, hash-verified

441 }
442 self.ensure_overlay_pipeline(device);
443 self.ensure_line_overlay_pipeline(device);
444 // Composite yalnız `encode`'un resolve→hedef blit'inde kullanılır;
445 // pas-içi (MSAA=1) yolda gereksiz.
446 if MSAA_SAMPLE_COUNT > 1 {
447 self.ensure_composite_pipeline(device);
448 }
449 }
450 fn set_bounds(&mut self, w: u32, h: u32) {
451 self.bounds_w = w;
452 self.bounds_h = h;
453 }
454 fn set_scale_factor(&mut self, scale: f32) {
455 self.scale_factor = scale;
456 }
457
458 fn ensure_msaa_targets(&mut self, device: &Device, width: u32, height: u32) {
459 let width = width.max(1);
460 let height = height.max(1);
461
462 if self
463 .msaa_targets
464 .as_ref()
465 .is_some_and(|targets| targets.width == width && targets.height == height)
466 {
467 return;
468 }
469
470 let msaa_texture = create_color_texture(
471 device,
472 "iced_plot msaa color",
473 width,
474 height,
475 MSAA_SAMPLE_COUNT,
476 self.format,
477 TextureUsages::RENDER_ATTACHMENT,
478 );
479 let msaa_view = msaa_texture.create_view(&TextureViewDescriptor::default());
480
481 let resolved_texture = create_color_texture(
482 device,
483 "iced_plot resolved color",
484 width,
485 height,
486 1,
487 self.format,
488 TextureUsages::RENDER_ATTACHMENT | TextureUsages::TEXTURE_BINDING,
489 );
490 let resolved_view = resolved_texture.create_view(&TextureViewDescriptor::default());
491
492 let composite_bind_group = device.create_bind_group(&BindGroupDescriptor {
493 label: Some("plot composite bind group"),
494 layout: &self.composite_bgl,
495 entries: &[
496 BindGroupEntry {
497 binding: 0,
498 resource: BindingResource::TextureView(&resolved_view),
499 },
500 BindGroupEntry {

Callers 1

prepare_frameMethod · 0.80

Calls 1

create_color_textureFunction · 0.85

Tested by

no test coverage detected